Loading...
Searching...
No Matches
factory.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * Factory for PlanewaveLocalOrbitalSet implementations.
5 *
6 * Resolves the one decision an input can make about local orbitals -- were
7 * explicit centres given, or not -- to a concrete set, so no consumer
8 * carries that branch. Empty `explicit_centers_crystal` selects the
9 * pseudopotentials' own atomic wavefunctions -- all of them, or the shells
10 * `trial_shells` names per species; a non-empty list places one hydrogenic
11 * s orbital of decay length `decay_length_bohr` at each centre.
12 *
13 * Mirrors create_isolated_system_correction_calculator(): adding a source
14 * of orbitals is one new class implementing PlanewaveLocalOrbitalSet plus
15 * one case here.
16 */
17
18#include <map>
19#include <memory>
20#include <string>
21#include <utility>
22#include <vector>
23
30
31namespace q3 {
32
33[[nodiscard]] inline std::unique_ptr<PlanewaveLocalOrbitalSet> create_planewave_local_orbital_set(
34 const Crystal& crystal_structure,
35 const PseudopotentialSet& pseudopotential_set,
36 const std::vector<Vector3D>& explicit_centers_crystal,
37 Real decay_length_bohr,
38 const std::map<std::string, std::vector<int>>& trial_shells = {}) {
39 if (explicit_centers_crystal.empty()) {
40 return std::make_unique<PlanewavePseudoAtomicOrbitalSet>(
41 crystal_structure, pseudopotential_set, trial_shells);
42 }
43 std::vector<HydrogenicOrbital> orbitals;
44 orbitals.reserve(explicit_centers_crystal.size());
45 for (const Vector3D& center : explicit_centers_crystal) {
46 orbitals.push_back({center, decay_length_bohr});
47 }
48 return std::make_unique<PlanewaveHydrogenicOrbitalSet>(std::move(orbitals));
49}
50
51} // namespace q3
double Real
std::unique_ptr< PlanewaveLocalOrbitalSet > create_planewave_local_orbital_set(const Crystal &crystal_structure, const PseudopotentialSet &pseudopotential_set, const std::vector< Vector3D > &explicit_centers_crystal, Real decay_length_bohr, const std::map< std::string, std::vector< int > > &trial_shells={})
Definition factory.hpp:33