ampsci
High-precision calculations for one- and two-valence atomic systems
Loading...
Searching...
No Matches
Coulomb::CoulombTable< S >

Base (pure virtual) class to store Coulomb integrals, and similar. 3 derived classes, which account for symmetry. More...

#include <QkTable.hpp>

Public Member Functions

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, accounting for symmetry (only allowed for QkTable), up to maximum k, k_cut (set k_cut to <=0 to use all k)
 
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 that are allowed by the SelectionFunction, accounting for symmetry (only allowed for QkTable), up to maximum k, k_cut (set k_cut to <=0 to use all k)
 
void fill (const std::vector< DiracSpinor > &basis, const CoulombFunction &Fk, const SelectionRules &Fk_SR, int k_cut=-1, bool print=true)
 
auto operator-> ()
 Gives arrow access to all underlying vector<unordered_map> functions.
 
void summary () const
 For testing: prints details of coulomb integrals stored.
 
std::size_t count () const
 Returns number of stored integrals.
 
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
 
void add (int k, nkIndex a, nkIndex b, nkIndex c, nkIndex d, Real value)
 adds a new value. Note: does nothing if {k,a,b,c,d} already exists
 
void add (int k, nk4Index index, Real value)
 adds a new value. Note: does nothing if {k,a,b,c,d} already exists
 
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.
 
void update (int k, nkIndex a, nkIndex b, nkIndex c, nkIndex d, Real value)
 Updates value in table. If not present, adds new value.
 
void update (int k, nk4Index index, Real value)
 Updates value in table. If not present, adds new value.
 
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.
 
bool contains (int k, nkIndex a, nkIndex b, nkIndex c, nkIndex d) const
 Checks if given {k,a,b,c,d} is in the table.
 
bool contains (int k, nk4Index index) const
 Checks if given {k,a,b,c,d} is in the table.
 
bool emptyQ () const
 Returns true if table is empty.
 
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.)
 
Real Q (int k, nkIndex a, nkIndex b, nkIndex c, nkIndex d) const
 Retrieve a stored Q. If not present, returns 0. (Returns exactly as stored in table.)
 
Real Q (int k, nk4Index index) const
 Retrieve a stored Q. If not present, returns 0. (Returns exactly as stored in table.)
 
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)
 
Real R (int k, nkIndex a, nkIndex b, nkIndex c, nkIndex d) const
 Returns 'R', defined via: R := Q / (angular_coef)
 
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 symbols)
 
Real P (int k, nkIndex a, nkIndex b, nkIndex c, nkIndex 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 symbols)
 
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 symbols) - with screening
 
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 6J symbols)
 
Real W (int k, nkIndex a, nkIndex b, nkIndex c, nkIndex 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 6J symbols)
 
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'.
 
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}.
 
nk4Index NormalOrder (nkIndex a, nkIndex b, nkIndex c, nkIndex d) const
 Creates single 'nk4Index' corresponding to 'NormalOrder' symmetry of {a,b,c,d}.
 
bool is_NormalOrdered (nkIndex a, nkIndex b, nkIndex c, nkIndex d) const
 Checks if set {a,b,c,d} are already in NormalOrder.
 
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.
 
void write (const std::string &fname) const
 Writes coulomb integrals to disk.
 
bool read (const std::string &fname)
 Reads coulomb integrals to disk. Returns false if none read in.
 
double * get (int k, nk4Index index)
 Directly gets one of the stored elements, given normal-ordered nk4Index.
 
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,b,c,d} are already in 'NormalOrder'.
 
nk4Index CurrentOrder (nkIndex a, nkIndex b, nkIndex c, nkIndex d) const
 Creates single 'nk4Index', WITHOUT accounting for 'NormalOrder'. Can be used to check if {a,b,c,d} are already in 'NormalOrder'.
 
std::array< nkIndex, 4 > UnFormIndex (const nk4Index &index) const
 Breaks nk4Index back into {ia,ib,ic,id}. Not used.
 

Static Public Member Functions

static nk4Index FormIndex (nkIndex a, nkIndex b, nkIndex c, nkIndex d)
 Converts given set of nkIndex's (in any order) to nk4Index.
 

Detailed Description

template<Symmetry S>
class Coulomb::CoulombTable< S >

Base (pure virtual) class to store Coulomb integrals, and similar. 3 derived classes, which account for symmetry.

Mostly, a wrapper for std::unordered_map. Stores data in a std::vector of maps, each element (map) for each k (multipolarity). The symmetry is taken into account by defining a "Normal Ordering" of set of orbitals {a,b,c,d}. How this is defined depends on the specific symmetry in question. Qk symmetry: {abcd} = cbad = adcb = cdab = badc = bcda = dabc = dcba. Normal ordering: i = min(a,b,c,d) is first index. Two options (second and fourth may be swapped): choose 2nd to be smallest Wk symmetry (same as g): {abcd} = badc = cdab = dcba Lk symmetry: {abcd} = badc

Member Function Documentation

◆ fill()

template<Symmetry S>
void Coulomb::CoulombTable< S >::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, accounting for symmetry (only allowed for QkTable), up to maximum k, k_cut (set k_cut to <=0 to use all k)

◆ fill_if()

template<Symmetry S>
void Coulomb::CoulombTable< S >::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 that are allowed by the SelectionFunction, accounting for symmetry (only allowed for QkTable), up to maximum k, k_cut (set k_cut to <=0 to use all k)

◆ operator->()

template<Symmetry S>
auto Coulomb::CoulombTable< S >::operator-> ( )
inline

Gives arrow access to all underlying vector<unordered_map> functions.

◆ summary()

template<Symmetry S>
void Coulomb::CoulombTable< S >::summary ( ) const

For testing: prints details of coulomb integrals stored.

◆ count()

template<Symmetry S>
std::size_t Coulomb::CoulombTable< S >::count ( ) const

Returns number of stored integrals.

◆ add() [1/3]

template<Symmetry S>
void Coulomb::CoulombTable< S >::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

◆ add() [2/3]

template<Symmetry S>
void Coulomb::CoulombTable< S >::add ( int  k,
nkIndex  a,
nkIndex  b,
nkIndex  c,
nkIndex  d,
Real  value 
)

adds a new value. Note: does nothing if {k,a,b,c,d} already exists

◆ add() [3/3]

template<Symmetry S>
void Coulomb::CoulombTable< S >::add ( int  k,
nk4Index  index,
Real  value 
)

adds a new value. Note: does nothing if {k,a,b,c,d} already exists

◆ update() [1/3]

template<Symmetry S>
void Coulomb::CoulombTable< S >::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.

◆ update() [2/3]

template<Symmetry S>
void Coulomb::CoulombTable< S >::update ( int  k,
nkIndex  a,
nkIndex  b,
nkIndex  c,
nkIndex  d,
Real  value 
)

Updates value in table. If not present, adds new value.

◆ update() [3/3]

template<Symmetry S>
void Coulomb::CoulombTable< S >::update ( int  k,
nk4Index  index,
Real  value 
)

Updates value in table. If not present, adds new value.

◆ contains() [1/3]

template<Symmetry S>
bool Coulomb::CoulombTable< S >::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.

◆ contains() [2/3]

template<Symmetry S>
bool Coulomb::CoulombTable< S >::contains ( int  k,
nkIndex  a,
nkIndex  b,
nkIndex  c,
nkIndex  d 
) const

Checks if given {k,a,b,c,d} is in the table.

◆ contains() [3/3]

template<Symmetry S>
bool Coulomb::CoulombTable< S >::contains ( int  k,
nk4Index  index 
) const

Checks if given {k,a,b,c,d} is in the table.

◆ emptyQ()

template<Symmetry S>
bool Coulomb::CoulombTable< S >::emptyQ ( ) const
inline

Returns true if table is empty.

◆ Q() [1/3]

template<Symmetry S>
double Coulomb::CoulombTable< S >::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.)

◆ Q() [2/3]

template<Symmetry S>
double Coulomb::CoulombTable< S >::Q ( int  k,
nkIndex  a,
nkIndex  b,
nkIndex  c,
nkIndex  d 
) const

Retrieve a stored Q. If not present, returns 0. (Returns exactly as stored in table.)

◆ Q() [3/3]

template<Symmetry S>
double Coulomb::CoulombTable< S >::Q ( int  k,
nk4Index  index 
) const

Retrieve a stored Q. If not present, returns 0. (Returns exactly as stored in table.)

