Loading...
Searching...
No Matches
factory.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * PlanewavePseudopotentialKohnShamSCFIteratorFactory — dispatch NC vs ultrasoft.
5 *
6 * Inspects the pseudopotential set to decide which concrete iterator to
7 * instantiate. The order matters: PAW is checked first because a PAW dataset
8 * also answers yes to `has_augmentation_charges()` — it is an ultrasoft
9 * dataset plus one-center data — so an augmentation-first test would route it
10 * to the ultrasoft iterator and silently drop every one-center term.
11 *
12 * Config-based creation path for integration tests. Production code should
13 * use create_kohn_sham_iterator(InputData) from the KS factory.
14 */
15
16#include <memory>
17
22
23namespace q3 {
24
25/**
26 * Create a planewave pseudopotential iterator from a pre-built config.
27 *
28 * The caller is responsible for the lifetimes of crystal_structure,
29 * kpoint_grid, and pseudopotential_set in the config.
30 */
31inline std::unique_ptr<PlanewavePseudopotentialKohnShamSCFIterator>
33 const auto* pseudopotential_set = config.pseudopotential_set;
34 if (pseudopotential_set->has_pseudopotential_type(
36 return std::make_unique<PawPlanewavePseudopotentialKohnShamSCFIterator>(std::move(config));
37 }
38 if (pseudopotential_set->has_augmentation_charges()) {
39 return std::make_unique<UltrasoftPlanewavePseudopotentialKohnShamSCFIterator>(
40 std::move(config));
41 }
42 return std::make_unique<PlanewavePseudopotentialKohnShamSCFIterator>(std::move(config));
43}
44
45} // namespace q3
std::unique_ptr< PlanewavePseudopotentialKohnShamSCFIterator > create_planewave_pseudopotential_iterator(KohnShamSCFIteratorConfig config)
Definition factory.hpp:32
const PseudopotentialSet * pseudopotential_set
Definition init.hpp:92