34 std::string identity = binary_name +
" " + std::string(
q3::version);
36 return identity +
" (commit unknown: built from a modified tree or without git)";
38 return identity +
" (" + std::string(
q3::commit) +
")";
51 addons += (addons.empty() ?
"" :
", ") + std::string(addon.name) +
" " + addon.version;
63 std::string descriptions;
64 for (std::size_t index = 0; index < formats.size(); index++) {
66 descriptions += index + 1 == formats.size() ?
", or " :
", ";
67 descriptions += formats[index]->display_name();
141 log::error(
"Usage: {} [input] [--format {}] [--material <file>] [--check]",
144 log::error(
" [--pools <n>] [--distribute-bands] [--precision double|mixed]");
145 log::error(
" [--log-level <level>] [--log-file <path>] [--version]");
147 log::error(
" --material <file> run the input at this ESSE structure (cell, positions)");
148 log::error(
" --check read the input, report it, and run nothing");
149 log::error(
" --pools <n> k-point pools (MPI binaries)");
150 log::error(
" --distribute-bands split bands, not reciprocal space, in a pool (MPI)");
151 log::error(
" --precision <mode> double or mixed (GPU binaries)");
152 log::error(
" --log-file <path> also log to a file (MPI rank N writes <path>.N)");
153 log::error(
" --version print the build identity and exit");
178 for (
int argument_index = 1; argument_index < argc; ++argument_index) {
179 std::string argument(argv[argument_index]);
181 auto take_value = [&](
const char* flag_name) -> std::string {
182 if (argument_index + 1 >= argc) {
187 return argv[++argument_index];
190 if (argument ==
"--log-level") {
191 options.
log_level = take_value(
"--log-level");
192 }
else if (argument ==
"--log-file") {
193 options.
log_file = take_value(
"--log-file");
194 }
else if (argument ==
"--version" || argument ==
"-v") {
196 }
else if (argument ==
"--pools") {
199 }
else if (argument ==
"--distribute-bands") {
201 }
else if (argument ==
"--precision") {
202 options.
precision = take_value(
"--precision");
203 }
else if (argument ==
"--format") {
204 options.
format = take_value(
"--format");
205 }
else if (argument ==
"--material") {
207 }
else if (argument ==
"--check") {
209 }
else if (argument.rfind(
"--", 0) == 0) {
215 log::error(
"Unrecognized option {}", argument);
222 "Unexpected extra argument {} (input is already {})", argument, options.
input_file);
242 if (claiming_format ==
nullptr) {
244 throw std::runtime_error(
245 "no input given, and no input format claims the working directory");
248 log::info(
"No input given; found {} in the current directory",
262 std::string divider_line(80,
'=');
264 int left_padding = (78 -
static_cast<int>(label.length())) / 2;
265 int right_padding = 78 -
static_cast<int>(label.length()) - left_padding;
266 std::string banner_line =
267 "=" + std::string(left_padding,
' ') + label + std::string(right_padding,
' ') +
"=";
std::string input_format_choices()
The --format values every registered input format accepts, as usage text: <yaml|qe|....
std::string input_format_descriptions()
What a usage line says an input path may name: every registered format, in order.
std::string build_identity(const std::string &binary_name)
Options parse_options(int argc, char *argv[], const std::string &binary_name)
void print_version(const std::string &binary_name)
InputData read_input(Options &options, const std::string &binary_name)
void print_timestamped_banner(const std::string &label_prefix)
void print_usage(const std::string &binary_name)
void error(spdlog::format_string_t< Args... > fmt, Args &&... args)
void info(spdlog::format_string_t< Args... > fmt, Args &&... args)
void apply_verbosity(const std::string &verbosity, const std::string &explicit_log_level)
const std::vector< AddonIdentity > & active_addons()
The add-ons compiled into this build, in the order the build discovered them.
constexpr const char * commit
constexpr const char * version
void substitute_material(InputData &input, const std::string &material_file)
InputData parse_input(const std::string &filename, const std::string &format="")
const InputFormat * format_claiming_directory(const std::filesystem::path &directory)
std::string get_iso_timestamp_with_timezone()
Registry< InputFormat > & input_format_registry()
The registry every entry point reads input formats from.
One add-on compiled into this build.
int number_of_kpoint_pools
Number of k-point pools (MPI binary only). 0 = execution policy default.
bool number_of_kpoint_pools_was_set
Whether --pools was present, so an input-file value can be honored otherwise.
std::string material_file
std::string log_level
Requested log level ("trace" ... "off"); empty means keep the default.