Loading...
Searching...
No Matches
init.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * PseudopotentialOverlapOperator — norm-conserving overlap: S = I.
5 *
6 * Norm-conserving pseudopotential_set leave the plane-wave basis orthonormal, so the
7 * overlap is the identity and the eigenproblem is standard (zheev). This serves as
8 * the base for pseudopotential overlap operators; the ultrasoft subclass adds the
9 * augmentation overlap on top. The crystal, quantum system snapshot, and
10 * Kleinman-Bylander projectors are held here so subclasses can use them without
11 * re-plumbing call sites.
12 */
13
14#include <algorithm>
15#include <complex>
16#include <vector>
17
18#include "io/logger.hpp"
25
26namespace q3 {
27
29 public:
31 const Crystal& crystal_structure,
33 const Matrix<Complex>& kleinman_bylander_potential,
34 const execution::ExecutionPolicy& execution_policy)
35 : crystal_structure_(crystal_structure)
36 , quantum_system_(quantum_system)
37 , kleinman_bylander_potential_(kleinman_bylander_potential)
38 , execution_policy_(execution_policy) {}
39
40 void apply(int number_of_plane_waves,
41 const Complex* wavefunction,
42 Complex* overlap_wavefunction) const override {
43 for (int g_vector_index = 0; g_vector_index < number_of_plane_waves; g_vector_index++) {
44 overlap_wavefunction[g_vector_index] = wavefunction[g_vector_index];
45 }
46 }
47
48 [[nodiscard]] bool is_identity() const override {
49 return true;
50 }
51
52 /**
53 * Build the dense overlap matrix S for the norm-conserving case.
54 *
55 * For norm-conserving pseudopotentials, the plane-wave basis is orthonormal
56 * so the overlap matrix is the identity: S = I.
57 */
58 void build_dense_matrix(int number_of_plane_waves,
59 std::vector<Complex>& overlap_matrix) const override {
60 overlap_matrix.assign(number_of_plane_waves * number_of_plane_waves, Complex(0.0, 0.0));
61 for (int index = 0; index < number_of_plane_waves; index++) {
62 overlap_matrix[index + index * number_of_plane_waves] = Complex(1.0, 0.0);
63 }
64 }
65
66 protected:
71};
72
73} // namespace q3
void build_dense_matrix(int number_of_plane_waves, std::vector< Complex > &overlap_matrix) const override
Definition init.hpp:58
PseudopotentialOverlapOperator(const Crystal &crystal_structure, const NormConservingPlanewaveKohnShamQuantumSystem &quantum_system, const Matrix< Complex > &kleinman_bylander_potential, const execution::ExecutionPolicy &execution_policy)
Definition init.hpp:30
const NormConservingPlanewaveKohnShamQuantumSystem & quantum_system_
Definition init.hpp:68
void apply(int number_of_plane_waves, const Complex *wavefunction, Complex *overlap_wavefunction) const override
Definition init.hpp:40
const execution::ExecutionPolicy & execution_policy_
Definition init.hpp:70
const Matrix< Complex > & kleinman_bylander_potential_
Definition init.hpp:69
bool is_identity() const override
Definition init.hpp:48
const Crystal & crystal_structure_
Definition init.hpp:67
std::complex< double > Complex