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 2053 by tim, Fri Feb 18 23:07:32 2005 UTC vs.
Revision 2749 by tim, Wed May 10 01:44:48 2006 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/program/gengetopt-2.11/src/gengetopt -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 40 | Line 40 | cmdline_parser_print_help (void)
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");
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("  -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");
48 >  printf("  -s, --selection=selection script   general selection syntax\n");
49    printf("      --originsele=selection script  select origin\n");
50    printf("      --refsele=selection script     select reference\n");
51    printf("      --repeatX=INT                  The number of images to repeat in the x \n                                       direction  (default=`0')\n");
52    printf("      --repeatY=INT                  The number of images to repeat in the y \n                                       direction  (default=`0')\n");
53    printf("      --repeatZ=INT                  The number of images to repeat in the z \n                                       direction  (default=`0')\n");
54 +  printf("      --gb=atomtype                  Replace the Gay-Berne atom with four \n                                       linear atoms\n");
55 +  printf("  -b, --basetype                     Convert to base atom type  (default=off)\n");
56   }
57  
58  
# Line 82 | Line 74 | cmdline_parser (int argc, char * const *argv, struct g
74   cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
75   {
76    int c;        /* Character of the parsed option.  */
85  int i;        /* Counter */
86  struct ignore_list
87  {
88    char * ignore_arg;
89    struct ignore_list * next;
90  };
91  struct ignore_list * ignore_list = NULL,* ignore_new = NULL;
92  
77    int missing_required_options = 0;
78  
79    args_info->help_given = 0 ;
# Line 97 | Line 81 | cmdline_parser (int argc, char * const *argv, struct g
81    args_info->input_given = 0 ;
82    args_info->output_given = 0 ;
83    args_info->frame_given = 0 ;
100  args_info->dipole_given = 0 ;
84    args_info->water_given = 0 ;
85    args_info->periodicBox_given = 0 ;
86    args_info->zconstraint_given = 0 ;
87    args_info->rigidbody_given = 0 ;
88    args_info->watertype_given = 0 ;
106  args_info->ignore_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 ;
95 +  args_info->gb_given = 0 ;
96 +  args_info->basetype_given = 0 ;
97   #define clear_args() { \
98    args_info->input_arg = NULL; \
99    args_info->output_arg = NULL; \
100    args_info->frame_arg = 1 ;\
117  args_info->dipole_flag = 0;\
101    args_info->water_flag = 0;\
102    args_info->periodicBox_flag = 0;\
103    args_info->zconstraint_flag = 0;\
104    args_info->rigidbody_flag = 0;\
105    args_info->watertype_flag = 1;\
123  args_info->ignore_arg = NULL; \
106    args_info->selection_arg = NULL; \
107    args_info->originsele_arg = NULL; \
108    args_info->refsele_arg = NULL; \
109    args_info->repeatX_arg = 0 ;\
110    args_info->repeatY_arg = 0 ;\
111    args_info->repeatZ_arg = 0 ;\
112 +  args_info->gb_arg = NULL; \
113 +  args_info->basetype_flag = 0;\
114   }
115  
116    clear_args();
# Line 147 | Line 131 | cmdline_parser (int argc, char * const *argv, struct g
131          { "input",      1, NULL, 'i' },
132          { "output",     1, NULL, 'o' },
133          { "frame",      1, NULL, 'n' },
150        { "dipole",     0, NULL, 'd' },
134          { "water",      0, NULL, 'w' },
135          { "periodicBox",        0, NULL, 'm' },
136          { "zconstraint",        0, NULL, 'z' },
137          { "rigidbody",  0, NULL, 'r' },
138          { "watertype",  0, NULL, 't' },
156        { "ignore",     1, NULL, 'g' },
139          { "selection",  1, NULL, 's' },
140          { "originsele", 1, NULL, 0 },
141          { "refsele",    1, NULL, 0 },
142          { "repeatX",    1, NULL, 0 },
143          { "repeatY",    1, NULL, 0 },
144          { "repeatZ",    1, NULL, 0 },
145 +        { "gb", 1, NULL, 0 },
146 +        { "basetype",   0, NULL, 'b' },
147          { NULL, 0, NULL, 0 }
148        };
149  
150        stop_char = 0;
151 <      c = getopt_long (argc, argv, "hVi:o:n:dwmzrtg:s:", long_options, &option_index);
151 >      c = getopt_long (argc, argv, "hVi:o:n:wmzrts:b", long_options, &option_index);
152  
153        if (c == -1) break;       /* Exit from `while (1)' loop.  */
154  
# Line 211 | Line 195 | cmdline_parser (int argc, char * const *argv, struct g
195              }
196            args_info->frame_given = 1;
197            args_info->frame_arg = strtol (optarg,&stop_char,0);
214          break;
215
216        case 'd':       /* print the dipole moments.  */
217          if (args_info->dipole_given)
218            {
219              fprintf (stderr, "%s: `--dipole' (`-d') option given more than once\n", CMDLINE_PARSER_PACKAGE);
220              clear_args ();
221              exit (EXIT_FAILURE);
222            }
223          args_info->dipole_given = 1;
224          args_info->dipole_flag = !(args_info->dipole_flag);
198            break;
199  
200          case 'w':       /* skip the the waters.  */
# Line 279 | Line 252 | cmdline_parser (int argc, char * const *argv, struct g
252            args_info->watertype_flag = !(args_info->watertype_flag);
253            break;
254  
255 <        case 'g':       /* ignore the atom types.  */
283 <          args_info->ignore_given++;
284 <          ignore_new = (struct ignore_list *) malloc (sizeof (struct ignore_list));
285 <          ignore_new->next = ignore_list;
286 <          ignore_list = ignore_new;
287 <          ignore_new->ignore_arg = gengetopt_strdup (optarg);
288 <          break;
289 <
290 <        case 's':       /* general selection syntax(now only support select atoms within a specified range).  */
255 >        case 's':       /* general selection syntax.  */
256            if (args_info->selection_given)
257              {
258                fprintf (stderr, "%s: `--selection' (`-s') option given more than once\n", CMDLINE_PARSER_PACKAGE);
# Line 298 | Line 263 | cmdline_parser (int argc, char * const *argv, struct g
263            args_info->selection_arg = gengetopt_strdup (optarg);
264            break;
265  
266 +        case 'b':       /* Convert to base atom type.  */
267 +          if (args_info->basetype_given)
268 +            {
269 +              fprintf (stderr, "%s: `--basetype' (`-b') option given more than once\n", CMDLINE_PARSER_PACKAGE);
270 +              clear_args ();
271 +              exit (EXIT_FAILURE);
272 +            }
273 +          args_info->basetype_given = 1;
274 +          args_info->basetype_flag = !(args_info->basetype_flag);
275 +          break;
276  
277 +
278          case 0: /* Long option with no short option */
279            /* select origin.  */
280            if (strcmp (long_options[option_index].name, "originsele") == 0)
# Line 370 | Line 346 | cmdline_parser (int argc, char * const *argv, struct g
346              break;
347            }
348            
349 +          /* Replace the Gay-Berne atom with four linear atoms.  */
350 +          else if (strcmp (long_options[option_index].name, "gb") == 0)
351 +          {
352 +            if (args_info->gb_given)
353 +              {
354 +                fprintf (stderr, "%s: `--gb' option given more than once\n", CMDLINE_PARSER_PACKAGE);
355 +                clear_args ();
356 +                exit (EXIT_FAILURE);
357 +              }
358 +            args_info->gb_given = 1;
359 +            args_info->gb_arg = gengetopt_strdup (optarg);
360 +            break;
361 +          }
362 +          
363  
364          case '?':       /* Invalid option.  */
365            /* `getopt_long' already printed an error message.  */
# Line 390 | Line 380 | cmdline_parser (int argc, char * const *argv, struct g
380    if ( missing_required_options )
381      exit (EXIT_FAILURE);
382  
393  if (args_info->ignore_given)
394    {
395      args_info->ignore_arg = (char * *) malloc (args_info->ignore_given * sizeof (char *));
396      for (i = 0; i < args_info->ignore_given; i++)
397        {
398          args_info->ignore_arg [i] = ignore_list->ignore_arg;
399          ignore_list = ignore_list->next;
400        }
401    }
402  
383    return 0;
384   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines