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

Comparing trunk/OOPSE-4/src/applications/dump2Xyz/Dump2XYZCmd.c (file contents):
Revision 1988 by tim, Mon Feb 7 22:38:35 2005 UTC vs.
Revision 2240 by tim, Thu May 26 22:45:00 2005 UTC

# Line 1 | Line 1
1   /*
2    File autogenerated by gengetopt version 2.11
3    generated with the following command:
4 <  /home/maul/gezelter/tim/bin/gengetopt -F Dump2XYZCmd
4 >  /home/maul/gezelter/tim/bin/gengetopt -i Dump2XYZ.ggo -F Dump2XYZCmd
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 35 | Line 35 | cmdline_parser_print_help (void)
35    printf("\n"
36    "Usage: %s [OPTIONS]...\n", CMDLINE_PARSER_PACKAGE);
37    printf("\n");
38 <  printf("  -h, --help                        Print help and exit\n");
39 <  printf("  -V, --version                     Print version and exit\n");
40 <  printf("  -i, --input=filename              input dump file\n");
41 <  printf("  -o, --output=filename             output file name\n");
42 <  printf("  -n, --frame=INT                   print every n frame  (default=`1')\n");
43 <  printf("  -d, --dipole                      print the dipole moments  (default=off)\n");
44 <  printf("  -w, --water                       skip the the waters  (default=off)\n");
45 <  printf("  -m, --periodicBox                 map to the periodic box  (default=off)\n");
46 <  printf("  -z, --zconstraint                 replace the atom types of zconstraint \n                                      molecules  (default=off)\n");
47 <  printf("  -r, --rigidbody                   add a pseudo COM atom to rigidbody  \n                                      (default=off)\n");
48 <  printf("  -t, --watertype                   replace the atom type of water model  \n                                      (default=on)\n");
49 <  printf("  -g, --ignore=atomtype             ignore the atom types\n");
50 <  printf("  -s, --selection=selection script  selection syntax:\n"                                      
51 <         "                                    select DMPC -- select DMPC molecule\n"                    
52 <         "                                    select DMPC.* -- select all atoms and all rigidbodies belong to DMPC molecule(same as above)\n"          
53 <         "                                    select not DMPC -- select all atoms and all rigidbodies do not belong to DMPC molecule\n"
54 <         "                                    select C* and 4 to 7 -- select stuntdoubles which match C* and which index is between [4, 7)\n"  
55 <         "                                    select 5 -- select stuntdobule whose global index is 5\n"                                      
56 <         "                                    select within (5.0, HDP or PO4) -- select stuntdoubles which is within 5 A to HDP or PO4\n"
57 <         "                                    select DMPC.3 -- select stuntdouble which internal index is 3\n"
58 <         "                                    select DMPC.DMPC_RB_*.* --select atoms belong to rigid body inside DMPC molecule \n");
59 <  printf("      --repeatX=INT                 The number of images to repeat in the x \n                                      direction  (default=`0')\n");
60 <  printf("      --repeatY=INT                 The number of images to repeat in the y \n                                      direction  (default=`0')\n");
61 <  printf("      --repeatZ=INT                 The number of images to repeat in the z \n                                      direction  (default=`0')\n");
38 >  printf("  -h, --help                         Print help and exit\n");
39 >  printf("  -V, --version                      Print version and exit\n");
40 >  printf("  -i, --input=filename               input dump file\n");
41 >  printf("  -o, --output=filename              output file name\n");
42 >  printf("  -n, --frame=INT                    print every n frame  (default=`1')\n");
43 >  printf("  -w, --water                        skip the the waters  (default=off)\n");
44 >  printf("  -m, --periodicBox                  map to the periodic box  (default=off)\n");
45 >  printf("  -z, --zconstraint                  replace the atom types of zconstraint \n                                       molecules  (default=off)\n");
46 >  printf("  -r, --rigidbody                    add a pseudo COM atom to rigidbody  \n                                       (default=off)\n");
47 >  printf("  -t, --watertype                    replace the atom type of water model  \n                                       (default=on)\n");
48 >  printf("  -b, --basetype                     using base atom type  (default=off)\n");
49 >  printf("  -s, --selection=selection script   general selection syntax\n");
50 >  printf("      --originsele=selection script  select origin\n");
51 >  printf("      --refsele=selection script     select reference\n");
52 >  printf("      --repeatX=INT                  The number of images to repeat in the x \n                                       direction  (default=`0')\n");
53 >  printf("      --repeatY=INT                  The number of images to repeat in the y \n                                       direction  (default=`0')\n");
54 >  printf("      --repeatZ=INT                  The number of images to repeat in the z \n                                       direction  (default=`0')\n");
55   }
56  
57  
# Line 80 | Line 73 | cmdline_parser (int argc, char * const *argv, struct g
73   cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
74   {
75    int c;        /* Character of the parsed option.  */
83  int i;        /* Counter */
84  struct ignore_list
85  {
86    char * ignore_arg;
87    struct ignore_list * next;
88  };
89  struct ignore_list * ignore_list = NULL,* ignore_new = NULL;
90  
76    int missing_required_options = 0;
77  
78    args_info->help_given = 0 ;
# Line 95 | Line 80 | cmdline_parser (int argc, char * const *argv, struct g
80    args_info->input_given = 0 ;
81    args_info->output_given = 0 ;
82    args_info->frame_given = 0 ;
98  args_info->dipole_given = 0 ;
83    args_info->water_given = 0 ;
84    args_info->periodicBox_given = 0 ;
85    args_info->zconstraint_given = 0 ;
86    args_info->rigidbody_given = 0 ;
87    args_info->watertype_given = 0 ;
88 <  args_info->ignore_given = 0 ;
88 >  args_info->basetype_given = 0 ;
89    args_info->selection_given = 0 ;
90 +  args_info->originsele_given = 0 ;
91 +  args_info->refsele_given = 0 ;
92    args_info->repeatX_given = 0 ;
93    args_info->repeatY_given = 0 ;
94    args_info->repeatZ_given = 0 ;
# Line 110 | Line 96 | cmdline_parser (int argc, char * const *argv, struct g
96    args_info->input_arg = NULL; \
97    args_info->output_arg = NULL; \
98    args_info->frame_arg = 1 ;\
113  args_info->dipole_flag = 0;\
99    args_info->water_flag = 0;\
100    args_info->periodicBox_flag = 0;\
101    args_info->zconstraint_flag = 0;\
102    args_info->rigidbody_flag = 0;\
103    args_info->watertype_flag = 1;\
104 <  args_info->ignore_arg = NULL; \
104 >  args_info->basetype_flag = 0;\
105    args_info->selection_arg = NULL; \
106 +  args_info->originsele_arg = NULL; \
107 +  args_info->refsele_arg = NULL; \
108    args_info->repeatX_arg = 0 ;\
109    args_info->repeatY_arg = 0 ;\
110    args_info->repeatZ_arg = 0 ;\
# Line 141 | Line 128 | cmdline_parser (int argc, char * const *argv, struct g
128          { "input",      1, NULL, 'i' },
129          { "output",     1, NULL, 'o' },
130          { "frame",      1, NULL, 'n' },
144        { "dipole",     0, NULL, 'd' },
131          { "water",      0, NULL, 'w' },
132          { "periodicBox",        0, NULL, 'm' },
133          { "zconstraint",        0, NULL, 'z' },
134          { "rigidbody",  0, NULL, 'r' },
135          { "watertype",  0, NULL, 't' },
136 <        { "ignore",     1, NULL, 'g' },
136 >        { "basetype",   0, NULL, 'b' },
137          { "selection",  1, NULL, 's' },
138 +        { "originsele", 1, NULL, 0 },
139 +        { "refsele",    1, NULL, 0 },
140          { "repeatX",    1, NULL, 0 },
141          { "repeatY",    1, NULL, 0 },
142          { "repeatZ",    1, NULL, 0 },
# Line 156 | Line 144 | cmdline_parser (int argc, char * const *argv, struct g
144        };
145  
146        stop_char = 0;
147 <      c = getopt_long (argc, argv, "hVi:o:n:dwmzrtg:s:", long_options, &option_index);
147 >      c = getopt_long (argc, argv, "hVi:o:n:wmzrtbs:", long_options, &option_index);
148  
149        if (c == -1) break;       /* Exit from `while (1)' loop.  */
150  
# Line 205 | Line 193 | cmdline_parser (int argc, char * const *argv, struct g
193            args_info->frame_arg = strtol (optarg,&stop_char,0);
194            break;
195  
208        case 'd':       /* print the dipole moments.  */
209          if (args_info->dipole_given)
210            {
211              fprintf (stderr, "%s: `--dipole' (`-d') option given more than once\n", CMDLINE_PARSER_PACKAGE);
212              clear_args ();
213              exit (EXIT_FAILURE);
214            }
215          args_info->dipole_given = 1;
216          args_info->dipole_flag = !(args_info->dipole_flag);
217          break;
218
196          case 'w':       /* skip the the waters.  */
197            if (args_info->water_given)
198              {
# Line 271 | Line 248 | cmdline_parser (int argc, char * const *argv, struct g
248            args_info->watertype_flag = !(args_info->watertype_flag);
249            break;
250  
251 <        case 'g':       /* ignore the atom types.  */
252 <          args_info->ignore_given++;
253 <          ignore_new = (struct ignore_list *) malloc (sizeof (struct ignore_list));
254 <          ignore_new->next = ignore_list;
255 <          ignore_list = ignore_new;
256 <          ignore_new->ignore_arg = gengetopt_strdup (optarg);
251 >        case 'b':       /* using base atom type.  */
252 >          if (args_info->basetype_given)
253 >            {
254 >              fprintf (stderr, "%s: `--basetype' (`-b') option given more than once\n", CMDLINE_PARSER_PACKAGE);
255 >              clear_args ();
256 >              exit (EXIT_FAILURE);
257 >            }
258 >          args_info->basetype_given = 1;
259 >          args_info->basetype_flag = !(args_info->basetype_flag);
260            break;
261  
262 <        case 's':       /* general selection syntax:\n
283 < select DMPC -- select DMPC molecule\n \
284 < select DMPC.* -- select all atoms and all rigidbodies belong to DMPC molecule\n \
285 < select 5 -- select stuntdobule whose global index is 5\n \
286 < select within (5.0, HDP or PO4) -- select stuntdoubles which is within 5 A to HDP or PO4\n \
287 < select DMPC.DMPC_RB_*.* --select atoms belong to rigid body inside DMPC molecule .  */
262 >        case 's':       /* general selection syntax.  */
263            if (args_info->selection_given)
264              {
265                fprintf (stderr, "%s: `--selection' (`-s') option given more than once\n", CMDLINE_PARSER_PACKAGE);
# Line 297 | Line 272 | select DMPC.DMPC_RB_*.* --select atoms belong to rigid
272  
273  
274          case 0: /* Long option with no short option */
275 +          /* select origin.  */
276 +          if (strcmp (long_options[option_index].name, "originsele") == 0)
277 +          {
278 +            if (args_info->originsele_given)
279 +              {
280 +                fprintf (stderr, "%s: `--originsele' option given more than once\n", CMDLINE_PARSER_PACKAGE);
281 +                clear_args ();
282 +                exit (EXIT_FAILURE);
283 +              }
284 +            args_info->originsele_given = 1;
285 +            args_info->originsele_arg = gengetopt_strdup (optarg);
286 +            break;
287 +          }
288 +          
289 +          /* select reference.  */
290 +          else if (strcmp (long_options[option_index].name, "refsele") == 0)
291 +          {
292 +            if (args_info->refsele_given)
293 +              {
294 +                fprintf (stderr, "%s: `--refsele' option given more than once\n", CMDLINE_PARSER_PACKAGE);
295 +                clear_args ();
296 +                exit (EXIT_FAILURE);
297 +              }
298 +            args_info->refsele_given = 1;
299 +            args_info->refsele_arg = gengetopt_strdup (optarg);
300 +            break;
301 +          }
302 +          
303            /* The number of images to repeat in the x direction.  */
304 <          if (strcmp (long_options[option_index].name, "repeatX") == 0)
304 >          else if (strcmp (long_options[option_index].name, "repeatX") == 0)
305            {
306              if (args_info->repeatX_given)
307                {
# Line 359 | Line 362 | select DMPC.DMPC_RB_*.* --select atoms belong to rigid
362    if ( missing_required_options )
363      exit (EXIT_FAILURE);
364  
362  if (args_info->ignore_given)
363    {
364      args_info->ignore_arg = (char * *) malloc (args_info->ignore_given * sizeof (char *));
365      for (i = 0; i < args_info->ignore_given; i++)
366        {
367          args_info->ignore_arg [i] = ignore_list->ignore_arg;
368          ignore_list = ignore_list->next;
369        }
370    }
371  
365    return 0;
366   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines