Loading...
Searching...
No Matches
quantum_system.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * QuantumSystem — generic quantum system.
5 *
6 * A collection of quantum states defined on a crystal structure,
7 * templated on the state type. Concrete Kohn-Sham and
8 * representation-specific systems extend this at layer 3.
9 *
10 * Hierarchy:
11 * QuantumSystem<QuantumStateType> (L2: crystal, state storage)
12 * └── KohnShamQuantumSystem<QuantumStateType> (L3: + spin)
13 * └── PlanewaveKohnShamQuantumSystem (L3: + kpoints, basis)
14 * └── NormConservingPlanewaveKohnShamQuantumSystem (L3: + PP basis)
15 * └── UltrasoftPlanewaveKohnShamQuantumSystem (L3: +
16 * augmentation)
17 */
18
19#include <vector>
20
22
23namespace q3 {
24
25class Crystal;
26
27/**
28 * A quantum system containing a collection of quantum states
29 * defined on a crystal structure.
30 *
31 * Templated on the state type, which itself is templated on the
32 * wavefunction representation. This base class owns the crystal
33 * pointer, the state storage, and provides basic accessors.
34 */
35template <typename QuantumStateType> class QuantumSystem {
36 public:
37 virtual ~QuantumSystem() = default;
38
40
42
43 /**
44 * Set the preloaded quantum system pointer.
45 */
49
50 /**
51 * Copy all electronic state data from another QuantumSystem.
52 */
57
58 /// Number of quantum states in the system.
59 [[nodiscard]] int number_of_quantum_states() const {
60 return static_cast<int>(quantum_states_.size());
61 }
62
63 /// Access a quantum state by flat index.
64 [[nodiscard]] const QuantumStateType& get_quantum_state_by_index(int index) const {
65 return quantum_states_[index];
66 }
67 QuantumStateType& get_quantum_state_by_index(int index) {
68 return quantum_states_[index];
69 }
70
71 protected:
72 std::vector<QuantumStateType> quantum_states_;
73};
74
75} // namespace q3
const QuantumStateType & get_quantum_state_by_index(int index) const
Access a quantum state by flat index.
int number_of_quantum_states() const
Number of quantum states in the system.
Crystal * crystal_structure
std::vector< QuantumStateType > quantum_states_
const QuantumSystem< QuantumStateType > * preloaded_quantum_system_
QuantumStateType & get_quantum_state_by_index(int index)
virtual ~QuantumSystem()=default
void load_quantum_system(const QuantumSystem< QuantumStateType > &system)
virtual void copy_quantum_states_from(const QuantumSystem< QuantumStateType > &source)