2 #include "Physics/AtomData.hpp"
4 #include "Wavefunction/DiracSpinor.hpp"
6 #include <unordered_map>
16 template <
typename T =
double>
20 std::unordered_map<nk2Index, T> m_data{};
23 auto operator->() {
return &m_data; }
32 void add(DiracSpinor::Index a, DiracSpinor::Index b, T value) {
33 m_data.insert({FormIndex(a, b), std::move(value)});
38 m_data.insert(other.cbegin(), other.cend());
47 void update(DiracSpinor::Index a, DiracSpinor::Index b, T value) {
48 m_data.insert_or_assign(FormIndex(a, b), std::move(value));
57 [[nodiscard]]
bool contains(DiracSpinor::Index a,
58 DiracSpinor::Index b)
const {
59 return m_data.find(FormIndex(a, b)) != m_data.cend();
66 return (map_it == m_data.cend()) ? nullptr : &(map_it->second);
70 [[nodiscard]]
const T *
get(DiracSpinor::Index a, DiracSpinor::Index b)
const {
71 const auto map_it = m_data.find(FormIndex(a, b));
72 return (map_it == m_data.cend()) ? nullptr : &(map_it->second);
79 return (map_it == m_data.cend()) ? nullptr : &(map_it->second);
83 [[nodiscard]] T *
get(DiracSpinor::Index a, DiracSpinor::Index b) {
84 const auto map_it = m_data.find(FormIndex(a, b));
85 return (map_it == m_data.cend()) ? nullptr : &(map_it->second);
91 const auto ptr =
get(a, b);
92 return ptr ? *ptr : T{};
96 [[nodiscard]] T
getv(DiracSpinor::Index a, DiracSpinor::Index b)
const {
97 const auto ptr =
get(a, b);
98 return ptr ? *ptr : T{};
103 [[nodiscard]]
const T *
get(
const std::string &a,
const std::string &b)
const {
110 const auto map_it = m_data.find(FormIndex(a_index, b_index));
111 return (map_it == m_data.cend()) ?
nullptr : &(map_it->second);
115 auto begin() {
return m_data.begin(); }
116 auto end() {
return m_data.end(); }
117 auto cbegin()
const {
return m_data.cbegin(); }
118 auto cend()
const {
return m_data.cend(); }
120 static std::pair<std::string, std::string> index_to_symbols(
nk2Index index) {
121 const auto [a, b] = unFormIndex(index);
131 static_assert(
sizeof(
nkIndex) * 8 == 16);
135 [[nodiscard]]
static std::pair<nkIndex, nkIndex> unFormIndex(
nk2Index index) {
136 std::pair<nkIndex, nkIndex> out;
138 b =
static_cast<nkIndex>(index);
141 assert(FormIndex(a, b) == index);
Stores radial Dirac spinor: F_nk = (f, g)
Definition: DiracSpinor.hpp:41
Index nk_index() const
(n,kappa) index (see AtomData)
Definition: DiracSpinor.hpp:97
constexpr int nk_to_index(int n, int k)
return nk_index given {n, kappa}: nk_index(n,k) := n^2 - 2n + 1 + kappa_index
Definition: Wigner369j.hpp:73
std::pair< int, int > index_to_nk(int index)
return {n, kappa} given nk_index:
Definition: Wigner369j.hpp:78
std::pair< int, int > parse_symbol(std::string_view symbol)
Parses electron 'symbol' or 'shortSymbol' to {n,kappa}, e.g., "6s+" -> {6,-1}; "6p-" -> {6,...
Definition: AtomData.cpp:148
std::string shortSymbol(int n, int kappa)
Returns shortSymbol, given n and kappa: (6,-1)->"6s+".
Definition: AtomData.cpp:128
Functions (+classes) for computing Coulomb integrals.
Definition: Coulomb.hpp:8
uint32_t nk2Index
index type for set of 2 orbitals {nk,nk} -> nk4Index
Definition: meTable.hpp:11
uint16_t nkIndex
index type for each {nk} (orbital)
Definition: QkTable.hpp:19