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 1052 by gezelter, Tue Sep 26 01:30:32 2006 UTC vs.
Revision 1180 by chuckv, Mon Sep 17 20:05:51 2007 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 +  "      --r_theta                 g(r, cos(theta))",
57 +  "      --r_omega                 g(r, cos(omega))",
58 +  "      --theta_omega             g(cos(theta), cos(omega))",
59 +  "      --gxyz                    g(x, y, z)",
60 +  "  -p, --p2                      p2 order parameter (--sele1 and --sele2 must be \n                                  specified)",
61 +  "      --rp2                     rp2 order parameter (--sele1 and --sele2 must \n                                  be specified)",
62 +  "  -s, --scd                     scd order parameter (either --sele1, --sele2, \n                                  --sele3 are specified or --molname, --begin, \n                                  --end are specified)",
63 +  "  -d, --density                 density plot",
64 +  "      --slab_density            slab density",
65 +  "      --hxy                     hxy",
66 +  "      --rho_r                   rho of R",
67 +  "      --hullvol                 hull volume of nanoparticle",
68 +    0
69 + };
70 +
71   static
72   void clear_given (struct gengetopt_args_info *args_info);
73   static
# Line 57 | Line 104 | void clear_given (struct gengetopt_args_info *args_inf
104    args_info->molname_given = 0 ;
105    args_info->begin_given = 0 ;
106    args_info->end_given = 0 ;
107 +  args_info->radius_given = 0 ;
108    args_info->bo_given = 0 ;
109 +  args_info->bor_given = 0 ;
110 +  args_info->bad_given = 0 ;
111    args_info->gofr_given = 0 ;
112    args_info->r_theta_given = 0 ;
113    args_info->r_omega_given = 0 ;
# Line 69 | Line 119 | void clear_given (struct gengetopt_args_info *args_inf
119    args_info->density_given = 0 ;
120    args_info->slab_density_given = 0 ;
121    args_info->hxy_given = 0 ;
122 +  args_info->rho_r_given = 0 ;
123 +  args_info->hullvol_given = 0 ;
124    args_info->staticProps_group_counter = 0 ;
125   }
126  
# Line 105 | Line 157 | void clear_args (struct gengetopt_args_info *args_info
157    args_info->molname_orig = NULL;
158    args_info->begin_orig = NULL;
159    args_info->end_orig = NULL;
160 +  args_info->radius_orig = NULL;
161 +  
162 + }
163 +
164 + static
165 + void init_args_info(struct gengetopt_args_info *args_info)
166 + {
167 +  args_info->help_help = gengetopt_args_info_help[0] ;
168 +  args_info->version_help = gengetopt_args_info_help[1] ;
169 +  args_info->input_help = gengetopt_args_info_help[2] ;
170 +  args_info->output_help = gengetopt_args_info_help[3] ;
171 +  args_info->step_help = gengetopt_args_info_help[4] ;
172 +  args_info->nbins_help = gengetopt_args_info_help[5] ;
173 +  args_info->nbins_x_help = gengetopt_args_info_help[6] ;
174 +  args_info->nbins_y_help = gengetopt_args_info_help[7] ;
175 +  args_info->nanglebins_help = gengetopt_args_info_help[8] ;
176 +  args_info->length_help = gengetopt_args_info_help[9] ;
177 +  args_info->rcut_help = gengetopt_args_info_help[10] ;
178 +  args_info->zoffset_help = gengetopt_args_info_help[11] ;
179 +  args_info->sele1_help = gengetopt_args_info_help[12] ;
180 +  args_info->sele2_help = gengetopt_args_info_help[13] ;
181 +  args_info->sele3_help = gengetopt_args_info_help[14] ;
182 +  args_info->refsele_help = gengetopt_args_info_help[15] ;
183 +  args_info->molname_help = gengetopt_args_info_help[16] ;
184 +  args_info->begin_help = gengetopt_args_info_help[17] ;
185 +  args_info->end_help = gengetopt_args_info_help[18] ;
186 +  args_info->radius_help = gengetopt_args_info_help[19] ;
187 +  args_info->bo_help = gengetopt_args_info_help[20] ;
188 +  args_info->bor_help = gengetopt_args_info_help[21] ;
189 +  args_info->bad_help = gengetopt_args_info_help[22] ;
190 +  args_info->gofr_help = gengetopt_args_info_help[23] ;
191 +  args_info->r_theta_help = gengetopt_args_info_help[24] ;
192 +  args_info->r_omega_help = gengetopt_args_info_help[25] ;
193 +  args_info->theta_omega_help = gengetopt_args_info_help[26] ;
194 +  args_info->gxyz_help = gengetopt_args_info_help[27] ;
195 +  args_info->p2_help = gengetopt_args_info_help[28] ;
196 +  args_info->rp2_help = gengetopt_args_info_help[29] ;
197 +  args_info->scd_help = gengetopt_args_info_help[30] ;
198 +  args_info->density_help = gengetopt_args_info_help[31] ;
199 +  args_info->slab_density_help = gengetopt_args_info_help[32] ;
200 +  args_info->hxy_help = gengetopt_args_info_help[33] ;
201 +  args_info->rho_r_help = gengetopt_args_info_help[34] ;
202 +  args_info->hullvol_help = gengetopt_args_info_help[35] ;
203    
204   }
205  
# Line 117 | Line 212 | cmdline_parser_print_help (void)
212   void
213   cmdline_parser_print_help (void)
214   {
215 +  int i = 0;
216    cmdline_parser_print_version ();
217 <  printf("\nUsage: StaticProps [OPTIONS]...\n\n");
218 <  printf("%s\n","  -h, --help                    Print help and exit");
219 <  printf("%s\n","  -V, --version                 Print version and exit");
220 <  printf("%s\n","  -i, --input=filename          input dump file");
221 <  printf("%s\n","  -o, --output=filename         output file name");
222 <  printf("%s\n","  -n, --step=INT                process every n frame  (default=`1')");
223 <  printf("%s\n","  -b, --nbins=INT               number of bins (general purpose)  \n                                  (default=`100')");
224 <  printf("%s\n","  -x, --nbins_x=INT             number of bins in x axis  (default=`100')");
225 <  printf("%s\n","  -y, --nbins_y=INT             number of bins in y axis  (default=`100')");
226 <  printf("%s\n","  -a, --nanglebins=INT          number of bins for cos(angle)  (default=`50')");
227 <  printf("%s\n","      --length=DOUBLE           maximum length (Defaults to 1/2 smallest length \n                                  of first frame)");
132 <  printf("%s\n","  -c, --rcut=DOUBLE             cutoff radius (rcut)");
133 <  printf("%s\n","  -z, --zoffset=DOUBLE          Where to set the zero for the slab_density \n                                  calculation  (default=`0')");
134 <  printf("%s\n","      --sele1=selection script  select the first stuntdouble set");
135 <  printf("%s\n","      --sele2=selection script  select the second stuntdouble set");
136 <  printf("%s\n","      --sele3=selection script  select the third stuntdouble set");
137 <  printf("%s\n","      --refsele=selection script\n                                select reference (use and only use with --gxyz)");
138 <  printf("%s\n","      --molname=STRING          molecule name");
139 <  printf("%s\n","      --begin=INT               begin internal index");
140 <  printf("%s\n","      --end=INT                 end internal index");
141 <  printf("%s\n","\n Group: staticProps\n   an option of this group is required");
142 <  printf("%s\n","      --bo                      bond order parameter (--rcut must be specified");
143 <  printf("%s\n","  -g, --gofr                    g(r)");
144 <  printf("%s\n","      --r_theta                 g(r, cos(theta))");
145 <  printf("%s\n","      --r_omega                 g(r, cos(omega))");
146 <  printf("%s\n","      --theta_omega             g(cos(theta), cos(omega))");
147 <  printf("%s\n","      --gxyz                    g(x, y, z)");
148 <  printf("%s\n","  -p, --p2                      p2 order parameter (--sele1 and --sele2 must be \n                                  specified)");
149 <  printf("%s\n","      --rp2                     rp2 order parameter (--sele1 and --sele2 must \n                                  be specified)");
150 <  printf("%s\n","  -s, --scd                     scd order parameter (either --sele1, --sele2, \n                                  --sele3 are specified or --molname, --begin, \n                                  --end are specified)");
151 <  printf("%s\n","  -d, --density                 density plot");
152 <  printf("%s\n","      --slab_density            slab density");
153 <  printf("%s\n","      --hxy                     hxy");
154 <  
217 >
218 >  if (strlen(gengetopt_args_info_purpose) > 0)
219 >    printf("\n%s\n", gengetopt_args_info_purpose);
220 >
221 >  printf("\n%s\n\n", gengetopt_args_info_usage);
222 >
223 >  if (strlen(gengetopt_args_info_description) > 0)
224 >    printf("%s\n", gengetopt_args_info_description);
225 >
226 >  while (gengetopt_args_info_help[i])
227 >    printf("%s\n", gengetopt_args_info_help[i++]);
228   }
229  
230   void
# Line 159 | Line 232 | cmdline_parser_init (struct gengetopt_args_info *args_
232   {
233    clear_given (args_info);
234    clear_args (args_info);
235 +  init_args_info (args_info);
236 +
237 +  args_info->inputs = NULL;
238 +  args_info->inputs_num = 0;
239   }
240  
241   static void
242   cmdline_parser_release (struct gengetopt_args_info *args_info)
243   {
244    
245 +  unsigned int i;
246    if (args_info->input_arg)
247      {
248        free (args_info->input_arg); /* free previous argument */
# Line 284 | Line 362 | cmdline_parser_release (struct gengetopt_args_info *ar
362      {
363        free (args_info->end_orig); /* free previous argument */
364        args_info->end_orig = 0;
365 +    }
366 +  if (args_info->radius_orig)
367 +    {
368 +      free (args_info->radius_orig); /* free previous argument */
369 +      args_info->radius_orig = 0;
370      }
371    
372 +  for (i = 0; i < args_info->inputs_num; ++i)
373 +    free (args_info->inputs [i]);
374 +  
375 +  if (args_info->inputs_num)
376 +    free (args_info->inputs);
377 +  
378    clear_given (args_info);
379   }
380  
# Line 428 | Line 517 | cmdline_parser_file_save(const char *filename, struct
517        fprintf(outfile, "%s\n", "end");
518      }
519    }
520 +  if (args_info->radius_given) {
521 +    if (args_info->radius_orig) {
522 +      fprintf(outfile, "%s=\"%s\"\n", "radius", args_info->radius_orig);
523 +    } else {
524 +      fprintf(outfile, "%s\n", "radius");
525 +    }
526 +  }
527    if (args_info->bo_given) {
528      fprintf(outfile, "%s\n", "bo");
529 +  }
530 +  if (args_info->bor_given) {
531 +    fprintf(outfile, "%s\n", "bor");
532 +  }
533 +  if (args_info->bad_given) {
534 +    fprintf(outfile, "%s\n", "bad");
535    }
536    if (args_info->gofr_given) {
537      fprintf(outfile, "%s\n", "gofr");
# Line 464 | Line 566 | cmdline_parser_file_save(const char *filename, struct
566    if (args_info->hxy_given) {
567      fprintf(outfile, "%s\n", "hxy");
568    }
569 +  if (args_info->rho_r_given) {
570 +    fprintf(outfile, "%s\n", "rho_r");
571 +  }
572 +  if (args_info->hullvol_given) {
573 +    fprintf(outfile, "%s\n", "hullvol");
574 +  }
575    
576    fclose (outfile);
577  
# Line 504 | Line 612 | reset_group_staticProps(struct gengetopt_args_info *ar
612      return;
613    
614    args_info->bo_given = 0 ;
615 +  args_info->bor_given = 0 ;
616 +  args_info->bad_given = 0 ;
617    args_info->gofr_given = 0 ;
618    args_info->r_theta_given = 0 ;
619    args_info->r_omega_given = 0 ;
# Line 515 | Line 625 | reset_group_staticProps(struct gengetopt_args_info *ar
625    args_info->density_given = 0 ;
626    args_info->slab_density_given = 0 ;
627    args_info->hxy_given = 0 ;
628 +  args_info->rho_r_given = 0 ;
629 +  args_info->hullvol_given = 0 ;
630  
631    args_info->staticProps_group_counter = 0;
632   }
# Line 563 | Line 675 | cmdline_parser_required2 (struct gengetopt_args_info *
675   {
676    int error = 0;
677  
678 +  /* checks for required options */
679    if (! args_info->input_given)
680      {
681        fprintf (stderr, "%s: '--input' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : ""));
682        error = 1;
683      }
684 +  
685    if (args_info->staticProps_group_counter == 0)
686      {
687        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 575 | Line 689 | cmdline_parser_required2 (struct gengetopt_args_info *
689      }
690    
691  
692 +  /* checks for dependences among options */
693 +
694    return error;
695   }
696  
# Line 621 | Line 737 | cmdline_parser_internal (int argc, char * const *argv,
737          { "molname",    1, NULL, 0 },
738          { "begin",      1, NULL, 0 },
739          { "end",        1, NULL, 0 },
740 +        { "radius",     1, NULL, 0 },
741          { "bo", 0, NULL, 0 },
742 +        { "bor",        0, NULL, 0 },
743 +        { "bad",        0, NULL, 0 },
744          { "gofr",       0, NULL, 'g' },
745          { "r_theta",    0, NULL, 0 },
746          { "r_omega",    0, NULL, 0 },
# Line 633 | Line 752 | cmdline_parser_internal (int argc, char * const *argv,
752          { "density",    0, NULL, 'd' },
753          { "slab_density",       0, NULL, 0 },
754          { "hxy",        0, NULL, 0 },
755 +        { "rho_r",      0, NULL, 0 },
756 +        { "hullvol",    0, NULL, 0 },
757          { NULL, 0, NULL, 0 }
758        };
759  
# Line 1049 | Line 1170 | cmdline_parser_internal (int argc, char * const *argv,
1170                free (args_info->end_orig); /* free previous string */
1171              args_info->end_orig = gengetopt_strdup (optarg);
1172            }
1173 <          /* bond order parameter (--rcut must be specified.  */
1173 >          /* nanoparticle radius.  */
1174 >          else if (strcmp (long_options[option_index].name, "radius") == 0)
1175 >          {
1176 >            if (local_args_info.radius_given)
1177 >              {
1178 >                fprintf (stderr, "%s: `--radius' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1179 >                goto failure;
1180 >              }
1181 >            if (args_info->radius_given && ! override)
1182 >              continue;
1183 >            local_args_info.radius_given = 1;
1184 >            args_info->radius_given = 1;
1185 >            args_info->radius_arg = strtod (optarg, &stop_char);
1186 >            if (!(stop_char && *stop_char == '\0')) {
1187 >              fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
1188 >              goto failure;
1189 >            }
1190 >            if (args_info->radius_orig)
1191 >              free (args_info->radius_orig); /* free previous string */
1192 >            args_info->radius_orig = gengetopt_strdup (optarg);
1193 >          }
1194 >          /* bond order parameter (--rcut must be specified).  */
1195            else if (strcmp (long_options[option_index].name, "bo") == 0)
1196            {
1197              if (local_args_info.bo_given)
# Line 1066 | Line 1208 | cmdline_parser_internal (int argc, char * const *argv,
1208              args_info->staticProps_group_counter += 1;
1209              break;
1210            }
1211 +          /* bond order parameter as a function of radius (--rcut must be specified).  */
1212 +          else if (strcmp (long_options[option_index].name, "bor") == 0)
1213 +          {
1214 +            if (local_args_info.bor_given)
1215 +              {
1216 +                fprintf (stderr, "%s: `--bor' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1217 +                goto failure;
1218 +              }
1219 +            if (args_info->bor_given && ! override)
1220 +              continue;
1221 +            local_args_info.bor_given = 1;
1222 +            args_info->bor_given = 1;
1223 +            if (args_info->staticProps_group_counter && override)
1224 +              reset_group_staticProps (args_info);
1225 +            args_info->staticProps_group_counter += 1;
1226 +            break;
1227 +          }
1228 +          /* N(theta) bond angle density within (--rcut must be specified).  */
1229 +          else if (strcmp (long_options[option_index].name, "bad") == 0)
1230 +          {
1231 +            if (local_args_info.bad_given)
1232 +              {
1233 +                fprintf (stderr, "%s: `--bad' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1234 +                goto failure;
1235 +              }
1236 +            if (args_info->bad_given && ! override)
1237 +              continue;
1238 +            local_args_info.bad_given = 1;
1239 +            args_info->bad_given = 1;
1240 +            if (args_info->staticProps_group_counter && override)
1241 +              reset_group_staticProps (args_info);
1242 +            args_info->staticProps_group_counter += 1;
1243 +            break;
1244 +          }
1245            /* g(r, cos(theta)).  */
1246            else if (strcmp (long_options[option_index].name, "r_theta") == 0)
1247            {
# Line 1185 | Line 1361 | cmdline_parser_internal (int argc, char * const *argv,
1361              args_info->staticProps_group_counter += 1;
1362              break;
1363            }
1364 +          /* rho of R.  */
1365 +          else if (strcmp (long_options[option_index].name, "rho_r") == 0)
1366 +          {
1367 +            if (local_args_info.rho_r_given)
1368 +              {
1369 +                fprintf (stderr, "%s: `--rho_r' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1370 +                goto failure;
1371 +              }
1372 +            if (args_info->rho_r_given && ! override)
1373 +              continue;
1374 +            local_args_info.rho_r_given = 1;
1375 +            args_info->rho_r_given = 1;
1376 +            if (args_info->staticProps_group_counter && override)
1377 +              reset_group_staticProps (args_info);
1378 +            args_info->staticProps_group_counter += 1;
1379 +            break;
1380 +          }
1381 +          /* hull volume of nanoparticle.  */
1382 +          else if (strcmp (long_options[option_index].name, "hullvol") == 0)
1383 +          {
1384 +            if (local_args_info.hullvol_given)
1385 +              {
1386 +                fprintf (stderr, "%s: `--hullvol' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1387 +                goto failure;
1388 +              }
1389 +            if (args_info->hullvol_given && ! override)
1390 +              continue;
1391 +            local_args_info.hullvol_given = 1;
1392 +            args_info->hullvol_given = 1;
1393 +            if (args_info->staticProps_group_counter && override)
1394 +              reset_group_staticProps (args_info);
1395 +            args_info->staticProps_group_counter += 1;
1396 +            break;
1397 +          }
1398            
1399            break;
1400          case '?':       /* Invalid option.  */
# Line 1215 | Line 1425 | cmdline_parser_internal (int argc, char * const *argv,
1425    if ( error )
1426      return (EXIT_FAILURE);
1427  
1428 +  if (optind < argc)
1429 +    {
1430 +      int i = 0 ;
1431 +      int found_prog_name = 0;
1432 +      /* whether program name, i.e., argv[0], is in the remaining args
1433 +         (this may happen with some implementations of getopt,
1434 +          but surely not with the one included by gengetopt) */
1435 +
1436 +      i = optind;
1437 +      while (i < argc)
1438 +        if (argv[i++] == argv[0]) {
1439 +          found_prog_name = 1;
1440 +          break;
1441 +        }
1442 +      i = 0;
1443 +
1444 +      args_info->inputs_num = argc - optind - found_prog_name;
1445 +      args_info->inputs =
1446 +        (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
1447 +      while (optind < argc)
1448 +        if (argv[optind++] != argv[0])
1449 +          args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ;
1450 +    }
1451 +
1452    return 0;
1453  
1454   failure:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines