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 2701 by gezelter, Tue Apr 11 15:33:27 2006 UTC vs.
Revision 2783 by xsun, Thu Jun 1 18:06:33 2006 UTC

# Line 44 | Line 44 | void clear_given (struct gengetopt_args_info *args_inf
44    args_info->output_given = 0 ;
45    args_info->step_given = 0 ;
46    args_info->nrbins_given = 0 ;
47 +  args_info->nbins_x_given = 0 ;
48 +  args_info->nbins_y_given = 0 ;
49    args_info->nanglebins_given = 0 ;
50    args_info->length_given = 0 ;
51    args_info->zoffset_given = 0 ;
# Line 60 | Line 62 | void clear_given (struct gengetopt_args_info *args_inf
62    args_info->theta_omega_given = 0 ;
63    args_info->gxyz_given = 0 ;
64    args_info->p2_given = 0 ;
65 +  args_info->rp2_given = 0 ;
66    args_info->scd_given = 0 ;
67    args_info->density_given = 0 ;
68    args_info->slab_density_given = 0 ;
69 +  args_info->hxy_given = 0 ;
70    args_info->staticProps_group_counter = 0 ;
71   }
72  
# Line 77 | Line 81 | void clear_args (struct gengetopt_args_info *args_info
81    args_info->step_orig = NULL;
82    args_info->nrbins_arg = 100;
83    args_info->nrbins_orig = NULL;
84 +  args_info->nbins_x_arg = 100;
85 +  args_info->nbins_x_orig = NULL;
86 +  args_info->nbins_y_arg = 100;
87 +  args_info->nbins_y_orig = NULL;
88    args_info->nanglebins_arg = 50;
89    args_info->nanglebins_orig = NULL;
90    args_info->length_orig = NULL;
# Line 114 | Line 122 | cmdline_parser_print_help (void)
122    printf("%s\n","  -o, --output=filename         output file name");
123    printf("%s\n","  -n, --step=INT                process every n frame  (default=`1')");
124    printf("%s\n","  -r, --nrbins=INT              number of bins for distance  (default=`100')");
125 +  printf("%s\n","  -x, --nbins_x=INT             number of bins in x axis  (default=`100')");
126 +  printf("%s\n","  -y, --nbins_y=INT             number of bins in y axis  (default=`100')");
127    printf("%s\n","  -a, --nanglebins=INT          number of bins for cos(angle)  (default=`50')");
128    printf("%s\n","  -l, --length=DOUBLE           maximum length (Defaults to 1/2 smallest length \n                                  of first frame)");
129    printf("%s\n","  -z, --zoffset=DOUBLE          Where to set the zero for the slab_density \n                                  calculation  (default=`0')");
# Line 131 | Line 141 | cmdline_parser_print_help (void)
141    printf("%s\n","      --theta_omega             g(cos(theta), cos(omega))");
142    printf("%s\n","      --gxyz                    g(x, y, z)");
143    printf("%s\n","      --p2                      p2 order parameter (--sele1 and --sele2 must be \n                                  specified)");
144 +  printf("%s\n","      --rp2                     rp2 order parameter (--sele1 and --sele2 must \n                                  be specified)");
145    printf("%s\n","      --scd                     scd order parameter(either --sele1, --sele2, \n                                  --sele3 are specified or --molname, --begin, \n                                  --end are specified)");
146    printf("%s\n","      --density                 density plot (--sele1 must be specified)");
147    printf("%s\n","      --slab_density            slab density (--sele1 must be specified)");
148 +  printf("%s\n","      --hxy                     hxy (--sele1 must be specified)");
149    
150   }
151  
# Line 178 | Line 190 | cmdline_parser_release (struct gengetopt_args_info *ar
190        free (args_info->nrbins_orig); /* free previous argument */
191        args_info->nrbins_orig = 0;
192      }
193 +  if (args_info->nbins_x_orig)
194 +    {
195 +      free (args_info->nbins_x_orig); /* free previous argument */
196 +      args_info->nbins_x_orig = 0;
197 +    }
198 +  if (args_info->nbins_y_orig)
199 +    {
200 +      free (args_info->nbins_y_orig); /* free previous argument */
201 +      args_info->nbins_y_orig = 0;
202 +    }
203    if (args_info->nanglebins_orig)
204      {
205        free (args_info->nanglebins_orig); /* free previous argument */
# Line 303 | Line 325 | cmdline_parser_file_save(const char *filename, struct
325        fprintf(outfile, "%s=\"%s\"\n", "nrbins", args_info->nrbins_orig);
326      } else {
327        fprintf(outfile, "%s\n", "nrbins");
328 +    }
329 +  }
330 +  if (args_info->nbins_x_given) {
331 +    if (args_info->nbins_x_orig) {
332 +      fprintf(outfile, "%s=\"%s\"\n", "nbins_x", args_info->nbins_x_orig);
333 +    } else {
334 +      fprintf(outfile, "%s\n", "nbins_x");
335 +    }
336 +  }
337 +  if (args_info->nbins_y_given) {
338 +    if (args_info->nbins_y_orig) {
339 +      fprintf(outfile, "%s=\"%s\"\n", "nbins_y", args_info->nbins_y_orig);
340 +    } else {
341 +      fprintf(outfile, "%s\n", "nbins_y");
342      }
343    }
344    if (args_info->nanglebins_given) {
# Line 393 | Line 429 | cmdline_parser_file_save(const char *filename, struct
429    if (args_info->p2_given) {
430      fprintf(outfile, "%s\n", "p2");
431    }
432 +  if (args_info->rp2_given) {
433 +    fprintf(outfile, "%s\n", "rp2");
434 +  }
435    if (args_info->scd_given) {
436      fprintf(outfile, "%s\n", "scd");
437    }
# Line 402 | Line 441 | cmdline_parser_file_save(const char *filename, struct
441    if (args_info->slab_density_given) {
442      fprintf(outfile, "%s\n", "slab_density");
443    }
444 +  if (args_info->hxy_given) {
445 +    fprintf(outfile, "%s\n", "hxy");
446 +  }
447    
448    fclose (outfile);
449  
# Line 447 | Line 489 | reset_group_staticProps(struct gengetopt_args_info *ar
489    args_info->theta_omega_given = 0 ;
490    args_info->gxyz_given = 0 ;
491    args_info->p2_given = 0 ;
492 +  args_info->rp2_given = 0 ;
493    args_info->scd_given = 0 ;
494    args_info->density_given = 0 ;
495    args_info->slab_density_given = 0 ;
496 +  args_info->hxy_given = 0 ;
497  
498    args_info->staticProps_group_counter = 0;
499   }
# Line 543 | Line 587 | cmdline_parser_internal (int argc, char * const *argv,
587          { "output",     1, NULL, 'o' },
588          { "step",       1, NULL, 'n' },
589          { "nrbins",     1, NULL, 'r' },
590 +        { "nbins_x",    1, NULL, 'x' },
591 +        { "nbins_y",    1, NULL, 'y' },
592          { "nanglebins", 1, NULL, 'a' },
593          { "length",     1, NULL, 'l' },
594          { "zoffset",    1, NULL, 'z' },
# Line 559 | Line 605 | cmdline_parser_internal (int argc, char * const *argv,
605          { "theta_omega",        0, NULL, 0 },
606          { "gxyz",       0, NULL, 0 },
607          { "p2", 0, NULL, 0 },
608 +        { "rp2",        0, NULL, 0 },
609          { "scd",        0, NULL, 0 },
610          { "density",    0, NULL, 0 },
611          { "slab_density",       0, NULL, 0 },
612 +        { "hxy",        0, NULL, 0 },
613          { NULL, 0, NULL, 0 }
614        };
615  
616        stop_char = 0;
617 <      c = getopt_long (argc, argv, "hVi:o:n:r:a:l:z:", long_options, &option_index);
617 >      c = getopt_long (argc, argv, "hVi:o:n:r:x:y:a:l:z:", long_options, &option_index);
618  
619        if (c == -1) break;       /* Exit from `while (1)' loop.  */
620  
# Line 656 | Line 704 | cmdline_parser_internal (int argc, char * const *argv,
704            if (args_info->nrbins_orig)
705              free (args_info->nrbins_orig); /* free previous string */
706            args_info->nrbins_orig = gengetopt_strdup (optarg);
707 +          break;
708 +
709 +        case 'x':       /* number of bins in x axis.  */
710 +          if (local_args_info.nbins_x_given)
711 +            {
712 +              fprintf (stderr, "%s: `--nbins_x' (`-x') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
713 +              goto failure;
714 +            }
715 +          if (args_info->nbins_x_given && ! override)
716 +            continue;
717 +          local_args_info.nbins_x_given = 1;
718 +          args_info->nbins_x_given = 1;
719 +          args_info->nbins_x_arg = strtol (optarg, &stop_char, 0);
720 +          if (!(stop_char && *stop_char == '\0')) {
721 +            fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
722 +            goto failure;
723 +          }
724 +          if (args_info->nbins_x_orig)
725 +            free (args_info->nbins_x_orig); /* free previous string */
726 +          args_info->nbins_x_orig = gengetopt_strdup (optarg);
727 +          break;
728 +
729 +        case 'y':       /* number of bins in y axis.  */
730 +          if (local_args_info.nbins_y_given)
731 +            {
732 +              fprintf (stderr, "%s: `--nbins_y' (`-y') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
733 +              goto failure;
734 +            }
735 +          if (args_info->nbins_y_given && ! override)
736 +            continue;
737 +          local_args_info.nbins_y_given = 1;
738 +          args_info->nbins_y_given = 1;
739 +          args_info->nbins_y_arg = strtol (optarg, &stop_char, 0);
740 +          if (!(stop_char && *stop_char == '\0')) {
741 +            fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
742 +            goto failure;
743 +          }
744 +          if (args_info->nbins_y_orig)
745 +            free (args_info->nbins_y_orig); /* free previous string */
746 +          args_info->nbins_y_orig = gengetopt_strdup (optarg);
747            break;
748  
749          case 'a':       /* number of bins for cos(angle).  */
# Line 959 | Line 1047 | cmdline_parser_internal (int argc, char * const *argv,
1047              args_info->staticProps_group_counter += 1;
1048              break;
1049            }
1050 +          /* rp2 order parameter (--sele1 and --sele2 must be specified).  */
1051 +          else if (strcmp (long_options[option_index].name, "rp2") == 0)
1052 +          {
1053 +            if (local_args_info.rp2_given)
1054 +              {
1055 +                fprintf (stderr, "%s: `--rp2' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1056 +                goto failure;
1057 +              }
1058 +            if (args_info->rp2_given && ! override)
1059 +              continue;
1060 +            local_args_info.rp2_given = 1;
1061 +            args_info->rp2_given = 1;
1062 +            if (args_info->staticProps_group_counter && override)
1063 +              reset_group_staticProps (args_info);
1064 +            args_info->staticProps_group_counter += 1;
1065 +            break;
1066 +          }
1067            /* scd order parameter(either --sele1, --sele2, --sele3 are specified or --molname, --begin, --end are specified).  */
1068            else if (strcmp (long_options[option_index].name, "scd") == 0)
1069            {
# Line 1010 | Line 1115 | cmdline_parser_internal (int argc, char * const *argv,
1115              args_info->staticProps_group_counter += 1;
1116              break;
1117            }
1118 +          /* hxy (--sele1 must be specified).  */
1119 +          else if (strcmp (long_options[option_index].name, "hxy") == 0)
1120 +          {
1121 +            if (local_args_info.hxy_given)
1122 +              {
1123 +                fprintf (stderr, "%s: `--hxy' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1124 +                goto failure;
1125 +              }
1126 +            if (args_info->hxy_given && ! override)
1127 +              continue;
1128 +            local_args_info.hxy_given = 1;
1129 +            args_info->hxy_given = 1;
1130 +            if (args_info->staticProps_group_counter && override)
1131 +              reset_group_staticProps (args_info);
1132 +            args_info->staticProps_group_counter += 1;
1133 +            break;
1134 +          }
1135            
1136            break;
1137          case '?':       /* Invalid option.  */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines