Loading...
Searching...
No Matches
init.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * Plane-wave Kohn-Sham wavefunction.
5 *
6 * A wavefunction represented as coefficients on a G-vector grid
7 * (plane-wave expansion). Inherits from ReciprocalSpaceWavefunction
8 * for the abstract interface and OnGridFunctionMixin for the
9 * grid-based storage.
10 *
11 * ψ(r) = Σ_G c_G · e^{i(k+G)·r}
12 *
13 * The coefficients c_G are Complex values stored at each G-vector
14 * point in the GVectorGrid.
15 */
16
17#include <stdexcept>
18
23
24namespace q3 {
25
26/// A single wavefunction in the plane-wave basis: c_G coefficients on a GVectorGrid.
28 public OnGridFunctionMixin<GVectorsGrid, Complex> {
29 public:
31
32 [[nodiscard]] int number_of_components() const override {
33 return 1;
34 }
35
36 Complex evaluate(const ReciprocalSpaceVector& g_vector) const override {
37 (void)g_vector;
38 throw std::runtime_error("PlanewaveWavefunction::evaluate() is not yet implemented. "
39 "Use index-based access instead.");
40 }
41
42 /// Number of plane-wave coefficients.
43 [[nodiscard]] int number_of_plane_waves() const {
44 return number_of_grid_points();
45 }
46
47 /// Raw coefficient data pointer (for BLAS/LAPACK interop).
49 return values_.data();
50 }
51 [[nodiscard]] const Complex* coefficient_data() const {
52 return values_.data();
53 }
54
55 /// Resize the coefficient storage.
57 values_.resize(number_of_plane_waves, Complex(0.0, 0.0));
58 }
59};
60
61/// Pseudopotential plane-wave Kohn-Sham wavefunction (same as base PW for now).
63
64/// Ultrasoft pseudopotential plane-wave Kohn-Sham wavefunction (same as base PW for now).
66
67} // namespace q3
Mixin for functions defined on a discrete grid of points.
A single wavefunction in the plane-wave basis: c_G coefficients on a GVectorGrid.
Definition init.hpp:28
void resize(int number_of_plane_waves)
Resize the coefficient storage.
Definition init.hpp:56
int number_of_components() const override
Number of components per wavefunction (always 1 for scalar states).
Definition init.hpp:32
Complex evaluate(const ReciprocalSpaceVector &g_vector) const override
Evaluate the wavefunction at a reciprocal-space vector.
Definition init.hpp:36
const Complex * coefficient_data() const
Definition init.hpp:51
int number_of_plane_waves() const
Number of plane-wave coefficients.
Definition init.hpp:43
Complex * coefficient_data()
Raw coefficient data pointer (for BLAS/LAPACK interop).
Definition init.hpp:48
A wavefunction in reciprocal space: ψ(G).
PlanewaveWavefunction NormConservingPlanewaveWavefunction
Pseudopotential plane-wave Kohn-Sham wavefunction (same as base PW for now).
Definition init.hpp:62
std::complex< double > Complex
A vector in reciprocal space (Cartesian, units of 2π/alat).