| 1 |
|
/* |
| 2 |
< |
File autogenerated by gengetopt version 2.15 |
| 2 |
> |
File autogenerated by gengetopt version 2.13.1 |
| 3 |
|
generated with the following command: |
| 4 |
< |
gengetopt -u -i nanoparticleBuilder.ggo -F nanoparticleBuilderCmd |
| 4 |
> |
gengetopt -F nanoparticleBuilderCmd --unamed-opts --no-handle-error |
| 5 |
|
|
| 6 |
|
The developers of gengetopt consider the fixed text that goes in all |
| 7 |
|
gengetopt output files to be in the public domain: |
| 32 |
|
static int |
| 33 |
|
cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); |
| 34 |
|
|
| 35 |
< |
struct ShellRadius_list |
| 35 |
> |
struct shellRadius_list |
| 36 |
|
{ |
| 37 |
< |
double ShellRadius_arg; |
| 38 |
< |
char *ShellRadius_orig; |
| 39 |
< |
struct ShellRadius_list * next; |
| 37 |
> |
double shellRadius_arg; |
| 38 |
> |
struct shellRadius_list * next; |
| 39 |
|
}; |
| 40 |
|
|
| 41 |
|
struct molFraction_list |
| 42 |
|
{ |
| 43 |
|
double molFraction_arg; |
| 45 |
– |
char *molFraction_orig; |
| 44 |
|
struct molFraction_list * next; |
| 45 |
|
}; |
| 46 |
|
|
| 49 |
– |
struct vacancyRadius_list |
| 50 |
– |
{ |
| 51 |
– |
double vacancyRadius_arg; |
| 52 |
– |
char *vacancyRadius_orig; |
| 53 |
– |
struct vacancyRadius_list * next; |
| 54 |
– |
}; |
| 55 |
– |
|
| 47 |
|
static char * |
| 48 |
|
gengetopt_strdup (const char *s); |
| 49 |
|
|
| 53 |
|
args_info->help_given = 0 ; |
| 54 |
|
args_info->version_given = 0 ; |
| 55 |
|
args_info->output_given = 0 ; |
| 56 |
< |
args_info->latticeCnst_given = 0 ; |
| 56 |
> |
args_info->latticeConstant_given = 0 ; |
| 57 |
|
args_info->radius_given = 0 ; |
| 58 |
< |
args_info->ShellRadius_given = 0 ; |
| 58 |
> |
args_info->shellRadius_given = 0 ; |
| 59 |
|
args_info->molFraction_given = 0 ; |
| 60 |
< |
args_info->vacancyPCT_given = 0 ; |
| 61 |
< |
args_info->vacancyRadius_given = 0 ; |
| 60 |
> |
args_info->vacancyPercent_given = 0 ; |
| 61 |
> |
args_info->vacancyInnerRadius_given = 0 ; |
| 62 |
> |
args_info->vacancyOuterRadius_given = 0 ; |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
static |
| 66 |
|
void clear_args (struct gengetopt_args_info *args_info) |
| 67 |
|
{ |
| 68 |
|
args_info->output_arg = NULL; |
| 69 |
< |
args_info->output_orig = NULL; |
| 78 |
< |
args_info->latticeCnst_orig = NULL; |
| 79 |
< |
args_info->radius_orig = NULL; |
| 80 |
< |
args_info->ShellRadius_arg = NULL; |
| 81 |
< |
args_info->ShellRadius_orig = NULL; |
| 69 |
> |
args_info->shellRadius_arg = NULL; |
| 70 |
|
args_info->molFraction_arg = NULL; |
| 83 |
– |
args_info->molFraction_orig = NULL; |
| 84 |
– |
args_info->vacancyPCT_orig = NULL; |
| 85 |
– |
args_info->vacancyRadius_arg = NULL; |
| 86 |
– |
args_info->vacancyRadius_orig = NULL; |
| 87 |
– |
|
| 71 |
|
} |
| 72 |
|
|
| 73 |
|
void |
| 80 |
|
cmdline_parser_print_help (void) |
| 81 |
|
{ |
| 82 |
|
cmdline_parser_print_version (); |
| 83 |
< |
printf("\n%s\n", "Builds spherical random or core-shell nanoparticles and outputs a xyz input \nfile"); |
| 83 |
> |
printf("\n%s\n", "Builds spherical random or core-shell nanoparticles and outputs an OOPSE \nstartup file"); |
| 84 |
|
printf("\nUsage: nanoparticleBuilder [OPTIONS]... [FILES]...\n\n"); |
| 85 |
< |
printf("%s\n"," -h, --help Print help and exit"); |
| 86 |
< |
printf("%s\n"," -V, --version Print version and exit"); |
| 87 |
< |
printf("%s\n"," -o, --output=STRING Output file name"); |
| 88 |
< |
printf("%s\n"," --latticeCnst=DOUBLE Lattice spacing in Angstroms for cubic lattice."); |
| 89 |
< |
printf("%s\n"," --radius=DOUBLE Nanoparticle radius in Angstroms"); |
| 90 |
< |
printf("%s\n"," --ShellRadius=DOUBLE Radius from the center of the particle to start a \n new shell in multi-component core-shell \n particle. Specified for each component > 1 in \n md file."); |
| 91 |
< |
printf("%s\n"," --molFraction=DOUBLE (Default) Builds a multi-component random mixed \n nanoparticle. Mole Fraction must be specified \n for each componet > 1 in MD file."); |
| 92 |
< |
printf("%s\n"," --vacancyPCT=DOUBLE Percentage of vacancies to build"); |
| 93 |
< |
printf("%s\n"," --vacancyRadius=DOUBLE Radius arround core-shell where vacancies should \n be located."); |
| 85 |
> |
printf("%s\n"," -h, --help Print help and exit"); |
| 86 |
> |
printf("%s\n"," -V, --version Print version and exit"); |
| 87 |
> |
printf("%s\n"," -o, --output=STRING Output file name"); |
| 88 |
> |
printf("%s\n"," --latticeConstant=DOUBLE Lattice spacing in Angstroms for cubic lattice."); |
| 89 |
> |
printf("%s\n"," --radius=DOUBLE Nanoparticle radius in Angstroms"); |
| 90 |
> |
printf("%s\n"," --shellRadius=DOUBLE Radius containing within it only molecules of a \n specific component. Specified for each \n component > 1 in the template file."); |
| 91 |
> |
printf("%s\n"," --molFraction=DOUBLE Builds a multi-component random alloy \n nanoparticle. A mole Fraction must be \n specified for each component > 1 in the \n template file."); |
| 92 |
> |
printf("%s\n"," --vacancyPercent=DOUBLE Percentage of atoms to remove from within \n vacancy range"); |
| 93 |
> |
printf("%s\n"," --vacancyInnerRadius=DOUBLE\n Radius arround core-shell where vacancies \n should be located."); |
| 94 |
> |
printf("%s\n"," --vacancyOuterRadius=DOUBLE\n Radius arround core-shell where vacancies \n should be located."); |
| 95 |
|
|
| 96 |
|
} |
| 97 |
|
|
| 105 |
|
args_info->inputs_num = 0; |
| 106 |
|
} |
| 107 |
|
|
| 108 |
< |
static void |
| 109 |
< |
cmdline_parser_release (struct gengetopt_args_info *args_info) |
| 108 |
> |
void |
| 109 |
> |
cmdline_parser_free (struct gengetopt_args_info *args_info) |
| 110 |
|
{ |
| 111 |
|
|
| 112 |
|
unsigned int i; |
| 115 |
|
free (args_info->output_arg); /* free previous argument */ |
| 116 |
|
args_info->output_arg = 0; |
| 117 |
|
} |
| 118 |
< |
if (args_info->output_orig) |
| 118 |
> |
if (args_info->shellRadius_arg) |
| 119 |
|
{ |
| 120 |
< |
free (args_info->output_orig); /* free previous argument */ |
| 121 |
< |
args_info->output_orig = 0; |
| 120 |
> |
free (args_info->shellRadius_arg); /* free previous argument */ |
| 121 |
> |
args_info->shellRadius_arg = 0; |
| 122 |
|
} |
| 139 |
– |
if (args_info->latticeCnst_orig) |
| 140 |
– |
{ |
| 141 |
– |
free (args_info->latticeCnst_orig); /* free previous argument */ |
| 142 |
– |
args_info->latticeCnst_orig = 0; |
| 143 |
– |
} |
| 144 |
– |
if (args_info->radius_orig) |
| 145 |
– |
{ |
| 146 |
– |
free (args_info->radius_orig); /* free previous argument */ |
| 147 |
– |
args_info->radius_orig = 0; |
| 148 |
– |
} |
| 149 |
– |
if (args_info->ShellRadius_arg) |
| 150 |
– |
{ |
| 151 |
– |
for (i = 0; i < args_info->ShellRadius_given; ++i) |
| 152 |
– |
{ |
| 153 |
– |
if (args_info->ShellRadius_orig [i]) |
| 154 |
– |
{ |
| 155 |
– |
free (args_info->ShellRadius_orig [i]); /* free previous argument */ |
| 156 |
– |
args_info->ShellRadius_orig [i] = 0; |
| 157 |
– |
} |
| 158 |
– |
} |
| 159 |
– |
free (args_info->ShellRadius_arg); /* free previous argument */ |
| 160 |
– |
args_info->ShellRadius_arg = 0; |
| 161 |
– |
free (args_info->ShellRadius_orig); /* free previous argument */ |
| 162 |
– |
args_info->ShellRadius_orig = 0; |
| 163 |
– |
} |
| 123 |
|
if (args_info->molFraction_arg) |
| 124 |
|
{ |
| 166 |
– |
for (i = 0; i < args_info->molFraction_given; ++i) |
| 167 |
– |
{ |
| 168 |
– |
if (args_info->molFraction_orig [i]) |
| 169 |
– |
{ |
| 170 |
– |
free (args_info->molFraction_orig [i]); /* free previous argument */ |
| 171 |
– |
args_info->molFraction_orig [i] = 0; |
| 172 |
– |
} |
| 173 |
– |
} |
| 125 |
|
free (args_info->molFraction_arg); /* free previous argument */ |
| 126 |
|
args_info->molFraction_arg = 0; |
| 176 |
– |
free (args_info->molFraction_orig); /* free previous argument */ |
| 177 |
– |
args_info->molFraction_orig = 0; |
| 127 |
|
} |
| 179 |
– |
if (args_info->vacancyPCT_orig) |
| 180 |
– |
{ |
| 181 |
– |
free (args_info->vacancyPCT_orig); /* free previous argument */ |
| 182 |
– |
args_info->vacancyPCT_orig = 0; |
| 183 |
– |
} |
| 184 |
– |
if (args_info->vacancyRadius_arg) |
| 185 |
– |
{ |
| 186 |
– |
for (i = 0; i < args_info->vacancyRadius_given; ++i) |
| 187 |
– |
{ |
| 188 |
– |
if (args_info->vacancyRadius_orig [i]) |
| 189 |
– |
{ |
| 190 |
– |
free (args_info->vacancyRadius_orig [i]); /* free previous argument */ |
| 191 |
– |
args_info->vacancyRadius_orig [i] = 0; |
| 192 |
– |
} |
| 193 |
– |
} |
| 194 |
– |
free (args_info->vacancyRadius_arg); /* free previous argument */ |
| 195 |
– |
args_info->vacancyRadius_arg = 0; |
| 196 |
– |
free (args_info->vacancyRadius_orig); /* free previous argument */ |
| 197 |
– |
args_info->vacancyRadius_orig = 0; |
| 198 |
– |
} |
| 128 |
|
|
| 129 |
|
for (i = 0; i < args_info->inputs_num; ++i) |
| 130 |
|
free (args_info->inputs [i]); |
| 135 |
|
clear_given (args_info); |
| 136 |
|
} |
| 137 |
|
|
| 209 |
– |
int |
| 210 |
– |
cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) |
| 211 |
– |
{ |
| 212 |
– |
FILE *outfile; |
| 213 |
– |
int i = 0; |
| 214 |
– |
|
| 215 |
– |
outfile = fopen(filename, "w"); |
| 216 |
– |
|
| 217 |
– |
if (!outfile) |
| 218 |
– |
{ |
| 219 |
– |
fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename); |
| 220 |
– |
return EXIT_FAILURE; |
| 221 |
– |
} |
| 222 |
– |
|
| 223 |
– |
if (args_info->help_given) { |
| 224 |
– |
fprintf(outfile, "%s\n", "help"); |
| 225 |
– |
} |
| 226 |
– |
if (args_info->version_given) { |
| 227 |
– |
fprintf(outfile, "%s\n", "version"); |
| 228 |
– |
} |
| 229 |
– |
if (args_info->output_given) { |
| 230 |
– |
if (args_info->output_orig) { |
| 231 |
– |
fprintf(outfile, "%s=\"%s\"\n", "output", args_info->output_orig); |
| 232 |
– |
} else { |
| 233 |
– |
fprintf(outfile, "%s\n", "output"); |
| 234 |
– |
} |
| 235 |
– |
} |
| 236 |
– |
if (args_info->latticeCnst_given) { |
| 237 |
– |
if (args_info->latticeCnst_orig) { |
| 238 |
– |
fprintf(outfile, "%s=\"%s\"\n", "latticeCnst", args_info->latticeCnst_orig); |
| 239 |
– |
} else { |
| 240 |
– |
fprintf(outfile, "%s\n", "latticeCnst"); |
| 241 |
– |
} |
| 242 |
– |
} |
| 243 |
– |
if (args_info->radius_given) { |
| 244 |
– |
if (args_info->radius_orig) { |
| 245 |
– |
fprintf(outfile, "%s=\"%s\"\n", "radius", args_info->radius_orig); |
| 246 |
– |
} else { |
| 247 |
– |
fprintf(outfile, "%s\n", "radius"); |
| 248 |
– |
} |
| 249 |
– |
} |
| 250 |
– |
if (args_info->ShellRadius_orig) |
| 251 |
– |
{ |
| 252 |
– |
for (i = 0; i < args_info->ShellRadius_given; ++i) |
| 253 |
– |
{ |
| 254 |
– |
if (args_info->ShellRadius_orig [i]) |
| 255 |
– |
{ |
| 256 |
– |
fprintf(outfile, "%s=\"%s\"\n", "ShellRadius", args_info->ShellRadius_orig [i]); |
| 257 |
– |
} |
| 258 |
– |
} |
| 259 |
– |
} |
| 260 |
– |
if (args_info->molFraction_orig) |
| 261 |
– |
{ |
| 262 |
– |
for (i = 0; i < args_info->molFraction_given; ++i) |
| 263 |
– |
{ |
| 264 |
– |
if (args_info->molFraction_orig [i]) |
| 265 |
– |
{ |
| 266 |
– |
fprintf(outfile, "%s=\"%s\"\n", "molFraction", args_info->molFraction_orig [i]); |
| 267 |
– |
} |
| 268 |
– |
} |
| 269 |
– |
} |
| 270 |
– |
if (args_info->vacancyPCT_given) { |
| 271 |
– |
if (args_info->vacancyPCT_orig) { |
| 272 |
– |
fprintf(outfile, "%s=\"%s\"\n", "vacancyPCT", args_info->vacancyPCT_orig); |
| 273 |
– |
} else { |
| 274 |
– |
fprintf(outfile, "%s\n", "vacancyPCT"); |
| 275 |
– |
} |
| 276 |
– |
} |
| 277 |
– |
if (args_info->vacancyRadius_orig) |
| 278 |
– |
{ |
| 279 |
– |
for (i = 0; i < args_info->vacancyRadius_given; ++i) |
| 280 |
– |
{ |
| 281 |
– |
if (args_info->vacancyRadius_orig [i]) |
| 282 |
– |
{ |
| 283 |
– |
fprintf(outfile, "%s=\"%s\"\n", "vacancyRadius", args_info->vacancyRadius_orig [i]); |
| 284 |
– |
} |
| 285 |
– |
} |
| 286 |
– |
} |
| 287 |
– |
|
| 288 |
– |
fclose (outfile); |
| 289 |
– |
|
| 290 |
– |
i = EXIT_SUCCESS; |
| 291 |
– |
return i; |
| 292 |
– |
} |
| 293 |
– |
|
| 294 |
– |
void |
| 295 |
– |
cmdline_parser_free (struct gengetopt_args_info *args_info) |
| 296 |
– |
{ |
| 297 |
– |
cmdline_parser_release (args_info); |
| 298 |
– |
} |
| 299 |
– |
|
| 300 |
– |
|
| 138 |
|
/* gengetopt_strdup() */ |
| 139 |
|
/* strdup.c replacement of strdup, which is not standard */ |
| 140 |
|
char * |
| 203 |
|
|
| 204 |
|
result = cmdline_parser_internal (argc, argv, args_info, override, initialize, check_required, NULL); |
| 205 |
|
|
| 369 |
– |
if (result == EXIT_FAILURE) |
| 370 |
– |
{ |
| 371 |
– |
cmdline_parser_free (args_info); |
| 372 |
– |
exit (EXIT_FAILURE); |
| 373 |
– |
} |
| 374 |
– |
|
| 206 |
|
return result; |
| 207 |
|
} |
| 208 |
|
|
| 214 |
|
if (cmdline_parser_required2(args_info, prog_name, NULL) > 0) |
| 215 |
|
result = EXIT_FAILURE; |
| 216 |
|
|
| 386 |
– |
if (result == EXIT_FAILURE) |
| 387 |
– |
{ |
| 388 |
– |
cmdline_parser_free (args_info); |
| 389 |
– |
exit (EXIT_FAILURE); |
| 390 |
– |
} |
| 391 |
– |
|
| 217 |
|
return result; |
| 218 |
|
} |
| 219 |
|
|
| 222 |
|
{ |
| 223 |
|
int error = 0; |
| 224 |
|
|
| 225 |
< |
if (! args_info->latticeCnst_given) |
| 225 |
> |
if (! args_info->output_given) |
| 226 |
|
{ |
| 227 |
< |
fprintf (stderr, "%s: '--latticeCnst' option required%s\n", prog_name, (additional_error ? additional_error : "")); |
| 227 |
> |
fprintf (stderr, "%s: '--output' ('-o') option required%s\n", prog_name, (additional_error ? additional_error : "")); |
| 228 |
|
error = 1; |
| 229 |
|
} |
| 230 |
+ |
if (! args_info->latticeConstant_given) |
| 231 |
+ |
{ |
| 232 |
+ |
fprintf (stderr, "%s: '--latticeConstant' option required%s\n", prog_name, (additional_error ? additional_error : "")); |
| 233 |
+ |
error = 1; |
| 234 |
+ |
} |
| 235 |
|
if (! args_info->radius_given) |
| 236 |
|
{ |
| 237 |
|
fprintf (stderr, "%s: '--radius' option required%s\n", prog_name, (additional_error ? additional_error : "")); |
| 249 |
|
|
| 250 |
|
int i; /* Counter */ |
| 251 |
|
|
| 252 |
< |
struct ShellRadius_list * ShellRadius_list = NULL,* ShellRadius_new = NULL; |
| 252 |
> |
struct shellRadius_list * shellRadius_list = NULL,* shellRadius_new = NULL; |
| 253 |
|
struct molFraction_list * molFraction_list = NULL,* molFraction_new = NULL; |
| 424 |
– |
struct vacancyRadius_list * vacancyRadius_list = NULL,* vacancyRadius_new = NULL; |
| 254 |
|
int error = 0; |
| 255 |
|
struct gengetopt_args_info local_args_info; |
| 256 |
|
|
| 273 |
|
{ "help", 0, NULL, 'h' }, |
| 274 |
|
{ "version", 0, NULL, 'V' }, |
| 275 |
|
{ "output", 1, NULL, 'o' }, |
| 276 |
< |
{ "latticeCnst", 1, NULL, 0 }, |
| 276 |
> |
{ "latticeConstant", 1, NULL, 0 }, |
| 277 |
|
{ "radius", 1, NULL, 0 }, |
| 278 |
< |
{ "ShellRadius", 1, NULL, 0 }, |
| 278 |
> |
{ "shellRadius", 1, NULL, 0 }, |
| 279 |
|
{ "molFraction", 1, NULL, 0 }, |
| 280 |
< |
{ "vacancyPCT", 1, NULL, 0 }, |
| 281 |
< |
{ "vacancyRadius", 1, NULL, 0 }, |
| 280 |
> |
{ "vacancyPercent", 1, NULL, 0 }, |
| 281 |
> |
{ "vacancyInnerRadius", 1, NULL, 0 }, |
| 282 |
> |
{ "vacancyOuterRadius", 1, NULL, 0 }, |
| 283 |
|
{ NULL, 0, NULL, 0 } |
| 284 |
|
}; |
| 285 |
|
|
| 313 |
|
if (args_info->output_arg) |
| 314 |
|
free (args_info->output_arg); /* free previous string */ |
| 315 |
|
args_info->output_arg = gengetopt_strdup (optarg); |
| 486 |
– |
if (args_info->output_orig) |
| 487 |
– |
free (args_info->output_orig); /* free previous string */ |
| 488 |
– |
args_info->output_orig = gengetopt_strdup (optarg); |
| 316 |
|
break; |
| 317 |
|
|
| 318 |
|
|
| 319 |
|
case 0: /* Long option with no short option */ |
| 320 |
|
/* Lattice spacing in Angstroms for cubic lattice.. */ |
| 321 |
< |
if (strcmp (long_options[option_index].name, "latticeCnst") == 0) |
| 321 |
> |
if (strcmp (long_options[option_index].name, "latticeConstant") == 0) |
| 322 |
|
{ |
| 323 |
< |
if (local_args_info.latticeCnst_given) |
| 323 |
> |
if (local_args_info.latticeConstant_given) |
| 324 |
|
{ |
| 325 |
< |
fprintf (stderr, "%s: `--latticeCnst' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
| 325 |
> |
fprintf (stderr, "%s: `--latticeConstant' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
| 326 |
|
goto failure; |
| 327 |
|
} |
| 328 |
< |
if (args_info->latticeCnst_given && ! override) |
| 328 |
> |
if (args_info->latticeConstant_given && ! override) |
| 329 |
|
continue; |
| 330 |
< |
local_args_info.latticeCnst_given = 1; |
| 331 |
< |
args_info->latticeCnst_given = 1; |
| 332 |
< |
args_info->latticeCnst_arg = strtod (optarg, &stop_char); |
| 506 |
< |
if (!(stop_char && *stop_char == '\0')) { |
| 507 |
< |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
| 508 |
< |
goto failure; |
| 509 |
< |
} |
| 510 |
< |
if (args_info->latticeCnst_orig) |
| 511 |
< |
free (args_info->latticeCnst_orig); /* free previous string */ |
| 512 |
< |
args_info->latticeCnst_orig = gengetopt_strdup (optarg); |
| 330 |
> |
local_args_info.latticeConstant_given = 1; |
| 331 |
> |
args_info->latticeConstant_given = 1; |
| 332 |
> |
args_info->latticeConstant_arg = strtod (optarg, NULL); |
| 333 |
|
} |
| 334 |
|
/* Nanoparticle radius in Angstroms. */ |
| 335 |
|
else if (strcmp (long_options[option_index].name, "radius") == 0) |
| 343 |
|
continue; |
| 344 |
|
local_args_info.radius_given = 1; |
| 345 |
|
args_info->radius_given = 1; |
| 346 |
< |
args_info->radius_arg = strtod (optarg, &stop_char); |
| 527 |
< |
if (!(stop_char && *stop_char == '\0')) { |
| 528 |
< |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
| 529 |
< |
goto failure; |
| 530 |
< |
} |
| 531 |
< |
if (args_info->radius_orig) |
| 532 |
< |
free (args_info->radius_orig); /* free previous string */ |
| 533 |
< |
args_info->radius_orig = gengetopt_strdup (optarg); |
| 346 |
> |
args_info->radius_arg = strtod (optarg, NULL); |
| 347 |
|
} |
| 348 |
< |
/* Radius from the center of the particle to start a new shell in multi-component core-shell particle. Specified for each component > 1 in md file.. */ |
| 349 |
< |
else if (strcmp (long_options[option_index].name, "ShellRadius") == 0) |
| 348 |
> |
/* Radius containing within it only molecules of a specific component. Specified for each component > 1 in the template file.. */ |
| 349 |
> |
else if (strcmp (long_options[option_index].name, "shellRadius") == 0) |
| 350 |
|
{ |
| 351 |
< |
local_args_info.ShellRadius_given++; |
| 351 |
> |
local_args_info.shellRadius_given++; |
| 352 |
|
|
| 353 |
|
multi_token = get_multiple_arg_token(optarg); |
| 354 |
|
multi_next = get_multiple_arg_token_next (optarg); |
| 355 |
|
|
| 356 |
|
while (1) |
| 357 |
|
{ |
| 358 |
< |
ShellRadius_new = (struct ShellRadius_list *) malloc (sizeof (struct ShellRadius_list)); |
| 359 |
< |
ShellRadius_new->next = ShellRadius_list; |
| 360 |
< |
ShellRadius_list = ShellRadius_new; |
| 361 |
< |
ShellRadius_new->ShellRadius_arg = strtod (multi_token, &stop_char); |
| 362 |
< |
if (!(stop_char && *stop_char == '\0')) { |
| 550 |
< |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], multi_token); |
| 551 |
< |
goto failure; |
| 552 |
< |
} |
| 553 |
< |
ShellRadius_new->ShellRadius_orig = multi_token; |
| 358 |
> |
shellRadius_new = (struct shellRadius_list *) malloc (sizeof (struct shellRadius_list)); |
| 359 |
> |
shellRadius_new->next = shellRadius_list; |
| 360 |
> |
shellRadius_list = shellRadius_new; |
| 361 |
> |
shellRadius_new->shellRadius_arg = strtod (multi_token, NULL); |
| 362 |
> |
free (multi_token); |
| 363 |
|
|
| 364 |
|
if (multi_next) |
| 365 |
|
{ |
| 366 |
|
multi_token = get_multiple_arg_token(multi_next); |
| 367 |
|
multi_next = get_multiple_arg_token_next (multi_next); |
| 368 |
< |
local_args_info.ShellRadius_given++; |
| 368 |
> |
local_args_info.shellRadius_given++; |
| 369 |
|
} |
| 370 |
|
else |
| 371 |
|
break; |
| 372 |
|
} |
| 373 |
|
break; |
| 374 |
|
} |
| 375 |
< |
/* (Default) Builds a multi-component random mixed nanoparticle. Mole Fraction must be specified for each componet > 1 in MD file.. */ |
| 375 |
> |
/* Builds a multi-component random alloy nanoparticle. A mole Fraction must be specified for each component > 1 in the template file.. */ |
| 376 |
|
else if (strcmp (long_options[option_index].name, "molFraction") == 0) |
| 377 |
|
{ |
| 378 |
|
local_args_info.molFraction_given++; |
| 385 |
|
molFraction_new = (struct molFraction_list *) malloc (sizeof (struct molFraction_list)); |
| 386 |
|
molFraction_new->next = molFraction_list; |
| 387 |
|
molFraction_list = molFraction_new; |
| 388 |
< |
molFraction_new->molFraction_arg = strtod (multi_token, &stop_char); |
| 389 |
< |
if (!(stop_char && *stop_char == '\0')) { |
| 581 |
< |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], multi_token); |
| 582 |
< |
goto failure; |
| 583 |
< |
} |
| 584 |
< |
molFraction_new->molFraction_orig = multi_token; |
| 388 |
> |
molFraction_new->molFraction_arg = strtod (multi_token, NULL); |
| 389 |
> |
free (multi_token); |
| 390 |
|
|
| 391 |
|
if (multi_next) |
| 392 |
|
{ |
| 399 |
|
} |
| 400 |
|
break; |
| 401 |
|
} |
| 402 |
< |
/* Percentage of vacancies to build. */ |
| 403 |
< |
else if (strcmp (long_options[option_index].name, "vacancyPCT") == 0) |
| 402 |
> |
/* Percentage of atoms to remove from within vacancy range. */ |
| 403 |
> |
else if (strcmp (long_options[option_index].name, "vacancyPercent") == 0) |
| 404 |
|
{ |
| 405 |
< |
if (local_args_info.vacancyPCT_given) |
| 405 |
> |
if (local_args_info.vacancyPercent_given) |
| 406 |
|
{ |
| 407 |
< |
fprintf (stderr, "%s: `--vacancyPCT' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
| 407 |
> |
fprintf (stderr, "%s: `--vacancyPercent' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
| 408 |
|
goto failure; |
| 409 |
|
} |
| 410 |
< |
if (args_info->vacancyPCT_given && ! override) |
| 410 |
> |
if (args_info->vacancyPercent_given && ! override) |
| 411 |
|
continue; |
| 412 |
< |
local_args_info.vacancyPCT_given = 1; |
| 413 |
< |
args_info->vacancyPCT_given = 1; |
| 414 |
< |
args_info->vacancyPCT_arg = strtod (optarg, &stop_char); |
| 610 |
< |
if (!(stop_char && *stop_char == '\0')) { |
| 611 |
< |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
| 612 |
< |
goto failure; |
| 613 |
< |
} |
| 614 |
< |
if (args_info->vacancyPCT_orig) |
| 615 |
< |
free (args_info->vacancyPCT_orig); /* free previous string */ |
| 616 |
< |
args_info->vacancyPCT_orig = gengetopt_strdup (optarg); |
| 412 |
> |
local_args_info.vacancyPercent_given = 1; |
| 413 |
> |
args_info->vacancyPercent_given = 1; |
| 414 |
> |
args_info->vacancyPercent_arg = strtod (optarg, NULL); |
| 415 |
|
} |
| 416 |
|
/* Radius arround core-shell where vacancies should be located.. */ |
| 417 |
< |
else if (strcmp (long_options[option_index].name, "vacancyRadius") == 0) |
| 417 |
> |
else if (strcmp (long_options[option_index].name, "vacancyInnerRadius") == 0) |
| 418 |
|
{ |
| 419 |
< |
local_args_info.vacancyRadius_given++; |
| 622 |
< |
|
| 623 |
< |
multi_token = get_multiple_arg_token(optarg); |
| 624 |
< |
multi_next = get_multiple_arg_token_next (optarg); |
| 625 |
< |
|
| 626 |
< |
while (1) |
| 419 |
> |
if (local_args_info.vacancyInnerRadius_given) |
| 420 |
|
{ |
| 421 |
< |
vacancyRadius_new = (struct vacancyRadius_list *) malloc (sizeof (struct vacancyRadius_list)); |
| 422 |
< |
vacancyRadius_new->next = vacancyRadius_list; |
| 630 |
< |
vacancyRadius_list = vacancyRadius_new; |
| 631 |
< |
vacancyRadius_new->vacancyRadius_arg = strtod (multi_token, &stop_char); |
| 632 |
< |
if (!(stop_char && *stop_char == '\0')) { |
| 633 |
< |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], multi_token); |
| 634 |
< |
goto failure; |
| 635 |
< |
} |
| 636 |
< |
vacancyRadius_new->vacancyRadius_orig = multi_token; |
| 637 |
< |
|
| 638 |
< |
if (multi_next) |
| 639 |
< |
{ |
| 640 |
< |
multi_token = get_multiple_arg_token(multi_next); |
| 641 |
< |
multi_next = get_multiple_arg_token_next (multi_next); |
| 642 |
< |
local_args_info.vacancyRadius_given++; |
| 643 |
< |
} |
| 644 |
< |
else |
| 645 |
< |
break; |
| 421 |
> |
fprintf (stderr, "%s: `--vacancyInnerRadius' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
| 422 |
> |
goto failure; |
| 423 |
|
} |
| 424 |
< |
break; |
| 424 |
> |
if (args_info->vacancyInnerRadius_given && ! override) |
| 425 |
> |
continue; |
| 426 |
> |
local_args_info.vacancyInnerRadius_given = 1; |
| 427 |
> |
args_info->vacancyInnerRadius_given = 1; |
| 428 |
> |
args_info->vacancyInnerRadius_arg = strtod (optarg, NULL); |
| 429 |
|
} |
| 430 |
+ |
/* Radius arround core-shell where vacancies should be located.. */ |
| 431 |
+ |
else if (strcmp (long_options[option_index].name, "vacancyOuterRadius") == 0) |
| 432 |
+ |
{ |
| 433 |
+ |
if (local_args_info.vacancyOuterRadius_given) |
| 434 |
+ |
{ |
| 435 |
+ |
fprintf (stderr, "%s: `--vacancyOuterRadius' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
| 436 |
+ |
goto failure; |
| 437 |
+ |
} |
| 438 |
+ |
if (args_info->vacancyOuterRadius_given && ! override) |
| 439 |
+ |
continue; |
| 440 |
+ |
local_args_info.vacancyOuterRadius_given = 1; |
| 441 |
+ |
args_info->vacancyOuterRadius_given = 1; |
| 442 |
+ |
args_info->vacancyOuterRadius_arg = strtod (optarg, NULL); |
| 443 |
+ |
} |
| 444 |
|
|
| 445 |
|
break; |
| 446 |
|
case '?': /* Invalid option. */ |
| 454 |
|
} /* while */ |
| 455 |
|
|
| 456 |
|
|
| 457 |
< |
if (local_args_info.ShellRadius_given && ShellRadius_list) |
| 457 |
> |
if (local_args_info.shellRadius_given && shellRadius_list) |
| 458 |
|
{ |
| 459 |
< |
struct ShellRadius_list *tmp; |
| 460 |
< |
args_info->ShellRadius_arg = (double *) realloc (args_info->ShellRadius_arg, (args_info->ShellRadius_given + local_args_info.ShellRadius_given) * sizeof (double)); |
| 461 |
< |
args_info->ShellRadius_orig = (char **) realloc (args_info->ShellRadius_orig, (args_info->ShellRadius_given + local_args_info.ShellRadius_given) * sizeof (char *)); |
| 667 |
< |
for (i = (local_args_info.ShellRadius_given - 1); i >= 0; --i) |
| 459 |
> |
struct shellRadius_list *tmp; |
| 460 |
> |
args_info->shellRadius_arg = (double *) realloc (args_info->shellRadius_arg, (args_info->shellRadius_given + local_args_info.shellRadius_given) * sizeof (double)); |
| 461 |
> |
for (i = (local_args_info.shellRadius_given - 1); i >= 0; --i) |
| 462 |
|
{ |
| 463 |
< |
tmp = ShellRadius_list; |
| 464 |
< |
args_info->ShellRadius_arg [i + args_info->ShellRadius_given] = ShellRadius_list->ShellRadius_arg; |
| 465 |
< |
args_info->ShellRadius_orig [i + args_info->ShellRadius_given] = ShellRadius_list->ShellRadius_orig; |
| 672 |
< |
ShellRadius_list = ShellRadius_list->next; |
| 463 |
> |
tmp = shellRadius_list; |
| 464 |
> |
args_info->shellRadius_arg [i + args_info->shellRadius_given] = shellRadius_list->shellRadius_arg; |
| 465 |
> |
shellRadius_list = shellRadius_list->next; |
| 466 |
|
free (tmp); |
| 467 |
|
} |
| 468 |
|
} |
| 471 |
|
{ |
| 472 |
|
struct molFraction_list *tmp; |
| 473 |
|
args_info->molFraction_arg = (double *) realloc (args_info->molFraction_arg, (args_info->molFraction_given + local_args_info.molFraction_given) * sizeof (double)); |
| 681 |
– |
args_info->molFraction_orig = (char **) realloc (args_info->molFraction_orig, (args_info->molFraction_given + local_args_info.molFraction_given) * sizeof (char *)); |
| 474 |
|
for (i = (local_args_info.molFraction_given - 1); i >= 0; --i) |
| 475 |
|
{ |
| 476 |
|
tmp = molFraction_list; |
| 477 |
|
args_info->molFraction_arg [i + args_info->molFraction_given] = molFraction_list->molFraction_arg; |
| 686 |
– |
args_info->molFraction_orig [i + args_info->molFraction_given] = molFraction_list->molFraction_orig; |
| 478 |
|
molFraction_list = molFraction_list->next; |
| 479 |
|
free (tmp); |
| 480 |
|
} |
| 481 |
|
} |
| 482 |
|
|
| 692 |
– |
if (local_args_info.vacancyRadius_given && vacancyRadius_list) |
| 693 |
– |
{ |
| 694 |
– |
struct vacancyRadius_list *tmp; |
| 695 |
– |
args_info->vacancyRadius_arg = (double *) realloc (args_info->vacancyRadius_arg, (args_info->vacancyRadius_given + local_args_info.vacancyRadius_given) * sizeof (double)); |
| 696 |
– |
args_info->vacancyRadius_orig = (char **) realloc (args_info->vacancyRadius_orig, (args_info->vacancyRadius_given + local_args_info.vacancyRadius_given) * sizeof (char *)); |
| 697 |
– |
for (i = (local_args_info.vacancyRadius_given - 1); i >= 0; --i) |
| 698 |
– |
{ |
| 699 |
– |
tmp = vacancyRadius_list; |
| 700 |
– |
args_info->vacancyRadius_arg [i + args_info->vacancyRadius_given] = vacancyRadius_list->vacancyRadius_arg; |
| 701 |
– |
args_info->vacancyRadius_orig [i + args_info->vacancyRadius_given] = vacancyRadius_list->vacancyRadius_orig; |
| 702 |
– |
vacancyRadius_list = vacancyRadius_list->next; |
| 703 |
– |
free (tmp); |
| 704 |
– |
} |
| 705 |
– |
} |
| 706 |
– |
|
| 483 |
|
|
| 484 |
< |
args_info->ShellRadius_given += local_args_info.ShellRadius_given; |
| 485 |
< |
local_args_info.ShellRadius_given = 0; |
| 484 |
> |
args_info->shellRadius_given += local_args_info.shellRadius_given; |
| 485 |
> |
local_args_info.shellRadius_given = 0; |
| 486 |
|
args_info->molFraction_given += local_args_info.molFraction_given; |
| 487 |
|
local_args_info.molFraction_given = 0; |
| 712 |
– |
args_info->vacancyRadius_given += local_args_info.vacancyRadius_given; |
| 713 |
– |
local_args_info.vacancyRadius_given = 0; |
| 488 |
|
|
| 489 |
|
if (check_required) |
| 490 |
|
{ |
| 491 |
|
error += cmdline_parser_required2 (args_info, argv[0], additional_error); |
| 492 |
|
} |
| 493 |
|
|
| 494 |
< |
cmdline_parser_release (&local_args_info); |
| 494 |
> |
cmdline_parser_free (&local_args_info); |
| 495 |
|
|
| 496 |
|
if ( error ) |
| 497 |
|
return (EXIT_FAILURE); |
| 510 |
|
return 0; |
| 511 |
|
|
| 512 |
|
failure: |
| 513 |
< |
if (ShellRadius_list) |
| 513 |
> |
if (shellRadius_list) |
| 514 |
|
{ |
| 515 |
< |
struct ShellRadius_list *tmp; |
| 516 |
< |
while (ShellRadius_list) |
| 515 |
> |
struct shellRadius_list *tmp; |
| 516 |
> |
while (shellRadius_list) |
| 517 |
|
{ |
| 518 |
< |
tmp = ShellRadius_list; |
| 519 |
< |
free (ShellRadius_list->ShellRadius_orig); |
| 746 |
< |
ShellRadius_list = ShellRadius_list->next; |
| 518 |
> |
tmp = shellRadius_list; |
| 519 |
> |
shellRadius_list = shellRadius_list->next; |
| 520 |
|
free (tmp); |
| 521 |
|
} |
| 522 |
|
} |
| 526 |
|
while (molFraction_list) |
| 527 |
|
{ |
| 528 |
|
tmp = molFraction_list; |
| 756 |
– |
free (molFraction_list->molFraction_orig); |
| 529 |
|
molFraction_list = molFraction_list->next; |
| 530 |
|
free (tmp); |
| 531 |
|
} |
| 532 |
|
} |
| 761 |
– |
if (vacancyRadius_list) |
| 762 |
– |
{ |
| 763 |
– |
struct vacancyRadius_list *tmp; |
| 764 |
– |
while (vacancyRadius_list) |
| 765 |
– |
{ |
| 766 |
– |
tmp = vacancyRadius_list; |
| 767 |
– |
free (vacancyRadius_list->vacancyRadius_orig); |
| 768 |
– |
vacancyRadius_list = vacancyRadius_list->next; |
| 769 |
– |
free (tmp); |
| 770 |
– |
} |
| 771 |
– |
} |
| 533 |
|
|
| 534 |
< |
cmdline_parser_release (&local_args_info); |
| 534 |
> |
cmdline_parser_free (&local_args_info); |
| 535 |
|
return (EXIT_FAILURE); |
| 536 |
|
} |