33 |
|
{ |
34 |
|
cmdline_parser_print_version (); |
35 |
|
printf("\n" |
36 |
< |
"Usage: %s [OPTIONS]...\n", CMDLINE_PARSER_PACKAGE); |
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"); |
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(" -s, --selection=selection script general selection syntax(now only support \n select atoms within a specified range)\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"); |
90 |
|
args_info->repeatX_given = 0 ; |
91 |
|
args_info->repeatY_given = 0 ; |
92 |
|
args_info->repeatZ_given = 0 ; |
93 |
< |
#define clear_args() { \ |
94 |
< |
args_info->input_arg = NULL; \ |
95 |
< |
args_info->output_arg = NULL; \ |
96 |
< |
args_info->frame_arg = 1 ;\ |
97 |
< |
args_info->water_flag = 0;\ |
98 |
< |
args_info->periodicBox_flag = 0;\ |
99 |
< |
args_info->zconstraint_flag = 0;\ |
100 |
< |
args_info->rigidbody_flag = 0;\ |
101 |
< |
args_info->watertype_flag = 1;\ |
102 |
< |
args_info->selection_arg = NULL; \ |
103 |
< |
args_info->originsele_arg = NULL; \ |
104 |
< |
args_info->refsele_arg = NULL; \ |
105 |
< |
args_info->repeatX_arg = 0 ;\ |
106 |
< |
args_info->repeatY_arg = 0 ;\ |
107 |
< |
args_info->repeatZ_arg = 0 ;\ |
108 |
< |
} |
93 |
> |
#define clear_args() { \ |
94 |
> |
args_info->input_arg = NULL; \ |
95 |
> |
args_info->output_arg = NULL; \ |
96 |
> |
args_info->frame_arg = 1 ; \ |
97 |
> |
args_info->water_flag = 0; \ |
98 |
> |
args_info->periodicBox_flag = 0; \ |
99 |
> |
args_info->zconstraint_flag = 0; \ |
100 |
> |
args_info->rigidbody_flag = 0; \ |
101 |
> |
args_info->watertype_flag = 1; \ |
102 |
> |
args_info->selection_arg = NULL; \ |
103 |
> |
args_info->originsele_arg = NULL; \ |
104 |
> |
args_info->refsele_arg = NULL; \ |
105 |
> |
args_info->repeatX_arg = 0 ; \ |
106 |
> |
args_info->repeatY_arg = 0 ; \ |
107 |
> |
args_info->repeatZ_arg = 0 ; \ |
108 |
> |
} |
109 |
|
|
110 |
|
clear_args(); |
111 |
|
|
244 |
|
args_info->watertype_flag = !(args_info->watertype_flag); |
245 |
|
break; |
246 |
|
|
247 |
< |
case 's': /* general selection syntax(now only support select atoms within a specified range). */ |
247 |
> |
case 's': /* general selection syntax. */ |
248 |
|
if (args_info->selection_given) |
249 |
|
{ |
250 |
|
fprintf (stderr, "%s: `--selection' (`-s') option given more than once\n", CMDLINE_PARSER_PACKAGE); |
259 |
|
case 0: /* Long option with no short option */ |
260 |
|
/* select origin. */ |
261 |
|
if (strcmp (long_options[option_index].name, "originsele") == 0) |
262 |
< |
{ |
263 |
< |
if (args_info->originsele_given) |
264 |
< |
{ |
265 |
< |
fprintf (stderr, "%s: `--originsele' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
266 |
< |
clear_args (); |
267 |
< |
exit (EXIT_FAILURE); |
268 |
< |
} |
269 |
< |
args_info->originsele_given = 1; |
270 |
< |
args_info->originsele_arg = gengetopt_strdup (optarg); |
271 |
< |
break; |
272 |
< |
} |
262 |
> |
{ |
263 |
> |
if (args_info->originsele_given) |
264 |
> |
{ |
265 |
> |
fprintf (stderr, "%s: `--originsele' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
266 |
> |
clear_args (); |
267 |
> |
exit (EXIT_FAILURE); |
268 |
> |
} |
269 |
> |
args_info->originsele_given = 1; |
270 |
> |
args_info->originsele_arg = gengetopt_strdup (optarg); |
271 |
> |
break; |
272 |
> |
} |
273 |
|
|
274 |
|
/* select reference. */ |
275 |
|
else if (strcmp (long_options[option_index].name, "refsele") == 0) |
276 |
< |
{ |
277 |
< |
if (args_info->refsele_given) |
278 |
< |
{ |
279 |
< |
fprintf (stderr, "%s: `--refsele' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
280 |
< |
clear_args (); |
281 |
< |
exit (EXIT_FAILURE); |
282 |
< |
} |
283 |
< |
args_info->refsele_given = 1; |
284 |
< |
args_info->refsele_arg = gengetopt_strdup (optarg); |
285 |
< |
break; |
286 |
< |
} |
276 |
> |
{ |
277 |
> |
if (args_info->refsele_given) |
278 |
> |
{ |
279 |
> |
fprintf (stderr, "%s: `--refsele' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
280 |
> |
clear_args (); |
281 |
> |
exit (EXIT_FAILURE); |
282 |
> |
} |
283 |
> |
args_info->refsele_given = 1; |
284 |
> |
args_info->refsele_arg = gengetopt_strdup (optarg); |
285 |
> |
break; |
286 |
> |
} |
287 |
|
|
288 |
|
/* The number of images to repeat in the x direction. */ |
289 |
|
else if (strcmp (long_options[option_index].name, "repeatX") == 0) |
290 |
< |
{ |
291 |
< |
if (args_info->repeatX_given) |
292 |
< |
{ |
293 |
< |
fprintf (stderr, "%s: `--repeatX' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
294 |
< |
clear_args (); |
295 |
< |
exit (EXIT_FAILURE); |
296 |
< |
} |
297 |
< |
args_info->repeatX_given = 1; |
298 |
< |
args_info->repeatX_arg = strtol (optarg,&stop_char,0); |
299 |
< |
break; |
300 |
< |
} |
290 |
> |
{ |
291 |
> |
if (args_info->repeatX_given) |
292 |
> |
{ |
293 |
> |
fprintf (stderr, "%s: `--repeatX' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
294 |
> |
clear_args (); |
295 |
> |
exit (EXIT_FAILURE); |
296 |
> |
} |
297 |
> |
args_info->repeatX_given = 1; |
298 |
> |
args_info->repeatX_arg = strtol (optarg,&stop_char,0); |
299 |
> |
break; |
300 |
> |
} |
301 |
|
|
302 |
|
/* The number of images to repeat in the y direction. */ |
303 |
|
else if (strcmp (long_options[option_index].name, "repeatY") == 0) |
304 |
< |
{ |
305 |
< |
if (args_info->repeatY_given) |
306 |
< |
{ |
307 |
< |
fprintf (stderr, "%s: `--repeatY' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
308 |
< |
clear_args (); |
309 |
< |
exit (EXIT_FAILURE); |
310 |
< |
} |
311 |
< |
args_info->repeatY_given = 1; |
312 |
< |
args_info->repeatY_arg = strtol (optarg,&stop_char,0); |
313 |
< |
break; |
314 |
< |
} |
304 |
> |
{ |
305 |
> |
if (args_info->repeatY_given) |
306 |
> |
{ |
307 |
> |
fprintf (stderr, "%s: `--repeatY' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
308 |
> |
clear_args (); |
309 |
> |
exit (EXIT_FAILURE); |
310 |
> |
} |
311 |
> |
args_info->repeatY_given = 1; |
312 |
> |
args_info->repeatY_arg = strtol (optarg,&stop_char,0); |
313 |
> |
break; |
314 |
> |
} |
315 |
|
|
316 |
|
/* The number of images to repeat in the z direction. */ |
317 |
|
else if (strcmp (long_options[option_index].name, "repeatZ") == 0) |
318 |
< |
{ |
319 |
< |
if (args_info->repeatZ_given) |
320 |
< |
{ |
321 |
< |
fprintf (stderr, "%s: `--repeatZ' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
322 |
< |
clear_args (); |
323 |
< |
exit (EXIT_FAILURE); |
324 |
< |
} |
325 |
< |
args_info->repeatZ_given = 1; |
326 |
< |
args_info->repeatZ_arg = strtol (optarg,&stop_char,0); |
327 |
< |
break; |
328 |
< |
} |
318 |
> |
{ |
319 |
> |
if (args_info->repeatZ_given) |
320 |
> |
{ |
321 |
> |
fprintf (stderr, "%s: `--repeatZ' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
322 |
> |
clear_args (); |
323 |
> |
exit (EXIT_FAILURE); |
324 |
> |
} |
325 |
> |
args_info->repeatZ_given = 1; |
326 |
> |
args_info->repeatZ_arg = strtol (optarg,&stop_char,0); |
327 |
> |
break; |
328 |
> |
} |
329 |
|
|
330 |
|
|
331 |
|
case '?': /* Invalid option. */ |