◆ R() [1/2]

template<Symmetry S>
double Coulomb::CoulombTable< S >::R ( int  k,
const DiracSpinor a,
const DiracSpinor b,
const DiracSpinor c,
const DiracSpinor d 
) const

Returns 'R', defined via: R := Q / (angular_coef)

◆ R() [2/2]

template<Symmetry S>
double Coulomb::CoulombTable< S >::R ( int  k,
nkIndex  a,
nkIndex  b,
nkIndex  c,
nkIndex  d 
) const

Returns 'R', defined via: R := Q / (angular_coef)

◆ P() [1/2]

template<Symmetry S>
double Coulomb::CoulombTable< S >::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 symbols)

◆ P() [2/2]

template<Symmetry S>
double Coulomb::CoulombTable< S >::P ( int  k,
nkIndex  a,
nkIndex  b,
nkIndex  c,
nkIndex  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 symbols)

◆ P2()

template<Symmetry S>
double Coulomb::CoulombTable< S >::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 symbols) - with screening

◆ W() [1/2]

template<Symmetry S>
double Coulomb::CoulombTable< S >::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 6J symbols)

◆ W() [2/2]

template<Symmetry S>
double Coulomb::CoulombTable< S >::W ( int  k,
nkIndex  a,
nkIndex  b,
nkIndex  c,
nkIndex  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 6J symbols)

◆ g()

template<Symmetry S>
double Coulomb::CoulombTable< S >::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'.

◆ NormalOrder() [1/2]

template<Symmetry S>
nk4Index Coulomb::CoulombTable< S >::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}.

◆ NormalOrder() [2/2]

template<Symmetry S>
nk4Index Coulomb::CoulombTable< S >::NormalOrder ( nkIndex  a,
nkIndex  b,
nkIndex  c,
nkIndex  d 
) const

Creates single 'nk4Index' corresponding to 'NormalOrder' symmetry of {a,b,c,d}.

◆ is_NormalOrdered() [1/2]

template<Symmetry S>
bool Coulomb::CoulombTable< S >::is_NormalOrdered ( nkIndex  a,
nkIndex  b,
nkIndex  c,
nkIndex  d 
) const
inline

Checks if set {a,b,c,d} are already in NormalOrder.

◆ is_NormalOrdered() [2/2]

template<Symmetry S>
bool Coulomb::CoulombTable< S >::is_NormalOrdered ( const DiracSpinor a,
const DiracSpinor b,
const DiracSpinor c,
const DiracSpinor d 
) const
inline

Checks if set {a,b,c,d} are already in NormalOrder.

◆ write()

template<Symmetry S>
void Coulomb::CoulombTable< S >::write ( const std::string &  fname) const

Writes coulomb integrals to disk.

◆ read()

template<Symmetry S>
bool Coulomb::CoulombTable< S >::read ( const std::string &  fname)

Reads coulomb integrals to disk. Returns false if none read in.

◆ get()

template<Symmetry S>
double * Coulomb::CoulombTable< S >::get ( int  k,
nk4Index  index 
)

Directly gets one of the stored elements, given normal-ordered nk4Index.

◆ CurrentOrder() [1/2]

template<Symmetry S>
nk4Index Coulomb::CoulombTable< S >::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,b,c,d} are already in 'NormalOrder'.

◆ CurrentOrder() [2/2]

template<Symmetry S>
nk4Index Coulomb::CoulombTable< S >::CurrentOrder ( nkIndex  a,
nkIndex  b,
nkIndex  c,
nkIndex  d 
) const

Creates single 'nk4Index', WITHOUT accounting for 'NormalOrder'. Can be used to check if {a,b,c,d} are already in 'NormalOrder'.

◆ FormIndex()

template<Symmetry S>
nk4Index Coulomb::CoulombTable< S >::FormIndex ( nkIndex  a,
nkIndex  b,
nkIndex  c,
nkIndex  d 
)
static

Converts given set of nkIndex's (in any order) to nk4Index.

◆ UnFormIndex()

template<Symmetry S>
std::array< nkIndex, 4 > Coulomb::CoulombTable< S >::UnFormIndex ( const nk4Index index) const

Breaks nk4Index back into {ia,ib,ic,id}. Not used.


The documentation for this class was generated from the following files: