pairinteraction
A Rydberg Interaction Calculator
Ket.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2024 Pairinteraction Developers
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
5
8
9#include <limits>
10
11namespace pairinteraction {
12Ket::Ket(double energy, double f, double m, Parity p)
13 : energy(energy), quantum_number_f(f), quantum_number_m(m), parity(p) {}
14
16 return quantum_number_f != std::numeric_limits<double>::max();
17}
18
20 return quantum_number_m != std::numeric_limits<double>::max();
21}
22
23bool Ket::has_parity() const { return parity != Parity::UNKNOWN; }
24
25double Ket::get_energy() const { return energy; }
26
28
30
31Parity Ket::get_parity() const { return parity; }
32
33bool Ket::operator==(const Ket &other) const {
34 return energy == other.energy && quantum_number_f == other.quantum_number_f &&
36}
37
38size_t Ket::hash::operator()(const Ket &k) const {
39 size_t seed = 0;
43 utils::hash_combine(seed, static_cast<int>(k.parity));
44 return seed;
45}
46} // namespace pairinteraction
Base class for a ket.
Definition: Ket.hpp:25
bool has_quantum_number_f() const
Definition: Ket.cpp:15
double get_quantum_number_f() const
Definition: Ket.cpp:27
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
bool operator==(const Ket &other) const
Definition: Ket.cpp:33
void hash_combine(std::size_t &seed, T const &v)
Combine hashes.
Definition: hash.hpp:43
std::size_t operator()(const Ket &k) const
Definition: Ket.cpp:38