Loading...
Searching...
No Matches
factory.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * NormConservingPlanewaveBasisFactory — creates NC or US pseudopotential basis.
5 */
6
7#include <memory>
8
14
15namespace q3 {
16
18 static std::unique_ptr<NormConservingPlanewaveBasis>
19 create(const Crystal& crystal_structure,
20 const PlanewaveBasis& planewave_basis,
21 const PseudopotentialSet& pseudopotential_set) {
22 // Capability, not type — see PseudopotentialSet::has_augmentation_charges().
23 bool needs_augmentation = pseudopotential_set.has_augmentation_charges();
24
25 std::unique_ptr<NormConservingPlanewaveBasis> basis;
26 if (needs_augmentation) {
27 basis = std::make_unique<UltrasoftPlanewaveBasis>();
28 } else {
29 basis = std::make_unique<NormConservingPlanewaveBasis>();
30 }
31 basis->init(crystal_structure, planewave_basis, pseudopotential_set);
32 return basis;
33 }
34};
35
36} // namespace q3
bool has_augmentation_charges() const
Definition set.hpp:129
static std::unique_ptr< NormConservingPlanewaveBasis > create(const Crystal &crystal_structure, const PlanewaveBasis &planewave_basis, const PseudopotentialSet &pseudopotential_set)
Definition factory.hpp:19