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 1039 by gezelter, Tue Sep 19 21:14:11 2006 UTC vs.
Revision 1213 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
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 ;
51  args_info->LegendreL_given = 0 ;
99    args_info->rcut_given = 0 ;
100    args_info->zoffset_given = 0 ;
101    args_info->sele1_given = 0 ;
# Line 58 | 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 ;
# Line 70 | Line 121 | void clear_given (struct gengetopt_args_info *args_inf
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 82 | 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 91 | 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;
94  args_info->LegendreL_orig = NULL;
147    args_info->rcut_orig = NULL;
148    args_info->zoffset_arg = 0;
149    args_info->zoffset_orig = NULL;
# Line 107 | 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 119 | 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","      --length=DOUBLE           maximum length (Defaults to 1/2 smallest length \n                                  of first frame)");
134 <  printf("%s\n","  -l, --LegendreL=INT           Order of Legendre Polynomial (used for Bond \n                                  Order calculations)");
135 <  printf("%s\n","  -c, --rcut=DOUBLE             cutoff radius (rcut)");
136 <  printf("%s\n","  -z, --zoffset=DOUBLE          Where to set the zero for the slab_density \n                                  calculation  (default=`0')");
137 <  printf("%s\n","      --sele1=selection script  select the first stuntdouble set");
138 <  printf("%s\n","      --sele2=selection script  select the second stuntdouble set");
139 <  printf("%s\n","      --sele3=selection script  select the third stuntdouble set");
140 <  printf("%s\n","      --refsele=selection script\n                                select reference (use and only use with --gxyz)");
141 <  printf("%s\n","      --molname=STRING          molecule name");
142 <  printf("%s\n","      --begin=INT               begin internal index");
143 <  printf("%s\n","      --end=INT                 end internal index");
144 <  printf("%s\n","\n Group: staticProps\n   an option of this group is required");
145 <  printf("%s\n","  -b, --bo                      bond order parameter (--rcut and --LegendreL \n                                  must be specified");
146 <  printf("%s\n","  -g, --gofr                    g(r)");
147 <  printf("%s\n","      --r_theta                 g(r, cos(theta))");
148 <  printf("%s\n","      --r_omega                 g(r, cos(omega))");
149 <  printf("%s\n","      --theta_omega             g(cos(theta), cos(omega))");
150 <  printf("%s\n","      --gxyz                    g(x, y, z)");
151 <  printf("%s\n","  -p, --p2                      p2 order parameter (--sele1 and --sele2 must be \n                                  specified)");
152 <  printf("%s\n","      --rp2                     rp2 order parameter (--sele1 and --sele2 must \n                                  be specified)");
153 <  printf("%s\n","  -s, --scd                     scd order parameter (either --sele1, --sele2, \n                                  --sele3 are specified or --molname, --begin, \n                                  --end are specified)");
154 <  printf("%s\n","  -d, --density                 density plot");
155 <  printf("%s\n","      --slab_density            slab density");
156 <  printf("%s\n","      --hxy                     hxy");
157 <  
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 162 | 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 193 | 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 217 | Line 295 | cmdline_parser_release (struct gengetopt_args_info *ar
295      {
296        free (args_info->length_orig); /* free previous argument */
297        args_info->length_orig = 0;
220    }
221  if (args_info->LegendreL_orig)
222    {
223      free (args_info->LegendreL_orig); /* free previous argument */
224      args_info->LegendreL_orig = 0;
298      }
299    if (args_info->rcut_orig)
300      {
# Line 293 | 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 338 | 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 373 | Line 457 | cmdline_parser_file_save(const char *filename, struct
457        fprintf(outfile, "%s\n", "length");
458      }
459    }
376  if (args_info->LegendreL_given) {
377    if (args_info->LegendreL_orig) {
378      fprintf(outfile, "%s=\"%s\"\n", "LegendreL", args_info->LegendreL_orig);
379    } else {
380      fprintf(outfile, "%s\n", "LegendreL");
381    }
382  }
460    if (args_info->rcut_given) {
461      if (args_info->rcut_orig) {
462        fprintf(outfile, "%s=\"%s\"\n", "rcut", args_info->rcut_orig);
# Line 443 | 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 479 | 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 519 | Line 618 | reset_group_staticProps(struct gengetopt_args_info *ar
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 ;
# Line 530 | Line 632 | reset_group_staticProps(struct gengetopt_args_info *ar
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 578 | 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 590 | 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 622 | 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, 0 },
630        { "LegendreL",  1, NULL, 'l' },
738          { "rcut",       1, NULL, 'c' },
739          { "zoffset",    1, NULL, 'z' },
740          { "sele1",      1, NULL, 0 },
# Line 637 | 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 <        { "bo", 0, NULL, 'b' },
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 },
# Line 649 | Line 760 | cmdline_parser_internal (int argc, char * const *argv,
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:c:z:bgpsd", 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 725 | 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 805 | Line 918 | cmdline_parser_internal (int argc, char * const *argv,
918            args_info->nanglebins_orig = gengetopt_strdup (optarg);
919            break;
920  
808        case 'l':       /* Order of Legendre Polynomial (used for Bond Order calculations).  */
809          if (local_args_info.LegendreL_given)
810            {
811              fprintf (stderr, "%s: `--LegendreL' (`-l') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
812              goto failure;
813            }
814          if (args_info->LegendreL_given && ! override)
815            continue;
816          local_args_info.LegendreL_given = 1;
817          args_info->LegendreL_given = 1;
818          args_info->LegendreL_arg = strtol (optarg, &stop_char, 0);
819          if (!(stop_char && *stop_char == '\0')) {
820            fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
821            goto failure;
822          }
823          if (args_info->LegendreL_orig)
824            free (args_info->LegendreL_orig); /* free previous string */
825          args_info->LegendreL_orig = gengetopt_strdup (optarg);
826          break;
827
921          case 'c':       /* cutoff radius (rcut).  */
922            if (local_args_info.rcut_given)
923              {
# Line 865 | Line 958 | cmdline_parser_internal (int argc, char * const *argv,
958            args_info->zoffset_orig = gengetopt_strdup (optarg);
959            break;
960  
868        case 'b':       /* bond order parameter (--rcut and --LegendreL must be specified.  */
869          if (local_args_info.bo_given)
870            {
871              fprintf (stderr, "%s: `--bo' (`-b') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
872              goto failure;
873            }
874          if (args_info->bo_given && ! override)
875            continue;
876          local_args_info.bo_given = 1;
877          args_info->bo_given = 1;
878          if (args_info->staticProps_group_counter && override)
879            reset_group_staticProps (args_info);
880          args_info->staticProps_group_counter += 1;
881          break;
882
961          case 'g':       /* g(r).  */
962            if (local_args_info.gofr_given)
963              {
# Line 1099 | Line 1177 | cmdline_parser_internal (int argc, char * const *argv,
1177              if (args_info->end_orig)
1178                free (args_info->end_orig); /* free previous string */
1179              args_info->end_orig = gengetopt_strdup (optarg);
1180 +          }
1181 +          /* nanoparticle radius.  */
1182 +          else if (strcmp (long_options[option_index].name, "radius") == 0)
1183 +          {
1184 +            if (local_args_info.radius_given)
1185 +              {
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->radius_given && ! override)
1190 +              continue;
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 1219 | Line 1386 | cmdline_parser_internal (int argc, char * const *argv,
1386              args_info->staticProps_group_counter += 1;
1387              break;
1388            }
1389 +          /* rho of R.  */
1390 +          else if (strcmp (long_options[option_index].name, "rho_r") == 0)
1391 +          {
1392 +            if (local_args_info.rho_r_given)
1393 +              {
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->rho_r_given && ! override)
1398 +              continue;
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 +          /* hull volume of nanoparticle.  */
1407 +          else if (strcmp (long_options[option_index].name, "hullvol") == 0)
1408 +          {
1409 +            if (local_args_info.hullvol_given)
1410 +              {
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->hullvol_given && ! override)
1415 +              continue;
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;
1421 +            break;
1422 +          }
1423            
1424            break;
1425          case '?':       /* Invalid option.  */
# Line 1249 | 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