--- trunk/src/applications/dump2Xyz/Dump2XYZCmd.c 2004/09/28 23:24:25 12 +++ trunk/src/applications/dump2Xyz/Dump2XYZCmd.c 2006/05/10 01:44:48 954 @@ -1,7 +1,7 @@ /* File autogenerated by gengetopt version 2.11 generated with the following command: - /home/maul/gezelter/tim/program/gengetopt-2.11/src/gengetopt --file-name=Dump2XYZCmd + /home/maul/gezelter/tim/program/gengetopt-2.11/src/gengetopt -F Dump2XYZCmd The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: @@ -18,10 +18,9 @@ #include "config.h" #endif - #include "getopt.h" -#include "applications/dump2Xyz/Dump2XYZCmd.h" +#include "Dump2XYZCmd.h" void cmdline_parser_print_version (void) @@ -36,21 +35,24 @@ cmdline_parser_print_help (void) printf("\n" "Usage: %s [OPTIONS]...\n", CMDLINE_PARSER_PACKAGE); printf("\n"); - printf(" -h, --help Print help and exit\n"); - printf(" -V, --version Print version and exit\n"); - printf(" -i, --input=filename input dump file\n"); - printf(" -o, --output=filename output file name\n"); - printf(" -n, --frame=INT print every n frame (default=`1')\n"); - printf(" -d, --dipole print the dipole moments (default=off)\n"); - printf(" -w, --water skip the the waters (default=off)\n"); - printf(" -m, --periodicBox map to the periodic box (default=off)\n"); - printf(" -z, --zconstraint replace the atom types of zconstraint molecules \n (default=off)\n"); - printf(" -r, --rigidbody add a pseudo COM atom to rigidbody (default=off)\n"); - printf(" -t, --watertype replace the atom type of water model (default=on)\n"); - printf(" -s, --ignore=atomtype ignore the atom types\n"); - printf(" --repeatX=INT The number of images to repeat in the x direction \n (default=`0')\n"); - printf(" --repeatY=INT The number of images to repeat in the y direction \n (default=`0')\n"); - printf(" --repeatZ=INT The number of images to repeat in the z direction \n (default=`0')\n"); + printf(" -h, --help Print help and exit\n"); + printf(" -V, --version Print version and exit\n"); + printf(" -i, --input=filename input dump file\n"); + printf(" -o, --output=filename output file name\n"); + printf(" -n, --frame=INT print every n frame (default=`1')\n"); + printf(" -w, --water skip the the waters (default=off)\n"); + printf(" -m, --periodicBox map to the periodic box (default=off)\n"); + printf(" -z, --zconstraint replace the atom types of zconstraint \n molecules (default=off)\n"); + printf(" -r, --rigidbody add a pseudo COM atom to rigidbody \n (default=off)\n"); + printf(" -t, --watertype replace the atom type of water model \n (default=on)\n"); + printf(" -s, --selection=selection script general selection syntax\n"); + printf(" --originsele=selection script select origin\n"); + printf(" --refsele=selection script select reference\n"); + printf(" --repeatX=INT The number of images to repeat in the x \n direction (default=`0')\n"); + printf(" --repeatY=INT The number of images to repeat in the y \n direction (default=`0')\n"); + printf(" --repeatZ=INT The number of images to repeat in the z \n direction (default=`0')\n"); + printf(" --gb=atomtype Replace the Gay-Berne atom with four \n linear atoms\n"); + printf(" -b, --basetype Convert to base atom type (default=off)\n"); } @@ -72,14 +74,6 @@ cmdline_parser (int argc, char * const *argv, struct g cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) { int c; /* Character of the parsed option. */ - int i; /* Counter */ - struct ignore_list - { - char * ignore_arg; - struct ignore_list * next; - }; - struct ignore_list * ignore_list = NULL,* ignore_new = NULL; - int missing_required_options = 0; args_info->help_given = 0 ; @@ -87,30 +81,36 @@ cmdline_parser (int argc, char * const *argv, struct g args_info->input_given = 0 ; args_info->output_given = 0 ; args_info->frame_given = 0 ; - args_info->dipole_given = 0 ; args_info->water_given = 0 ; args_info->periodicBox_given = 0 ; args_info->zconstraint_given = 0 ; args_info->rigidbody_given = 0 ; args_info->watertype_given = 0 ; - args_info->ignore_given = 0 ; + args_info->selection_given = 0 ; + args_info->originsele_given = 0 ; + args_info->refsele_given = 0 ; args_info->repeatX_given = 0 ; args_info->repeatY_given = 0 ; args_info->repeatZ_given = 0 ; + args_info->gb_given = 0 ; + args_info->basetype_given = 0 ; #define clear_args() { \ args_info->input_arg = NULL; \ args_info->output_arg = NULL; \ args_info->frame_arg = 1 ;\ - args_info->dipole_flag = 0;\ args_info->water_flag = 0;\ args_info->periodicBox_flag = 0;\ args_info->zconstraint_flag = 0;\ args_info->rigidbody_flag = 0;\ args_info->watertype_flag = 1;\ - args_info->ignore_arg = NULL; \ + args_info->selection_arg = NULL; \ + args_info->originsele_arg = NULL; \ + args_info->refsele_arg = NULL; \ args_info->repeatX_arg = 0 ;\ args_info->repeatY_arg = 0 ;\ args_info->repeatZ_arg = 0 ;\ + args_info->gb_arg = NULL; \ + args_info->basetype_flag = 0;\ } clear_args(); @@ -131,21 +131,24 @@ cmdline_parser (int argc, char * const *argv, struct g { "input", 1, NULL, 'i' }, { "output", 1, NULL, 'o' }, { "frame", 1, NULL, 'n' }, - { "dipole", 0, NULL, 'd' }, { "water", 0, NULL, 'w' }, { "periodicBox", 0, NULL, 'm' }, { "zconstraint", 0, NULL, 'z' }, { "rigidbody", 0, NULL, 'r' }, { "watertype", 0, NULL, 't' }, - { "ignore", 1, NULL, 's' }, + { "selection", 1, NULL, 's' }, + { "originsele", 1, NULL, 0 }, + { "refsele", 1, NULL, 0 }, { "repeatX", 1, NULL, 0 }, { "repeatY", 1, NULL, 0 }, { "repeatZ", 1, NULL, 0 }, + { "gb", 1, NULL, 0 }, + { "basetype", 0, NULL, 'b' }, { NULL, 0, NULL, 0 } }; stop_char = 0; - c = getopt_long (argc, argv, "hVi:o:n:dwmzrts:", long_options, &option_index); + c = getopt_long (argc, argv, "hVi:o:n:wmzrts:b", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ @@ -192,17 +195,6 @@ cmdline_parser (int argc, char * const *argv, struct g } args_info->frame_given = 1; args_info->frame_arg = strtol (optarg,&stop_char,0); - break; - - case 'd': /* print the dipole moments. */ - if (args_info->dipole_given) - { - fprintf (stderr, "%s: `--dipole' (`-d') option given more than once\n", CMDLINE_PARSER_PACKAGE); - clear_args (); - exit (EXIT_FAILURE); - } - args_info->dipole_given = 1; - args_info->dipole_flag = !(args_info->dipole_flag); break; case 'w': /* skip the the waters. */ @@ -260,18 +252,60 @@ cmdline_parser (int argc, char * const *argv, struct g args_info->watertype_flag = !(args_info->watertype_flag); break; - case 's': /* ignore the atom types. */ - args_info->ignore_given++; - ignore_new = (struct ignore_list *) malloc (sizeof (struct ignore_list)); - ignore_new->next = ignore_list; - ignore_list = ignore_new; - ignore_new->ignore_arg = gengetopt_strdup (optarg); + case 's': /* general selection syntax. */ + if (args_info->selection_given) + { + fprintf (stderr, "%s: `--selection' (`-s') option given more than once\n", CMDLINE_PARSER_PACKAGE); + clear_args (); + exit (EXIT_FAILURE); + } + args_info->selection_given = 1; + args_info->selection_arg = gengetopt_strdup (optarg); break; + case 'b': /* Convert to base atom type. */ + if (args_info->basetype_given) + { + fprintf (stderr, "%s: `--basetype' (`-b') option given more than once\n", CMDLINE_PARSER_PACKAGE); + clear_args (); + exit (EXIT_FAILURE); + } + args_info->basetype_given = 1; + args_info->basetype_flag = !(args_info->basetype_flag); + break; + case 0: /* Long option with no short option */ + /* select origin. */ + if (strcmp (long_options[option_index].name, "originsele") == 0) + { + if (args_info->originsele_given) + { + fprintf (stderr, "%s: `--originsele' option given more than once\n", CMDLINE_PARSER_PACKAGE); + clear_args (); + exit (EXIT_FAILURE); + } + args_info->originsele_given = 1; + args_info->originsele_arg = gengetopt_strdup (optarg); + break; + } + + /* select reference. */ + else if (strcmp (long_options[option_index].name, "refsele") == 0) + { + if (args_info->refsele_given) + { + fprintf (stderr, "%s: `--refsele' option given more than once\n", CMDLINE_PARSER_PACKAGE); + clear_args (); + exit (EXIT_FAILURE); + } + args_info->refsele_given = 1; + args_info->refsele_arg = gengetopt_strdup (optarg); + break; + } + /* The number of images to repeat in the x direction. */ - if (strcmp (long_options[option_index].name, "repeatX") == 0) + else if (strcmp (long_options[option_index].name, "repeatX") == 0) { if (args_info->repeatX_given) { @@ -312,6 +346,20 @@ cmdline_parser (int argc, char * const *argv, struct g break; } + /* Replace the Gay-Berne atom with four linear atoms. */ + else if (strcmp (long_options[option_index].name, "gb") == 0) + { + if (args_info->gb_given) + { + fprintf (stderr, "%s: `--gb' option given more than once\n", CMDLINE_PARSER_PACKAGE); + clear_args (); + exit (EXIT_FAILURE); + } + args_info->gb_given = 1; + args_info->gb_arg = gengetopt_strdup (optarg); + break; + } + case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ @@ -332,15 +380,5 @@ cmdline_parser (int argc, char * const *argv, struct g if ( missing_required_options ) exit (EXIT_FAILURE); - if (args_info->ignore_given) - { - args_info->ignore_arg = (char * *) malloc (args_info->ignore_given * sizeof (char *)); - for (i = 0; i < args_info->ignore_given; i++) - { - args_info->ignore_arg [i] = ignore_list->ignore_arg; - ignore_list = ignore_list->next; - } - } - return 0; }