pairinteraction
A Rydberg Interaction Calculator
Ket.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2024 Pairinteraction Developers
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
4#pragma once
5
6#include <iostream>
7#include <memory>
8#include <string>
9#include <type_traits>
10
11namespace pairinteraction {
12enum class Parity : int;
13
14/**
15 * @class Ket
16 *
17 * @brief Base class for a ket.
18 *
19 * This base class represents a ket. It is a base class for specific ket implementations. Its
20 * constructor is protected to indicate that derived classes should not allow direct instantiation.
21 * Instead, a factory class should be provided that is a friend of the derived class and can create
22 * instances of it.
23 */
24
25class Ket {
26public:
27 Ket() = delete;
28 virtual ~Ket() = default;
29
30 bool has_quantum_number_f() const;
31 bool has_quantum_number_m() const;
32 bool has_parity() const;
33
34 double get_energy() const;
35 double get_quantum_number_f() const;
36 double get_quantum_number_m() const;
37 Parity get_parity() const;
38
39 virtual std::string get_label() const = 0;
40
41 friend std::ostream &operator<<(std::ostream &os, const Ket &ket) {
42 return os << ket.get_label();
43 }
44
45protected:
46 Ket(double energy, double f, double m, Parity p);
47
48 bool operator==(const Ket &other) const;
49
50 struct hash {
51 std::size_t operator()(const Ket &k) const;
52 };
53
54 double energy;
58};
59} // namespace pairinteraction
Base class for a ket.
Definition: Ket.hpp:25
virtual std::string get_label() const =0
bool has_quantum_number_f() const
Definition: Ket.cpp:15
double get_quantum_number_f() const
Definition: Ket.cpp:27
friend std::ostream & operator<<(std::ostream &os, const Ket &ket)
Definition: Ket.hpp:41
Parity get_parity() const
Definition: Ket.cpp:31
double get_quantum_number_m() const
Definition: Ket.cpp:29
bool has_parity() const
Definition: Ket.cpp:23
double quantum_number_f
Definition: Ket.hpp:55
double quantum_number_m
Definition: Ket.hpp:56
double get_energy() const
Definition: Ket.cpp:25
bool has_quantum_number_m() const
Definition: Ket.cpp:19
virtual ~Ket()=default
bool operator==(const Ket &other) const
Definition: Ket.cpp:33
std::size_t operator()(const Ket &k) const
Definition: Ket.cpp:38