Quantum 3xplorer (Q3)
An AI-native quantum simulation engine
Loading...
Searching...
No Matches
scf_state_projector_source.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * ScfStateMeanFieldProjectorSource — Kleinman-Bylander projectors of a live SCF state.
5 *
6 * Builds <k+G|β> with compute_kleinman_bylander_projectors(), the routine the
7 * Hamiltonian applicator itself calls, so the projectors a `VKB` file carries
8 * are the ones the eigenvalues in `WFN` were computed with. One k-point is
9 * cached at a time: the writer walks the k-points in order and needs each once.
10 */
11
15
16namespace q3 {
17
18/// MeanFieldProjectorSource over a live SCF state; see the file comment.
20 public:
21 /// Holds a reference, as ScfStateMeanFieldBandSource does: the state outlives the record.
24 : scf_state_(scf_state) {}
25
26 /// See MeanFieldProjectorSource::projectors(); recomputed only when the k-point changes.
27 [[nodiscard]] const Matrix<Complex>& projectors(int kpoint_index) const override {
28 if (kpoint_index != cached_kpoint_index_) {
29 const auto& pseudopotential_basis = scf_state_.quantum_system().pseudopotential_basis();
30 const PlanewaveBasis& planewave_basis = *scf_state_.planewave_basis;
32 (*scf_state_.kpoint_grid)[kpoint_index].coordinates,
33 *scf_state_.crystal_structure,
34 planewave_basis,
35 pseudopotential_basis.pseudopotential_set(),
36 pseudopotential_basis.beta_function_table(),
37 planewave_basis.kpoint_g_vector_indices()[kpoint_index],
38 planewave_basis.kpoint_number_of_plane_waves()[kpoint_index],
39 pseudopotential_basis.total_number_of_projectors(),
40 cached_projectors_);
41 cached_kpoint_index_ = kpoint_index;
42 }
43 return cached_projectors_;
44 }
45
46 private:
48 mutable Matrix<Complex> cached_projectors_;
49 mutable int cached_kpoint_index_ = -1;
50};
51
52} // namespace q3
Hands out one k-point's projectors at a time; see the file comment.
const NormConservingPlanewaveBasis & pseudopotential_basis() const
Definition init.hpp:65
const std::vector< std::vector< int > > & kpoint_g_vector_indices() const
Definition init.hpp:272
const std::vector< int > & kpoint_number_of_plane_waves() const
Definition init.hpp:276
MeanFieldProjectorSource over a live SCF state; see the file comment.
ScfStateMeanFieldProjectorSource(const NormConservingPlanewaveKohnShamSCFState &scf_state)
Holds a reference, as ScfStateMeanFieldBandSource does: the state outlives the record.
const Matrix< Complex > & projectors(int kpoint_index) const override
See MeanFieldProjectorSource::projectors(); recomputed only when the k-point changes.
void compute_kleinman_bylander_projectors(const Vector3D &k_crystal, const Crystal &crystal_structure, const PlanewaveBasis &planewave_basis, const PseudopotentialSet &pseudopotential_set, const BetaFunctionTable &beta_function_table, const std::vector< int > &g_vector_indices, int number_of_plane_waves, int total_number_of_projectors, Matrix< Complex > &kleinman_bylander_potential)
Definition projector.hpp:36
const NormConservingPlanewaveKohnShamQuantumSystem & quantum_system() const override
Definition init.hpp:82
const KPointsGrid * kpoint_grid
Definition init.hpp:56
const Crystal * crystal_structure
Definition init.hpp:55
const PlanewaveBasis * planewave_basis
Definition init.hpp:53