Loading...
Searching...
No Matches
init.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * MeanFieldExporter — abstract interface for mean-field data export formats.
5 *
6 * A "mean-field export" writes the converged Kohn-Sham wavefunctions, charge
7 * density, and (where supported) exchange-correlation potential to disk in a
8 * format consumed by an external many-body-perturbation-theory code (e.g.
9 * BerkeleyGW's Sigma/epsilon codes) rather than by Q3 itself. Concrete
10 * formats (BerkeleyGW today; other MBPT front ends are the natural future
11 * additions) implement this interface and are selected by name through
12 * create_mean_field_exporter() (factory.hpp), so orchestrators never branch
13 * on the format themselves -- "none" resolves to NullMeanFieldExporter
14 * (null.hpp), which is a silent no-op, removing the need for any if/else at
15 * the call sites (see layer_4_computation/flavors/{self_consistent_field,
16 * non_self_consistent_field}.hpp, both of which call export_to_directory()
17 * unconditionally).
18 */
19
20#include <string>
21
23
24namespace q3 {
25
27 public:
28 virtual ~MeanFieldExporter() = default;
29
30 /**
31 * Write this format's mean-field data files for `record` into `directory`
32 * (created if it does not already exist). A no-op for the Null exporter.
33 *
34 * Taking a MeanFieldRecord rather than a live SCF state is what lets the
35 * same writer serve both the in-process export and the standalone
36 * converter -- see io/mean_field_record/init.hpp.
37 */
38 virtual void export_to_directory(const MeanFieldRecord& record,
39 const std::string& directory) const = 0;
40
41 /// Format name as accepted by the input ("none", "berkeleygw", ...).
42 [[nodiscard]] virtual std::string name() const = 0;
43};
44
45} // namespace q3
virtual void export_to_directory(const MeanFieldRecord &record, const std::string &directory) const =0
virtual std::string name() const =0
Format name as accepted by the input ("none", "berkeleygw", ...).
virtual ~MeanFieldExporter()=default