Quantum 3xplorer (Q3)
An AI-native quantum simulation engine
Loading...
Searching...
No Matches
init.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * Pseudopotential base class.
5 *
6 * Base for all pseudopotential types (norm-conserving, ultrasoft).
7 * Contains common fields read from UPF files. Ultrasoft-specific fields
8 * live in UltrasoftPseudopotential (ultrasoft/init.hpp).
9 */
10
11#include <cassert>
12#include <memory>
13#include <string>
14#include <vector>
15
23
24namespace q3 {
25
26/// Pseudopotential type classification.
30 // Recognized for explicit rejection at input time; no PAW implementation exists yet.
32};
33
34/// Base class for all pseudopotential types.
36 public:
37 virtual ~Pseudopotential() = default;
38
39 /// Clone this pseudopotential (deep copy preserving derived type).
40 [[nodiscard]] virtual std::unique_ptr<Pseudopotential> clone() const {
41 return std::make_unique<Pseudopotential>(*this);
42 }
43
44 /**
45 * Return the type classification of this pseudopotential.
46 * Overridden by UltrasoftPseudopotential to return ultrasoft. No base-class
47 * instance can ever hold PAW data: both UPF readers throw
48 * UnsupportedPseudopotentialTypeError before constructing/populating a
49 * Pseudopotential from a PAW file, so projector_augmented_wave is reachable
50 * only once a future PawPseudopotential subclass overrides this method.
51 */
55
56 /**
57 * Whether this PP has augmentation charges.
58 * Overridden by UltrasoftPseudopotential.
59 */
60 [[nodiscard]] virtual bool has_augmentation_charges() const {
61 return false;
62 }
63
64 // ---- Common fields ----
65
66 std::string element;
67 std::string pseudopotential_type; // "NC", "US", "PAW" (PAW is rejected at read time)
68 std::string xc_functional;
69 Real valence_charge{}; // valence charge
70 int maximum_angular_momentum{}; // max angular momentum
71 int mesh_size{};
72 int number_of_projectors{}; // number of beta projectors
73 int number_of_wavefunctions{}; // number of atomic wavefunctions
75
76 std::vector<Real> radial_grid;
77 std::vector<Real> radial_grid_derivative;
78 PotentialLocal potential_local; // local potential V_loc(r) (Ry)
79
80 std::vector<Projector> projectors;
81 std::vector<std::vector<Real>> d_ion_matrix; // D matrix (Ry)
82 std::vector<WavefunctionAtomic> wavefunctions_atomic; // atomic wavefunctions
83 ChargeAtomic charge_atomic; // atomic charge density ρ_at(r)
84 ChargeCore charge_core; // core charge density (NLCC)
85};
86
87} // namespace q3
Base class for all pseudopotential types.
Definition init.hpp:35
std::vector< Real > radial_grid_derivative
Definition init.hpp:77
virtual std::unique_ptr< Pseudopotential > clone() const
Clone this pseudopotential (deep copy preserving derived type).
Definition init.hpp:40
std::vector< Projector > projectors
Definition init.hpp:80
std::vector< WavefunctionAtomic > wavefunctions_atomic
Definition init.hpp:82
std::string pseudopotential_type
Definition init.hpp:67
int number_of_projectors
Definition init.hpp:72
ChargeAtomic charge_atomic
Definition init.hpp:83
bool has_nonlinear_core_correction
Definition init.hpp:74
std::string element
Definition init.hpp:66
int number_of_wavefunctions
Definition init.hpp:73
virtual PseudopotentialType pseudopotential_type_enum() const
Definition init.hpp:52
std::vector< Real > radial_grid
Definition init.hpp:76
virtual bool has_augmentation_charges() const
Definition init.hpp:60
std::vector< std::vector< Real > > d_ion_matrix
Definition init.hpp:81
std::string xc_functional
Definition init.hpp:68
PotentialLocal potential_local
Definition init.hpp:78
virtual ~Pseudopotential()=default
int maximum_angular_momentum
Definition init.hpp:70
ChargeCore charge_core
Definition init.hpp:84
double Real
PseudopotentialType
Pseudopotential type classification.
Definition init.hpp:27
Atomic charge density ρ_at(r) from a pseudopotential.
Core charge density ρ_core(r) from a pseudopotential (NLCC).
Local potential V_loc(r) from a pseudopotential (Ry).