63 |
|
{ |
64 |
|
cmdline_parser_print_version (); |
65 |
|
printf("\n" |
66 |
< |
"Purpose:\n" |
67 |
< |
" Builds penta-hexagonal nanorods and outputs a xyz input file\n" |
68 |
< |
"\n" |
69 |
< |
"Usage: %s [OPTIONS]... [FILES]...\n", CMDLINE_PARSER_PACKAGE); |
66 |
> |
"Purpose:\n" |
67 |
> |
" Builds penta-hexagonal nanorods and outputs a xyz input file\n" |
68 |
> |
"\n" |
69 |
> |
"Usage: %s [OPTIONS]... [FILES]...\n", CMDLINE_PARSER_PACKAGE); |
70 |
|
printf("\n"); |
71 |
|
printf("%s\n"," -h, --help Print help and exit"); |
72 |
|
printf("%s\n"," -V, --version Print version and exit"); |
220 |
|
case 0: /* Long option with no short option */ |
221 |
|
/* Lattice type string. Valid types are fcc,hcp,bcc.. */ |
222 |
|
if (strcmp (long_options[option_index].name, "latticetype") == 0) |
223 |
< |
{ |
224 |
< |
if (local_args_info.latticetype_given) |
225 |
< |
{ |
226 |
< |
fprintf (stderr, "%s: `--latticetype' option given more than once%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); |
227 |
< |
goto failure; |
228 |
< |
} |
229 |
< |
if (args_info->latticetype_given && ! override) |
230 |
< |
continue; |
231 |
< |
local_args_info.latticetype_given = 1; |
232 |
< |
args_info->latticetype_given = 1; |
233 |
< |
if (args_info->latticetype_arg) |
234 |
< |
free (args_info->latticetype_arg); /* free previous string */ |
235 |
< |
args_info->latticetype_arg = gengetopt_strdup (optarg); |
236 |
< |
} |
223 |
> |
{ |
224 |
> |
if (local_args_info.latticetype_given) |
225 |
> |
{ |
226 |
> |
fprintf (stderr, "%s: `--latticetype' option given more than once%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); |
227 |
> |
goto failure; |
228 |
> |
} |
229 |
> |
if (args_info->latticetype_given && ! override) |
230 |
> |
continue; |
231 |
> |
local_args_info.latticetype_given = 1; |
232 |
> |
args_info->latticetype_given = 1; |
233 |
> |
if (args_info->latticetype_arg) |
234 |
> |
free (args_info->latticetype_arg); /* free previous string */ |
235 |
> |
args_info->latticetype_arg = gengetopt_strdup (optarg); |
236 |
> |
} |
237 |
|
|
238 |
|
/* length of nanorod in Angstroms. */ |
239 |
|
else if (strcmp (long_options[option_index].name, "length") == 0) |
240 |
< |
{ |
241 |
< |
if (local_args_info.length_given) |
242 |
< |
{ |
243 |
< |
fprintf (stderr, "%s: `--length' option given more than once%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); |
244 |
< |
goto failure; |
245 |
< |
} |
246 |
< |
if (args_info->length_given && ! override) |
247 |
< |
continue; |
248 |
< |
local_args_info.length_given = 1; |
249 |
< |
args_info->length_given = 1; |
250 |
< |
args_info->length_arg = strtod (optarg, NULL); |
251 |
< |
} |
240 |
> |
{ |
241 |
> |
if (local_args_info.length_given) |
242 |
> |
{ |
243 |
> |
fprintf (stderr, "%s: `--length' option given more than once%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); |
244 |
> |
goto failure; |
245 |
> |
} |
246 |
> |
if (args_info->length_given && ! override) |
247 |
> |
continue; |
248 |
> |
local_args_info.length_given = 1; |
249 |
> |
args_info->length_given = 1; |
250 |
> |
args_info->length_arg = strtod (optarg, NULL); |
251 |
> |
} |
252 |
|
|
253 |
|
/* diameter of nanorod in Angstroms. */ |
254 |
|
else if (strcmp (long_options[option_index].name, "width") == 0) |
255 |
< |
{ |
256 |
< |
if (local_args_info.width_given) |
257 |
< |
{ |
258 |
< |
fprintf (stderr, "%s: `--width' option given more than once%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); |
259 |
< |
goto failure; |
260 |
< |
} |
261 |
< |
if (args_info->width_given && ! override) |
262 |
< |
continue; |
263 |
< |
local_args_info.width_given = 1; |
264 |
< |
args_info->width_given = 1; |
265 |
< |
args_info->width_arg = strtod (optarg, NULL); |
266 |
< |
} |
255 |
> |
{ |
256 |
> |
if (local_args_info.width_given) |
257 |
> |
{ |
258 |
> |
fprintf (stderr, "%s: `--width' option given more than once%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); |
259 |
> |
goto failure; |
260 |
> |
} |
261 |
> |
if (args_info->width_given && ! override) |
262 |
> |
continue; |
263 |
> |
local_args_info.width_given = 1; |
264 |
> |
args_info->width_given = 1; |
265 |
> |
args_info->width_arg = strtod (optarg, NULL); |
266 |
> |
} |
267 |
|
|
268 |
|
/* lattice spacing in Angstrons for cubic lattice. */ |
269 |
|
else if (strcmp (long_options[option_index].name, "latticeCnst") == 0) |
270 |
< |
{ |
271 |
< |
if (local_args_info.latticeCnst_given) |
272 |
< |
{ |
273 |
< |
fprintf (stderr, "%s: `--latticeCnst' option given more than once%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); |
274 |
< |
goto failure; |
275 |
< |
} |
276 |
< |
if (args_info->latticeCnst_given && ! override) |
277 |
< |
continue; |
278 |
< |
local_args_info.latticeCnst_given = 1; |
279 |
< |
args_info->latticeCnst_given = 1; |
280 |
< |
args_info->latticeCnst_arg = strtod (optarg, NULL); |
281 |
< |
} |
270 |
> |
{ |
271 |
> |
if (local_args_info.latticeCnst_given) |
272 |
> |
{ |
273 |
> |
fprintf (stderr, "%s: `--latticeCnst' option given more than once%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); |
274 |
> |
goto failure; |
275 |
> |
} |
276 |
> |
if (args_info->latticeCnst_given && ! override) |
277 |
> |
continue; |
278 |
> |
local_args_info.latticeCnst_given = 1; |
279 |
> |
args_info->latticeCnst_given = 1; |
280 |
> |
args_info->latticeCnst_arg = strtod (optarg, NULL); |
281 |
> |
} |
282 |
|
|
283 |
|
/* generate a geomview file with the object geometry. */ |
284 |
|
else if (strcmp (long_options[option_index].name, "genGeomview") == 0) |
285 |
< |
{ |
286 |
< |
if (local_args_info.genGeomview_given) |
287 |
< |
{ |
288 |
< |
fprintf (stderr, "%s: `--genGeomview' option given more than once%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); |
289 |
< |
goto failure; |
290 |
< |
} |
291 |
< |
if (args_info->genGeomview_given && ! override) |
292 |
< |
continue; |
293 |
< |
local_args_info.genGeomview_given = 1; |
294 |
< |
args_info->genGeomview_given = 1; |
295 |
< |
args_info->genGeomview_arg = strtol (optarg,&stop_char,0); |
296 |
< |
} |
285 |
> |
{ |
286 |
> |
if (local_args_info.genGeomview_given) |
287 |
> |
{ |
288 |
> |
fprintf (stderr, "%s: `--genGeomview' option given more than once%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); |
289 |
> |
goto failure; |
290 |
> |
} |
291 |
> |
if (args_info->genGeomview_given && ! override) |
292 |
> |
continue; |
293 |
> |
local_args_info.genGeomview_given = 1; |
294 |
> |
args_info->genGeomview_given = 1; |
295 |
> |
args_info->genGeomview_arg = strtol (optarg,&stop_char,0); |
296 |
> |
} |
297 |
|
|
298 |
|
|
299 |
|
break; |
346 |
|
|
347 |
|
return 0; |
348 |
|
|
349 |
< |
failure: |
349 |
> |
failure: |
350 |
|
cmdline_parser_free (&local_args_info); |
351 |
|
return (EXIT_FAILURE); |
352 |
|
} |