44 const std::string& directory) {
50 const std::string record_path = directory +
"/" + input.
prefix +
".save/mean-field.q3mf";
53 log::info(
" Wrote mean-field record: {}", record_path);
54 }
catch (
const std::exception& error) {
55 log::warn(
" mean-field record not written ({}); the exported files above are "
56 "unaffected, but `q3_utility convert` will not be able to re-convert this run.",
101template <
typename RecordBuilder>
104 RecordBuilder&& build_record,
106 const std::string& directory) {
107 const bool one_rank_holds_the_complete_mean_field =
110 if (!one_rank_holds_the_complete_mean_field) {
111 const bool export_was_requested =
113 if (execution_policy.
is_root() && export_was_requested) {
114 log::error(
"mean_field_export is not supported under MPI: k-point pools hold only "
115 "their own k-points and band groups hold only a G-vector slab of each "
116 "band, so no rank sees the complete mean field. Nothing was exported. "
117 "Request it from a serial non_self_consistent_field run that restores "
118 "the checkpoint (written when every rank has its own k-point pool), or "
119 "run the calculation with a serial binary.");
virtual bool is_root() const =0
virtual bool one_process_owns_complete_state() const =0
void warn(spdlog::format_string_t< Args... > fmt, Args &&... args)
void error(spdlog::format_string_t< Args... > fmt, Args &&... args)
void info(spdlog::format_string_t< Args... > fmt, Args &&... args)
void export_and_record_mean_field(const MeanFieldRecord &record, const InputData &input, const std::string &directory)
void write_mean_field_record(const MeanFieldRecord &record, const std::string &file_path)
Serializes record to file_path. Throws on any write failure.
void export_and_record_mean_field_under_topology(const execution::PlanewaveExecutionPolicy &execution_policy, RecordBuilder &&build_record, const InputData &input, const std::string &directory)
std::unique_ptr< MeanFieldExporter > create_mean_field_exporter(const std::string &mean_field_export)