2 #include "Angular/SixJTable.hpp"
3 #include "Wavefunction/DiracSpinor.hpp"
8 #include <unordered_map>
21 static_assert(
sizeof(
nkIndex) ==
sizeof(DiracSpinor::Index));
61 std::vector<std::unordered_map<nk4Index, Real>> m_data{};
70 void fill(
const std::vector<DiracSpinor> &basis,
const YkTable &yk,
71 int k_cut = -1,
bool print =
true);
77 void fill_if(
const std::vector<DiracSpinor> &basis,
const YkTable &yk,
90 std::size_t
count()
const;
118 return (m_data.size() == 0);
168 const DiracSpinor &d,
int tma,
int tmb,
int tmc,
int tmd)
const;
189 void write(
const std::string &fname)
const;
191 bool read(
const std::string &fname);
229 #include "QkTable.ipp"
Lookup table for Wigner 6J symbols.
Definition: SixJTable.hpp:24
Base (pure virtual) class to store Coulomb integrals, and similar. 3 derived classes,...
Definition: QkTable.hpp:57
Real P2(int k, const DiracSpinor &a, const DiracSpinor &b, const DiracSpinor &c, const DiracSpinor &d, const Angular::SixJTable &sj, const std::vector< double > &fk) const
'Exchange-only', defined via W = Q + P. Optionally, takes pointer to 6J table (faster eval of 6J symb...
Definition: QkTable.ipp:229
double * get(int k, nk4Index index)
Directly gets one of the stored elements, given normal-ordered nk4Index.
Definition: QkTable.ipp:115
void fill_if(const std::vector< DiracSpinor > &basis, const YkTable &yk, const SelectionRules &SelectionFunction, int k_cut=-1, bool print=true)
Takes a constructed YkTable, and fills Coulomb table with all possible non-zero Qk Coulomb integrals ...
Definition: QkTable.ipp:586
Real P(int k, const DiracSpinor &a, const DiracSpinor &b, const DiracSpinor &c, const DiracSpinor &d, const Angular::SixJTable *const sj=nullptr) const
'Exchange-only', defined via W = Q + P. Optionally, takes pointer to 6J table (faster eval of 6J symb...
Definition: QkTable.ipp:220
bool is_NormalOrdered(nkIndex a, nkIndex b, nkIndex c, nkIndex d) const
Checks if set {a,b,c,d} are already in NormalOrder.
Definition: QkTable.hpp:179
bool read(const std::string &fname)
Reads coulomb integrals to disk. Returns false if none read in.
Definition: QkTable.ipp:862
bool is_NormalOrdered(const DiracSpinor &a, const DiracSpinor &b, const DiracSpinor &c, const DiracSpinor &d) const
Checks if set {a,b,c,d} are already in NormalOrder.
Definition: QkTable.hpp:183
void update(int k, const DiracSpinor &a, const DiracSpinor &b, const DiracSpinor &c, const DiracSpinor &d, Real value)
Updates value in table. If not present, adds new value.
Definition: QkTable.ipp:71
auto operator->()
Gives arrow access to all underlying vector<unordered_map> functions.
Definition: QkTable.hpp:85
bool contains(int k, const DiracSpinor &a, const DiracSpinor &b, const DiracSpinor &c, const DiracSpinor &d) const
Checks if given {k,a,b,c,d} is in the table.
Definition: QkTable.ipp:97
nk4Index NormalOrder(const DiracSpinor &a, const DiracSpinor &b, const DiracSpinor &c, const DiracSpinor &d) const
Creates single 'nk4Index' corresponding to 'NormalOrder' symmetry of {a,b,c,d}.
Definition: QkTable.ipp:394
nk4Index CurrentOrder(const DiracSpinor &a, const DiracSpinor &b, const DiracSpinor &c, const DiracSpinor &d) const
Creates single 'nk4Index', WITHOUT accounting for 'NormalOrder'. Can be used to check if {a,...
Definition: QkTable.ipp:407
static nk4Index FormIndex(nkIndex a, nkIndex b, nkIndex c, nkIndex d)
Converts given set of nkIndex's (in any order) to nk4Index.
Definition: QkTable.ipp:416
Real R(int k, const DiracSpinor &a, const DiracSpinor &b, const DiracSpinor &c, const DiracSpinor &d) const
Returns 'R', defined via: R := Q / (angular_coef)
Definition: QkTable.ipp:178
std::array< nkIndex, 4 > UnFormIndex(const nk4Index &index) const
Breaks nk4Index back into {ia,ib,ic,id}. Not used.
Definition: QkTable.ipp:439
void fill(const std::vector< DiracSpinor > &basis, const YkTable &yk, int k_cut=-1, bool print=true)
Takes a constructed YkTable, and fills Coulomb table with all possible non-zero Qk Coulomb integrals,...
Definition: QkTable.ipp:455
void write(const std::string &fname) const
Writes coulomb integrals to disk.
Definition: QkTable.ipp:838
void summary() const
For testing: prints details of coulomb integrals stored.
Definition: QkTable.ipp:15
Real g(const DiracSpinor &a, const DiracSpinor &b, const DiracSpinor &c, const DiracSpinor &d, int tma, int tmb, int tmc, int tmd) const
Returns 'g_abcd'.
Definition: QkTable.ipp:271
void add(int k, const DiracSpinor &a, const DiracSpinor &b, const DiracSpinor &c, const DiracSpinor &d, Real value)
adds a new value. Note: does nothing if {k,a,b,c,d} already exists
Definition: QkTable.ipp:45
Real Q(int k, const DiracSpinor &a, const DiracSpinor &b, const DiracSpinor &c, const DiracSpinor &d) const
Retrieve a stored Q. If not present, returns 0. (Returns exactly as stored in table....
Definition: QkTable.ipp:141
Real W(int k, const DiracSpinor &a, const DiracSpinor &b, const DiracSpinor &c, const DiracSpinor &d, const Angular::SixJTable *const sj=nullptr) const
W^k_abcd = Q^k_abcd + \sum_l [k] 6j * Q^l_abdc. Optionally, takes pointer to 6J table (faster eval of...
Definition: QkTable.ipp:257
std::size_t count() const
Returns number of stored integrals.
Definition: QkTable.ipp:29
bool emptyQ() const
Returns true if table is empty.
Definition: QkTable.hpp:117
Calculates + stores Hartree Y functions + Angular (w/ look-up), taking advantage of symmetry.
Definition: YkTable.hpp:26
Stores radial Dirac spinor: F_nk = (f, g)
Definition: DiracSpinor.hpp:41
Functions (+classes) for computing Coulomb integrals.
Definition: Coulomb.hpp:8
double Real
Data type used to store integrals.
Definition: QkTable.hpp:15
std::function< bool(int, const DiracSpinor &a, const DiracSpinor &b, const DiracSpinor &c, const DiracSpinor &d)> SelectionRules
Function type for determining Coulomb(-like) integral selection rules. Takes k and 4 DiracSpinors,...
Definition: QkTable.hpp:33
uint64_t nk4Index
index type for set of 4 orbitals {nk,nk,nk,nk} -> nk4Index
Definition: QkTable.hpp:17
uint16_t nkIndex
index type for each {nk} (orbital)
Definition: QkTable.hpp:19
Symmetry
Symmetry (state index order) for tables.
Definition: QkTable.hpp:13
std::function< double(int, const DiracSpinor &a, const DiracSpinor &b, const DiracSpinor &c, const DiracSpinor &d)> CoulombFunction
Function type for calculating Coulomb(-like) integrals. Takes k and 4 DiracSpinors,...
Definition: QkTable.hpp:27