Loading...
Searching...
No Matches
record_and_export.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * write_and_export_interpolation_record() — the single call the NSCF flavor
5 * makes once it has built a record.
6 *
7 * Two things, in this order: the native record goes to
8 * `<outdir>/<prefix>.save/interpolation.q3ip`, always, because it is what
9 * `q3_utility interpolate` evaluates and what `q3_utility convert` re-exports; then
10 * each format `control.interpolation.export_formats` lists is written beside
11 * it as `<outdir>/<prefix>.*`. Unlike the mean-field export, the record is
12 * not an optional by-product here -- it IS the output of the step -- so a
13 * failure to write it propagates instead of being logged.
14 */
15
16#include <filesystem>
17#include <string>
18
19#include "io/input/data.hpp"
22#include "io/logger.hpp"
24
25namespace q3 {
26
27/// Where a run with `prefix` in `output_directory` keeps its interpolation record.
28[[nodiscard]] inline std::string interpolation_record_path(const std::string& output_directory,
29 const std::string& prefix) {
30 return output_directory + "/" + prefix + ".save/interpolation.q3ip";
31}
32
34 const InputData& input) {
35 std::filesystem::create_directories(input.output_directory + "/" + input.prefix + ".save");
36 const std::string record_path = interpolation_record_path(input.output_directory, input.prefix);
37 write_interpolation_record(record, record_path);
38 log::info(" Wrote interpolation record ({}): {}", record.method, record_path);
39
40 for (const std::string& format : input.interpolation.export_formats) {
41 create_interpolation_exporter(format)->export_to_directory(
42 record, input.output_directory, input.prefix);
43 }
44}
45
46} // namespace q3
void info(spdlog::format_string_t< Args... > fmt, Args &&... args)
Definition logger.hpp:183
void write_interpolation_record(const InterpolationRecord &record, const std::string &file_path)
std::string interpolation_record_path(const std::string &output_directory, const std::string &prefix)
Where a run with prefix in output_directory keeps its interpolation record.
void write_and_export_interpolation_record(const InterpolationRecord &record, const InputData &input)
std::unique_ptr< InterpolationExporter > create_interpolation_exporter(const std::string &format)
Definition factory.hpp:21
Parsed input data — holds raw values read from input files.
Definition data.hpp:27
std::string prefix
Definition data.hpp:178
InterpolationSpecification interpolation
Definition data.hpp:248
std::string output_directory
Definition data.hpp:177
std::string method
The method that built the payload: "wannier".
Definition record.hpp:31
std::vector< std::string > export_formats
Interoperability formats to write beside the native record ("wannier90").