ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/applications/staticProps/StaticPropsCmd.c
(Generate patch)

Comparing trunk/OOPSE-4/src/applications/staticProps/StaticPropsCmd.c (file contents):
Revision 2763 by xsun, Mon May 22 15:30:42 2006 UTC vs.
Revision 3322 by xsun, Wed Jan 23 21:21:50 2008 UTC

# Line 1 | Line 1
1   /*
2 <  File autogenerated by gengetopt version 2.16
2 >  File autogenerated by gengetopt version 2.19.1
3    generated with the following command:
4 <  gengetopt -F StaticPropsCmd
4 >  gengetopt --file-name=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 21 | Line 21 | static
21  
22   #include "StaticPropsCmd.h"
23  
24 + const char *gengetopt_args_info_purpose = "";
25 +
26 + const char *gengetopt_args_info_usage = "Usage: StaticProps [OPTIONS]... [FILES]...";
27 +
28 + const char *gengetopt_args_info_description = "";
29 +
30 + const char *gengetopt_args_info_help[] = {
31 +  "  -h, --help                    Print help and exit",
32 +  "  -V, --version                 Print version and exit",
33 +  "  -i, --input=filename          input dump file",
34 +  "  -o, --output=filename         output file name",
35 +  "  -n, --step=INT                process every n frame  (default=`1')",
36 +  "  -b, --nbins=INT               number of bins (general purpose)  \n                                  (default=`100')",
37 +  "  -x, --nbins_x=INT             number of bins in x axis  (default=`100')",
38 +  "  -y, --nbins_y=INT             number of bins in y axis  (default=`100')",
39 +  "  -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)",
41 +  "  -c, --rcut=DOUBLE             cutoff radius (rcut)",
42 +  "  -z, --zoffset=DOUBLE          Where to set the zero for the slab_density \n                                  calculation  (default=`0')",
43 +  "      --sele1=selection script  select the first stuntdouble set",
44 +  "      --sele2=selection script  select the second stuntdouble set",
45 +  "      --sele3=selection script  select the third stuntdouble set",
46 +  "      --refsele=selection script\n                                select reference (use and only use with --gxyz)",
47 +  "      --molname=STRING          molecule name",
48 +  "      --begin=INT               begin internal index",
49 +  "      --end=INT                 end internal index",
50 +  "      --radius=DOUBLE           nanoparticle radius",
51 +  "\n Group: staticProps\n   an option of this group is required",
52 +  "      --bo                      bond order parameter (--rcut must be specified)",
53 +  "      --bor                     bond order parameter as a function of radius \n                                  (--rcut must be specified)",
54 +  "      --bad                     N(theta) bond angle density within (--rcut must \n                                  be specified)",
55 +  "  -g, --gofr                    g(r)",
56 +  "      --gofz                    g(z)",
57 +  "      --r_theta                 g(r, cos(theta))",
58 +  "      --r_omega                 g(r, cos(omega))",
59 +  "      --theta_omega             g(cos(theta), cos(omega))",
60 +  "      --gxyz                    g(x, y, z)",
61 +  "  -p, --p2                      p2 order parameter (--sele1 and --sele2 must be \n                                  specified)",
62 +  "      --rp2                     rp2 order parameter (--sele1 and --sele2 must \n                                  be specified)",
63 +  "  -s, --scd                     scd order parameter (either --sele1, --sele2, \n                                  --sele3 are specified or --molname, --begin, \n                                  --end are specified)",
64 +  "  -d, --density                 density plot",
65 +  "      --slab_density            slab density",
66 +  "      --hxy                     hxy",
67 +  "      --rho_r                   rho of R",
68 +  "      --hullvol                 hull volume of nanoparticle",
69 +    0
70 + };
71 +
72   static
73   void clear_given (struct gengetopt_args_info *args_info);
74   static
# Line 43 | Line 91 | void clear_given (struct gengetopt_args_info *args_inf
91    args_info->input_given = 0 ;
92    args_info->output_given = 0 ;
93    args_info->step_given = 0 ;
94 <  args_info->nrbins_given = 0 ;
94 >  args_info->nbins_given = 0 ;
95    args_info->nbins_x_given = 0 ;
96    args_info->nbins_y_given = 0 ;
97    args_info->nanglebins_given = 0 ;
98    args_info->length_given = 0 ;
99 +  args_info->rcut_given = 0 ;
100    args_info->zoffset_given = 0 ;
101    args_info->sele1_given = 0 ;
102    args_info->sele2_given = 0 ;
# Line 56 | Line 105 | void clear_given (struct gengetopt_args_info *args_inf
105    args_info->molname_given = 0 ;
106    args_info->begin_given = 0 ;
107    args_info->end_given = 0 ;
108 +  args_info->radius_given = 0 ;
109 +  args_info->bo_given = 0 ;
110 +  args_info->bor_given = 0 ;
111 +  args_info->bad_given = 0 ;
112    args_info->gofr_given = 0 ;
113 +  args_info->gofz_given = 0 ;
114    args_info->r_theta_given = 0 ;
115    args_info->r_omega_given = 0 ;
116    args_info->theta_omega_given = 0 ;
117    args_info->gxyz_given = 0 ;
118    args_info->p2_given = 0 ;
119 +  args_info->rp2_given = 0 ;
120    args_info->scd_given = 0 ;
121    args_info->density_given = 0 ;
122    args_info->slab_density_given = 0 ;
123    args_info->hxy_given = 0 ;
124 +  args_info->rho_r_given = 0 ;
125 +  args_info->hullvol_given = 0 ;
126    args_info->staticProps_group_counter = 0 ;
127   }
128  
# Line 78 | Line 135 | void clear_args (struct gengetopt_args_info *args_info
135    args_info->output_orig = NULL;
136    args_info->step_arg = 1;
137    args_info->step_orig = NULL;
138 <  args_info->nrbins_arg = 100;
139 <  args_info->nrbins_orig = NULL;
138 >  args_info->nbins_arg = 100;
139 >  args_info->nbins_orig = NULL;
140    args_info->nbins_x_arg = 100;
141    args_info->nbins_x_orig = NULL;
142    args_info->nbins_y_arg = 100;
# Line 87 | Line 144 | void clear_args (struct gengetopt_args_info *args_info
144    args_info->nanglebins_arg = 50;
145    args_info->nanglebins_orig = NULL;
146    args_info->length_orig = NULL;
147 +  args_info->rcut_orig = NULL;
148    args_info->zoffset_arg = 0;
149    args_info->zoffset_orig = NULL;
150    args_info->sele1_arg = NULL;
# Line 101 | Line 159 | void clear_args (struct gengetopt_args_info *args_info
159    args_info->molname_orig = NULL;
160    args_info->begin_orig = NULL;
161    args_info->end_orig = NULL;
162 +  args_info->radius_orig = NULL;
163    
164   }
165  
166 + static
167 + void init_args_info(struct gengetopt_args_info *args_info)
168 + {
169 +  args_info->help_help = gengetopt_args_info_help[0] ;
170 +  args_info->version_help = gengetopt_args_info_help[1] ;
171 +  args_info->input_help = gengetopt_args_info_help[2] ;
172 +  args_info->output_help = gengetopt_args_info_help[3] ;
173 +  args_info->step_help = gengetopt_args_info_help[4] ;
174 +  args_info->nbins_help = gengetopt_args_info_help[5] ;
175 +  args_info->nbins_x_help = gengetopt_args_info_help[6] ;
176 +  args_info->nbins_y_help = gengetopt_args_info_help[7] ;
177 +  args_info->nanglebins_help = gengetopt_args_info_help[8] ;
178 +  args_info->length_help = gengetopt_args_info_help[9] ;
179 +  args_info->rcut_help = gengetopt_args_info_help[10] ;
180 +  args_info->zoffset_help = gengetopt_args_info_help[11] ;
181 +  args_info->sele1_help = gengetopt_args_info_help[12] ;
182 +  args_info->sele2_help = gengetopt_args_info_help[13] ;
183 +  args_info->sele3_help = gengetopt_args_info_help[14] ;
184 +  args_info->refsele_help = gengetopt_args_info_help[15] ;
185 +  args_info->molname_help = gengetopt_args_info_help[16] ;
186 +  args_info->begin_help = gengetopt_args_info_help[17] ;
187 +  args_info->end_help = gengetopt_args_info_help[18] ;
188 +  args_info->radius_help = gengetopt_args_info_help[19] ;
189 +  args_info->bo_help = gengetopt_args_info_help[20] ;
190 +  args_info->bor_help = gengetopt_args_info_help[21] ;
191 +  args_info->bad_help = gengetopt_args_info_help[22] ;
192 +  args_info->gofr_help = gengetopt_args_info_help[23] ;
193 +  args_info->gofz_help = gengetopt_args_info_help[24] ;
194 +  args_info->r_theta_help = gengetopt_args_info_help[25] ;
195 +  args_info->r_omega_help = gengetopt_args_info_help[26] ;
196 +  args_info->theta_omega_help = gengetopt_args_info_help[27] ;
197 +  args_info->gxyz_help = gengetopt_args_info_help[28] ;
198 +  args_info->p2_help = gengetopt_args_info_help[29] ;
199 +  args_info->rp2_help = gengetopt_args_info_help[30] ;
200 +  args_info->scd_help = gengetopt_args_info_help[31] ;
201 +  args_info->density_help = gengetopt_args_info_help[32] ;
202 +  args_info->slab_density_help = gengetopt_args_info_help[33] ;
203 +  args_info->hxy_help = gengetopt_args_info_help[34] ;
204 +  args_info->rho_r_help = gengetopt_args_info_help[35] ;
205 +  args_info->hullvol_help = gengetopt_args_info_help[36] ;
206 +  
207 + }
208 +
209   void
210   cmdline_parser_print_version (void)
211   {
# Line 113 | Line 215 | cmdline_parser_print_help (void)
215   void
216   cmdline_parser_print_help (void)
217   {
218 +  int i = 0;
219    cmdline_parser_print_version ();
220 <  printf("\nUsage: StaticProps [OPTIONS]...\n\n");
221 <  printf("%s\n","  -h, --help                    Print help and exit");
222 <  printf("%s\n","  -V, --version                 Print version and exit");
223 <  printf("%s\n","  -i, --input=filename          input dump file");
224 <  printf("%s\n","  -o, --output=filename         output file name");
225 <  printf("%s\n","  -n, --step=INT                process every n frame  (default=`1')");
226 <  printf("%s\n","  -r, --nrbins=INT              number of bins for distance  (default=`100')");
227 <  printf("%s\n","  -x, --nbins_x=INT             number of bins in x axis  (default=`100')");
228 <  printf("%s\n","  -y, --nbins_y=INT             number of bins in y axis  (default=`100')");
229 <  printf("%s\n","  -a, --nanglebins=INT          number of bins for cos(angle)  (default=`50')");
230 <  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 <  
220 >
221 >  if (strlen(gengetopt_args_info_purpose) > 0)
222 >    printf("\n%s\n", gengetopt_args_info_purpose);
223 >
224 >  printf("\n%s\n\n", gengetopt_args_info_usage);
225 >
226 >  if (strlen(gengetopt_args_info_description) > 0)
227 >    printf("%s\n", gengetopt_args_info_description);
228 >
229 >  while (gengetopt_args_info_help[i])
230 >    printf("%s\n", gengetopt_args_info_help[i++]);
231   }
232  
233   void
# Line 152 | Line 235 | cmdline_parser_init (struct gengetopt_args_info *args_
235   {
236    clear_given (args_info);
237    clear_args (args_info);
238 +  init_args_info (args_info);
239 +
240 +  args_info->inputs = NULL;
241 +  args_info->inputs_num = 0;
242   }
243  
244   static void
245   cmdline_parser_release (struct gengetopt_args_info *args_info)
246   {
247    
248 +  unsigned int i;
249    if (args_info->input_arg)
250      {
251        free (args_info->input_arg); /* free previous argument */
# Line 183 | Line 271 | cmdline_parser_release (struct gengetopt_args_info *ar
271        free (args_info->step_orig); /* free previous argument */
272        args_info->step_orig = 0;
273      }
274 <  if (args_info->nrbins_orig)
274 >  if (args_info->nbins_orig)
275      {
276 <      free (args_info->nrbins_orig); /* free previous argument */
277 <      args_info->nrbins_orig = 0;
276 >      free (args_info->nbins_orig); /* free previous argument */
277 >      args_info->nbins_orig = 0;
278      }
279    if (args_info->nbins_x_orig)
280      {
# Line 208 | Line 296 | cmdline_parser_release (struct gengetopt_args_info *ar
296        free (args_info->length_orig); /* free previous argument */
297        args_info->length_orig = 0;
298      }
299 +  if (args_info->rcut_orig)
300 +    {
301 +      free (args_info->rcut_orig); /* free previous argument */
302 +      args_info->rcut_orig = 0;
303 +    }
304    if (args_info->zoffset_orig)
305      {
306        free (args_info->zoffset_orig); /* free previous argument */
# Line 273 | Line 366 | cmdline_parser_release (struct gengetopt_args_info *ar
366        free (args_info->end_orig); /* free previous argument */
367        args_info->end_orig = 0;
368      }
369 +  if (args_info->radius_orig)
370 +    {
371 +      free (args_info->radius_orig); /* free previous argument */
372 +      args_info->radius_orig = 0;
373 +    }
374    
375 +  for (i = 0; i < args_info->inputs_num; ++i)
376 +    free (args_info->inputs [i]);
377 +  
378 +  if (args_info->inputs_num)
379 +    free (args_info->inputs);
380 +  
381    clear_given (args_info);
382   }
383  
# Line 318 | Line 422 | cmdline_parser_file_save(const char *filename, struct
422        fprintf(outfile, "%s\n", "step");
423      }
424    }
425 <  if (args_info->nrbins_given) {
426 <    if (args_info->nrbins_orig) {
427 <      fprintf(outfile, "%s=\"%s\"\n", "nrbins", args_info->nrbins_orig);
425 >  if (args_info->nbins_given) {
426 >    if (args_info->nbins_orig) {
427 >      fprintf(outfile, "%s=\"%s\"\n", "nbins", args_info->nbins_orig);
428      } else {
429 <      fprintf(outfile, "%s\n", "nrbins");
429 >      fprintf(outfile, "%s\n", "nbins");
430      }
431    }
432    if (args_info->nbins_x_given) {
# Line 353 | Line 457 | cmdline_parser_file_save(const char *filename, struct
457        fprintf(outfile, "%s\n", "length");
458      }
459    }
460 +  if (args_info->rcut_given) {
461 +    if (args_info->rcut_orig) {
462 +      fprintf(outfile, "%s=\"%s\"\n", "rcut", args_info->rcut_orig);
463 +    } else {
464 +      fprintf(outfile, "%s\n", "rcut");
465 +    }
466 +  }
467    if (args_info->zoffset_given) {
468      if (args_info->zoffset_orig) {
469        fprintf(outfile, "%s=\"%s\"\n", "zoffset", args_info->zoffset_orig);
# Line 409 | Line 520 | cmdline_parser_file_save(const char *filename, struct
520        fprintf(outfile, "%s\n", "end");
521      }
522    }
523 +  if (args_info->radius_given) {
524 +    if (args_info->radius_orig) {
525 +      fprintf(outfile, "%s=\"%s\"\n", "radius", args_info->radius_orig);
526 +    } else {
527 +      fprintf(outfile, "%s\n", "radius");
528 +    }
529 +  }
530 +  if (args_info->bo_given) {
531 +    fprintf(outfile, "%s\n", "bo");
532 +  }
533 +  if (args_info->bor_given) {
534 +    fprintf(outfile, "%s\n", "bor");
535 +  }
536 +  if (args_info->bad_given) {
537 +    fprintf(outfile, "%s\n", "bad");
538 +  }
539    if (args_info->gofr_given) {
540      fprintf(outfile, "%s\n", "gofr");
541    }
542 +  if (args_info->gofz_given) {
543 +    fprintf(outfile, "%s\n", "gofz");
544 +  }
545    if (args_info->r_theta_given) {
546      fprintf(outfile, "%s\n", "r_theta");
547    }
# Line 427 | Line 557 | cmdline_parser_file_save(const char *filename, struct
557    if (args_info->p2_given) {
558      fprintf(outfile, "%s\n", "p2");
559    }
560 +  if (args_info->rp2_given) {
561 +    fprintf(outfile, "%s\n", "rp2");
562 +  }
563    if (args_info->scd_given) {
564      fprintf(outfile, "%s\n", "scd");
565    }
# Line 439 | Line 572 | cmdline_parser_file_save(const char *filename, struct
572    if (args_info->hxy_given) {
573      fprintf(outfile, "%s\n", "hxy");
574    }
575 +  if (args_info->rho_r_given) {
576 +    fprintf(outfile, "%s\n", "rho_r");
577 +  }
578 +  if (args_info->hullvol_given) {
579 +    fprintf(outfile, "%s\n", "hullvol");
580 +  }
581    
582    fclose (outfile);
583  
# Line 478 | Line 617 | reset_group_staticProps(struct gengetopt_args_info *ar
617    if (! args_info->staticProps_group_counter)
618      return;
619    
620 +  args_info->bo_given = 0 ;
621 +  args_info->bor_given = 0 ;
622 +  args_info->bad_given = 0 ;
623    args_info->gofr_given = 0 ;
624 +  args_info->gofz_given = 0 ;
625    args_info->r_theta_given = 0 ;
626    args_info->r_omega_given = 0 ;
627    args_info->theta_omega_given = 0 ;
628    args_info->gxyz_given = 0 ;
629    args_info->p2_given = 0 ;
630 +  args_info->rp2_given = 0 ;
631    args_info->scd_given = 0 ;
632    args_info->density_given = 0 ;
633    args_info->slab_density_given = 0 ;
634    args_info->hxy_given = 0 ;
635 +  args_info->rho_r_given = 0 ;
636 +  args_info->hullvol_given = 0 ;
637  
638    args_info->staticProps_group_counter = 0;
639   }
# Line 536 | Line 682 | cmdline_parser_required2 (struct gengetopt_args_info *
682   {
683    int error = 0;
684  
685 +  /* checks for required options */
686    if (! args_info->input_given)
687      {
688        fprintf (stderr, "%s: '--input' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : ""));
689        error = 1;
690      }
691 +  
692    if (args_info->staticProps_group_counter == 0)
693      {
694        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 : ""));
# Line 548 | Line 696 | cmdline_parser_required2 (struct gengetopt_args_info *
696      }
697    
698  
699 +  /* checks for dependences among options */
700 +
701    return error;
702   }
703  
# Line 580 | Line 730 | cmdline_parser_internal (int argc, char * const *argv,
730          { "input",      1, NULL, 'i' },
731          { "output",     1, NULL, 'o' },
732          { "step",       1, NULL, 'n' },
733 <        { "nrbins",     1, NULL, 'r' },
733 >        { "nbins",      1, NULL, 'b' },
734          { "nbins_x",    1, NULL, 'x' },
735          { "nbins_y",    1, NULL, 'y' },
736          { "nanglebins", 1, NULL, 'a' },
737 <        { "length",     1, NULL, 'l' },
737 >        { "length",     1, NULL, 0 },
738 >        { "rcut",       1, NULL, 'c' },
739          { "zoffset",    1, NULL, 'z' },
740          { "sele1",      1, NULL, 0 },
741          { "sele2",      1, NULL, 0 },
# Line 593 | Line 744 | cmdline_parser_internal (int argc, char * const *argv,
744          { "molname",    1, NULL, 0 },
745          { "begin",      1, NULL, 0 },
746          { "end",        1, NULL, 0 },
747 <        { "gofr",       0, NULL, 0 },
747 >        { "radius",     1, NULL, 0 },
748 >        { "bo", 0, NULL, 0 },
749 >        { "bor",        0, NULL, 0 },
750 >        { "bad",        0, NULL, 0 },
751 >        { "gofr",       0, NULL, 'g' },
752 >        { "gofz",       0, NULL, 0 },
753          { "r_theta",    0, NULL, 0 },
754          { "r_omega",    0, NULL, 0 },
755          { "theta_omega",        0, NULL, 0 },
756          { "gxyz",       0, NULL, 0 },
757 <        { "p2", 0, NULL, 0 },
758 <        { "scd",        0, NULL, 0 },
759 <        { "density",    0, NULL, 0 },
757 >        { "p2", 0, NULL, 'p' },
758 >        { "rp2",        0, NULL, 0 },
759 >        { "scd",        0, NULL, 's' },
760 >        { "density",    0, NULL, 'd' },
761          { "slab_density",       0, NULL, 0 },
762          { "hxy",        0, NULL, 0 },
763 +        { "rho_r",      0, NULL, 0 },
764 +        { "hullvol",    0, NULL, 0 },
765          { NULL, 0, NULL, 0 }
766        };
767  
768        stop_char = 0;
769 <      c = getopt_long (argc, argv, "hVi:o:n:r:x:y:a:l:z:", long_options, &option_index);
769 >      c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsd", long_options, &option_index);
770  
771        if (c == -1) break;       /* Exit from `while (1)' loop.  */
772  
# Line 679 | Line 838 | cmdline_parser_internal (int argc, char * const *argv,
838            args_info->step_orig = gengetopt_strdup (optarg);
839            break;
840  
841 <        case 'r':       /* number of bins for distance.  */
842 <          if (local_args_info.nrbins_given)
841 >        case 'b':       /* number of bins (general purpose).  */
842 >          if (local_args_info.nbins_given)
843              {
844 <              fprintf (stderr, "%s: `--nrbins' (`-r') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
844 >              fprintf (stderr, "%s: `--nbins' (`-b') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
845                goto failure;
846              }
847 <          if (args_info->nrbins_given && ! override)
847 >          if (args_info->nbins_given && ! override)
848              continue;
849 <          local_args_info.nrbins_given = 1;
850 <          args_info->nrbins_given = 1;
851 <          args_info->nrbins_arg = strtol (optarg, &stop_char, 0);
849 >          local_args_info.nbins_given = 1;
850 >          args_info->nbins_given = 1;
851 >          args_info->nbins_arg = strtol (optarg, &stop_char, 0);
852            if (!(stop_char && *stop_char == '\0')) {
853              fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
854              goto failure;
855            }
856 <          if (args_info->nrbins_orig)
857 <            free (args_info->nrbins_orig); /* free previous string */
858 <          args_info->nrbins_orig = gengetopt_strdup (optarg);
856 >          if (args_info->nbins_orig)
857 >            free (args_info->nbins_orig); /* free previous string */
858 >          args_info->nbins_orig = gengetopt_strdup (optarg);
859            break;
860  
861          case 'x':       /* number of bins in x axis.  */
# Line 759 | Line 918 | cmdline_parser_internal (int argc, char * const *argv,
918            args_info->nanglebins_orig = gengetopt_strdup (optarg);
919            break;
920  
921 <        case 'l':       /* maximum length (Defaults to 1/2 smallest length of first frame).  */
922 <          if (local_args_info.length_given)
921 >        case 'c':       /* cutoff radius (rcut).  */
922 >          if (local_args_info.rcut_given)
923              {
924 <              fprintf (stderr, "%s: `--length' (`-l') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
924 >              fprintf (stderr, "%s: `--rcut' (`-c') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
925                goto failure;
926              }
927 <          if (args_info->length_given && ! override)
927 >          if (args_info->rcut_given && ! override)
928              continue;
929 <          local_args_info.length_given = 1;
930 <          args_info->length_given = 1;
931 <          args_info->length_arg = strtod (optarg, &stop_char);
929 >          local_args_info.rcut_given = 1;
930 >          args_info->rcut_given = 1;
931 >          args_info->rcut_arg = strtod (optarg, &stop_char);
932            if (!(stop_char && *stop_char == '\0')) {
933              fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
934              goto failure;
935            }
936 <          if (args_info->length_orig)
937 <            free (args_info->length_orig); /* free previous string */
938 <          args_info->length_orig = gengetopt_strdup (optarg);
936 >          if (args_info->rcut_orig)
937 >            free (args_info->rcut_orig); /* free previous string */
938 >          args_info->rcut_orig = gengetopt_strdup (optarg);
939            break;
940  
941          case 'z':       /* Where to set the zero for the slab_density calculation.  */
# Line 799 | Line 958 | cmdline_parser_internal (int argc, char * const *argv,
958            args_info->zoffset_orig = gengetopt_strdup (optarg);
959            break;
960  
961 +        case 'g':       /* g(r).  */
962 +          if (local_args_info.gofr_given)
963 +            {
964 +              fprintf (stderr, "%s: `--gofr' (`-g') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
965 +              goto failure;
966 +            }
967 +          if (args_info->gofr_given && ! override)
968 +            continue;
969 +          local_args_info.gofr_given = 1;
970 +          args_info->gofr_given = 1;
971 +          if (args_info->staticProps_group_counter && override)
972 +            reset_group_staticProps (args_info);
973 +          args_info->staticProps_group_counter += 1;
974 +          break;
975  
976 +        case 'p':       /* p2 order parameter (--sele1 and --sele2 must be specified).  */
977 +          if (local_args_info.p2_given)
978 +            {
979 +              fprintf (stderr, "%s: `--p2' (`-p') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
980 +              goto failure;
981 +            }
982 +          if (args_info->p2_given && ! override)
983 +            continue;
984 +          local_args_info.p2_given = 1;
985 +          args_info->p2_given = 1;
986 +          if (args_info->staticProps_group_counter && override)
987 +            reset_group_staticProps (args_info);
988 +          args_info->staticProps_group_counter += 1;
989 +          break;
990 +
991 +        case 's':       /* scd order parameter (either --sele1, --sele2, --sele3 are specified or --molname, --begin, --end are specified).  */
992 +          if (local_args_info.scd_given)
993 +            {
994 +              fprintf (stderr, "%s: `--scd' (`-s') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
995 +              goto failure;
996 +            }
997 +          if (args_info->scd_given && ! override)
998 +            continue;
999 +          local_args_info.scd_given = 1;
1000 +          args_info->scd_given = 1;
1001 +          if (args_info->staticProps_group_counter && override)
1002 +            reset_group_staticProps (args_info);
1003 +          args_info->staticProps_group_counter += 1;
1004 +          break;
1005 +
1006 +        case 'd':       /* density plot.  */
1007 +          if (local_args_info.density_given)
1008 +            {
1009 +              fprintf (stderr, "%s: `--density' (`-d') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1010 +              goto failure;
1011 +            }
1012 +          if (args_info->density_given && ! override)
1013 +            continue;
1014 +          local_args_info.density_given = 1;
1015 +          args_info->density_given = 1;
1016 +          if (args_info->staticProps_group_counter && override)
1017 +            reset_group_staticProps (args_info);
1018 +          args_info->staticProps_group_counter += 1;
1019 +          break;
1020 +
1021 +
1022          case 0: /* Long option with no short option */
1023 +          /* maximum length (Defaults to 1/2 smallest length of first frame).  */
1024 +          if (strcmp (long_options[option_index].name, "length") == 0)
1025 +          {
1026 +            if (local_args_info.length_given)
1027 +              {
1028 +                fprintf (stderr, "%s: `--length' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1029 +                goto failure;
1030 +              }
1031 +            if (args_info->length_given && ! override)
1032 +              continue;
1033 +            local_args_info.length_given = 1;
1034 +            args_info->length_given = 1;
1035 +            args_info->length_arg = strtod (optarg, &stop_char);
1036 +            if (!(stop_char && *stop_char == '\0')) {
1037 +              fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
1038 +              goto failure;
1039 +            }
1040 +            if (args_info->length_orig)
1041 +              free (args_info->length_orig); /* free previous string */
1042 +            args_info->length_orig = gengetopt_strdup (optarg);
1043 +          }
1044            /* select the first stuntdouble set.  */
1045 <          if (strcmp (long_options[option_index].name, "sele1") == 0)
1045 >          else if (strcmp (long_options[option_index].name, "sele1") == 0)
1046            {
1047              if (local_args_info.sele1_given)
1048                {
# Line 896 | Line 1136 | cmdline_parser_internal (int argc, char * const *argv,
1136                free (args_info->molname_orig); /* free previous string */
1137              args_info->molname_orig = gengetopt_strdup (optarg);
1138            }
1139 <          /* begin interanl index.  */
1139 >          /* begin internal index.  */
1140            else if (strcmp (long_options[option_index].name, "begin") == 0)
1141            {
1142              if (local_args_info.begin_given)
# Line 938 | Line 1178 | cmdline_parser_internal (int argc, char * const *argv,
1178                free (args_info->end_orig); /* free previous string */
1179              args_info->end_orig = gengetopt_strdup (optarg);
1180            }
1181 <          /* g(r).  */
1182 <          else if (strcmp (long_options[option_index].name, "gofr") == 0)
1181 >          /* nanoparticle radius.  */
1182 >          else if (strcmp (long_options[option_index].name, "radius") == 0)
1183            {
1184 <            if (local_args_info.gofr_given)
1184 >            if (local_args_info.radius_given)
1185                {
1186 <                fprintf (stderr, "%s: `--gofr' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1186 >                fprintf (stderr, "%s: `--radius' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1187                  goto failure;
1188                }
1189 <            if (args_info->gofr_given && ! override)
1189 >            if (args_info->radius_given && ! override)
1190                continue;
1191 <            local_args_info.gofr_given = 1;
1192 <            args_info->gofr_given = 1;
1191 >            local_args_info.radius_given = 1;
1192 >            args_info->radius_given = 1;
1193 >            args_info->radius_arg = strtod (optarg, &stop_char);
1194 >            if (!(stop_char && *stop_char == '\0')) {
1195 >              fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
1196 >              goto failure;
1197 >            }
1198 >            if (args_info->radius_orig)
1199 >              free (args_info->radius_orig); /* free previous string */
1200 >            args_info->radius_orig = gengetopt_strdup (optarg);
1201 >          }
1202 >          /* bond order parameter (--rcut must be specified).  */
1203 >          else if (strcmp (long_options[option_index].name, "bo") == 0)
1204 >          {
1205 >            if (local_args_info.bo_given)
1206 >              {
1207 >                fprintf (stderr, "%s: `--bo' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1208 >                goto failure;
1209 >              }
1210 >            if (args_info->bo_given && ! override)
1211 >              continue;
1212 >            local_args_info.bo_given = 1;
1213 >            args_info->bo_given = 1;
1214              if (args_info->staticProps_group_counter && override)
1215                reset_group_staticProps (args_info);
1216              args_info->staticProps_group_counter += 1;
1217              break;
1218            }
1219 +          /* bond order parameter as a function of radius (--rcut must be specified).  */
1220 +          else if (strcmp (long_options[option_index].name, "bor") == 0)
1221 +          {
1222 +            if (local_args_info.bor_given)
1223 +              {
1224 +                fprintf (stderr, "%s: `--bor' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1225 +                goto failure;
1226 +              }
1227 +            if (args_info->bor_given && ! override)
1228 +              continue;
1229 +            local_args_info.bor_given = 1;
1230 +            args_info->bor_given = 1;
1231 +            if (args_info->staticProps_group_counter && override)
1232 +              reset_group_staticProps (args_info);
1233 +            args_info->staticProps_group_counter += 1;
1234 +            break;
1235 +          }
1236 +          /* N(theta) bond angle density within (--rcut must be specified).  */
1237 +          else if (strcmp (long_options[option_index].name, "bad") == 0)
1238 +          {
1239 +            if (local_args_info.bad_given)
1240 +              {
1241 +                fprintf (stderr, "%s: `--bad' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1242 +                goto failure;
1243 +              }
1244 +            if (args_info->bad_given && ! override)
1245 +              continue;
1246 +            local_args_info.bad_given = 1;
1247 +            args_info->bad_given = 1;
1248 +            if (args_info->staticProps_group_counter && override)
1249 +              reset_group_staticProps (args_info);
1250 +            args_info->staticProps_group_counter += 1;
1251 +            break;
1252 +          }
1253 +          /* g(z).  */
1254 +          else if (strcmp (long_options[option_index].name, "gofz") == 0)
1255 +          {
1256 +            if (local_args_info.gofz_given)
1257 +              {
1258 +                fprintf (stderr, "%s: `--gofz' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1259 +                goto failure;
1260 +              }
1261 +            if (args_info->gofz_given && ! override)
1262 +              continue;
1263 +            local_args_info.gofz_given = 1;
1264 +            args_info->gofz_given = 1;
1265 +            if (args_info->staticProps_group_counter && override)
1266 +              reset_group_staticProps (args_info);
1267 +            args_info->staticProps_group_counter += 1;
1268 +            break;
1269 +          }
1270            /* g(r, cos(theta)).  */
1271            else if (strcmp (long_options[option_index].name, "r_theta") == 0)
1272            {
# Line 1023 | Line 1335 | cmdline_parser_internal (int argc, char * const *argv,
1335              args_info->staticProps_group_counter += 1;
1336              break;
1337            }
1338 <          /* p2 order parameter (--sele1 and --sele2 must be specified).  */
1339 <          else if (strcmp (long_options[option_index].name, "p2") == 0)
1338 >          /* rp2 order parameter (--sele1 and --sele2 must be specified).  */
1339 >          else if (strcmp (long_options[option_index].name, "rp2") == 0)
1340            {
1341 <            if (local_args_info.p2_given)
1341 >            if (local_args_info.rp2_given)
1342                {
1343 <                fprintf (stderr, "%s: `--p2' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1343 >                fprintf (stderr, "%s: `--rp2' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1344                  goto failure;
1345                }
1346 <            if (args_info->p2_given && ! override)
1346 >            if (args_info->rp2_given && ! override)
1347                continue;
1348 <            local_args_info.p2_given = 1;
1349 <            args_info->p2_given = 1;
1348 >            local_args_info.rp2_given = 1;
1349 >            args_info->rp2_given = 1;
1350              if (args_info->staticProps_group_counter && override)
1351                reset_group_staticProps (args_info);
1352              args_info->staticProps_group_counter += 1;
1353              break;
1354            }
1355 <          /* scd order parameter(either --sele1, --sele2, --sele3 are specified or --molname, --begin, --end are specified).  */
1356 <          else if (strcmp (long_options[option_index].name, "scd") == 0)
1355 >          /* slab density.  */
1356 >          else if (strcmp (long_options[option_index].name, "slab_density") == 0)
1357            {
1358 <            if (local_args_info.scd_given)
1358 >            if (local_args_info.slab_density_given)
1359                {
1360 <                fprintf (stderr, "%s: `--scd' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1360 >                fprintf (stderr, "%s: `--slab_density' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1361                  goto failure;
1362                }
1363 <            if (args_info->scd_given && ! override)
1363 >            if (args_info->slab_density_given && ! override)
1364                continue;
1365 <            local_args_info.scd_given = 1;
1366 <            args_info->scd_given = 1;
1365 >            local_args_info.slab_density_given = 1;
1366 >            args_info->slab_density_given = 1;
1367              if (args_info->staticProps_group_counter && override)
1368                reset_group_staticProps (args_info);
1369              args_info->staticProps_group_counter += 1;
1370              break;
1371            }
1372 <          /* density plot (--sele1 must be specified).  */
1373 <          else if (strcmp (long_options[option_index].name, "density") == 0)
1372 >          /* hxy.  */
1373 >          else if (strcmp (long_options[option_index].name, "hxy") == 0)
1374            {
1375 <            if (local_args_info.density_given)
1375 >            if (local_args_info.hxy_given)
1376                {
1377 <                fprintf (stderr, "%s: `--density' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1377 >                fprintf (stderr, "%s: `--hxy' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1378                  goto failure;
1379                }
1380 <            if (args_info->density_given && ! override)
1380 >            if (args_info->hxy_given && ! override)
1381                continue;
1382 <            local_args_info.density_given = 1;
1383 <            args_info->density_given = 1;
1382 >            local_args_info.hxy_given = 1;
1383 >            args_info->hxy_given = 1;
1384              if (args_info->staticProps_group_counter && override)
1385                reset_group_staticProps (args_info);
1386              args_info->staticProps_group_counter += 1;
1387              break;
1388            }
1389 <          /* slab density (--sele1 must be specified).  */
1390 <          else if (strcmp (long_options[option_index].name, "slab_density") == 0)
1389 >          /* rho of R.  */
1390 >          else if (strcmp (long_options[option_index].name, "rho_r") == 0)
1391            {
1392 <            if (local_args_info.slab_density_given)
1392 >            if (local_args_info.rho_r_given)
1393                {
1394 <                fprintf (stderr, "%s: `--slab_density' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1394 >                fprintf (stderr, "%s: `--rho_r' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1395                  goto failure;
1396                }
1397 <            if (args_info->slab_density_given && ! override)
1397 >            if (args_info->rho_r_given && ! override)
1398                continue;
1399 <            local_args_info.slab_density_given = 1;
1400 <            args_info->slab_density_given = 1;
1399 >            local_args_info.rho_r_given = 1;
1400 >            args_info->rho_r_given = 1;
1401              if (args_info->staticProps_group_counter && override)
1402                reset_group_staticProps (args_info);
1403              args_info->staticProps_group_counter += 1;
1404              break;
1405            }
1406 <          /* hxy (--sele1 must be specified).  */
1407 <          else if (strcmp (long_options[option_index].name, "hxy") == 0)
1406 >          /* hull volume of nanoparticle.  */
1407 >          else if (strcmp (long_options[option_index].name, "hullvol") == 0)
1408            {
1409 <            if (local_args_info.hxy_given)
1409 >            if (local_args_info.hullvol_given)
1410                {
1411 <                fprintf (stderr, "%s: `--hxy' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1411 >                fprintf (stderr, "%s: `--hullvol' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1412                  goto failure;
1413                }
1414 <            if (args_info->hxy_given && ! override)
1414 >            if (args_info->hullvol_given && ! override)
1415                continue;
1416 <            local_args_info.hxy_given = 1;
1417 <            args_info->hxy_given = 1;
1416 >            local_args_info.hullvol_given = 1;
1417 >            args_info->hullvol_given = 1;
1418              if (args_info->staticProps_group_counter && override)
1419                reset_group_staticProps (args_info);
1420              args_info->staticProps_group_counter += 1;
# Line 1138 | Line 1450 | cmdline_parser_internal (int argc, char * const *argv,
1450    if ( error )
1451      return (EXIT_FAILURE);
1452  
1453 +  if (optind < argc)
1454 +    {
1455 +      int i = 0 ;
1456 +      int found_prog_name = 0;
1457 +      /* whether program name, i.e., argv[0], is in the remaining args
1458 +         (this may happen with some implementations of getopt,
1459 +          but surely not with the one included by gengetopt) */
1460 +
1461 +      i = optind;
1462 +      while (i < argc)
1463 +        if (argv[i++] == argv[0]) {
1464 +          found_prog_name = 1;
1465 +          break;
1466 +        }
1467 +      i = 0;
1468 +
1469 +      args_info->inputs_num = argc - optind - found_prog_name;
1470 +      args_info->inputs =
1471 +        (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
1472 +      while (optind < argc)
1473 +        if (argv[optind++] != argv[0])
1474 +          args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ;
1475 +    }
1476 +
1477    return 0;
1478  
1479   failure:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines