Loading...
Searching...
No Matches
init.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * NormConservingPlanewaveChargeDensity — extends PlanewaveChargeDensity with
5 * pseudopotential-aware data.
6 *
7 * Adds:
8 * - Projector overlap coefficients for ultrasoft augmentation
9 * - Augmentation charge management via needs_augmentation()
10 */
11
12#include <memory>
13#include <vector>
14
19
20namespace q3 {
21
22/// Norm-conserving (and ultrasoft) planewave charge density.
24 public:
32
33 // ─── Projector overlap coefficients (Quantum ESPRESSO's `becsum`) ───
34 [[nodiscard]] const Matrix<Real>& projector_overlap_coefficients() const {
35 return projector_overlap_coefficients_;
36 }
38 return projector_overlap_coefficients_;
39 }
40
41 /// Initialize the coefficient storage for given number of atoms and max channels.
43 int maximum_projector_channels) {
44 projector_overlap_coefficients_.assign(
45 number_of_atoms, maximum_projector_channels * maximum_projector_channels, 0.0);
46 }
47
48 /// Reset the projector overlap coefficients to zero.
50 for (size_t row_index = 0; row_index < projector_overlap_coefficients_.rows();
51 row_index++) {
52 for (size_t column_index = 0; column_index < projector_overlap_coefficients_.cols();
53 column_index++) {
54 projector_overlap_coefficients_(row_index, column_index) = 0.0;
55 }
56 }
57 }
58
59 // ─── Augmentation charges ──────────────────────────────────
60 [[nodiscard]] bool needs_augmentation() const {
61 return norm_conserving_quantum_system_ && norm_conserving_quantum_system_->has_ultrasoft();
62 }
63
64 // ─── Quantum system access ────────────────────────────────────
67 return *norm_conserving_quantum_system_;
68 }
69
70 private:
71 const NormConservingPlanewaveKohnShamQuantumSystem* norm_conserving_quantum_system_ = nullptr;
72 Matrix<Real> projector_overlap_coefficients_;
73};
74
75} // namespace q3
size_t rows() const
Definition matrix.hpp:62
void assign(size_t rows, size_t cols, const T &initial_value)
Definition matrix.hpp:38
size_t cols() const
Definition matrix.hpp:65
Norm-conserving (and ultrasoft) planewave charge density.
Definition init.hpp:23
void reset_projector_overlap_coefficients()
Reset the projector overlap coefficients to zero.
Definition init.hpp:49
const Matrix< Real > & projector_overlap_coefficients() const
Definition init.hpp:34
NormConservingPlanewaveChargeDensity(const PlanewaveBasis &basis, int number_of_spin_components, const NormConservingPlanewaveKohnShamQuantumSystem &norm_conserving_quantum_system)
Definition init.hpp:26
const NormConservingPlanewaveKohnShamQuantumSystem & norm_conserving_quantum_system() const
Definition init.hpp:66
Matrix< Real > & projector_overlap_coefficients()
Definition init.hpp:37
void initialize_projector_overlap_coefficients(int number_of_atoms, int maximum_projector_channels)
Initialize the coefficient storage for given number of atoms and max channels.
Definition init.hpp:42
Planewave charge density — stores ρ(r) on FFT grid.
Definition init.hpp:30
const PlanewaveBasis & basis() const
Definition init.hpp:123