Loading...
Searching...
No Matches
qe_input_format.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * QEInputFormat — a Quantum ESPRESSO pw.x namelist input.
5 *
6 * Recognised by its extension, `.in` or `.qe`, the two spellings pw.x inputs
7 * are conventionally given.
8 */
9
10#include <filesystem>
11#include <memory>
12#include <string>
13#include <vector>
14
17
18namespace q3 {
19
20/// A pw.x namelist input, recognised by its `.in` or `.qe` extension.
21class QEInputFormat : public InputFormat {
22 public:
23 /// Ranked above the YAML fallback, below formats recognised by name or contents.
24 static constexpr int extension_detection_priority = 100;
25
26 /// "qe", and "espresso".
27 [[nodiscard]] std::vector<std::string> names() const override {
28 return {"qe", "espresso"};
29 }
30
31 /// How a log line names a pw.x input.
32 [[nodiscard]] std::string display_name() const override {
33 return "a Quantum ESPRESSO input";
34 }
35
36 /// extension_detection_priority: above the fallback, below name-based formats.
37 [[nodiscard]] int detection_priority() const override {
39 }
40
41 /// A file, not a directory, whose extension is `.in` or `.qe`.
42 [[nodiscard]] bool recognizes(const std::filesystem::path& path) const override {
43 if (std::filesystem::is_directory(path))
44 return false;
45 const std::string extension = path.extension().string();
46 return extension == ".in" || extension == ".qe";
47 }
48
49 /// A QEInputParser.
50 [[nodiscard]] std::unique_ptr<InputParser> create_parser() const override {
51 return std::make_unique<QEInputParser>();
52 }
53};
54
55} // namespace q3
One input format a run can be read from; see the file comment.
A pw.x namelist input, recognised by its .in or .qe extension.
int detection_priority() const override
extension_detection_priority: above the fallback, below name-based formats.
std::unique_ptr< InputParser > create_parser() const override
A QEInputParser.
std::vector< std::string > names() const override
"qe", and "espresso".
bool recognizes(const std::filesystem::path &path) const override
A file, not a directory, whose extension is .in or .qe.
static constexpr int extension_detection_priority
Ranked above the YAML fallback, below formats recognised by name or contents.
std::string display_name() const override
How a log line names a pw.x input.