ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
real_gaunt_table.h
Go to the documentation of this file.
1#ifndef REAL_GAUNT_TABLE_H_
2#define REAL_GAUNT_TABLE_H_
3
4#include <array>
5#include <map>
6
7#include <ATen/tensor.h>
8
25{
26 public:
29
31
33 {
34 static RealGauntTable instance_;
35 return instance_;
36 }
37
67 void build(const int lmax);
68
70 const double& operator()(const int l1, const int l2, const int l3, const int m1, const int m2, const int m3) const;
71
73 int lmax() const { return lmax_; }
74
76 size_t memory() const
77 {
78 return gaunt_table_.size() * (6 * sizeof(int) + sizeof(double))
79 + real_gaunt_table_.NumElements() * sizeof(double);
80 }
81
82
101 double gaunt(const int l1, const int l2, const int l3, const int m1, const int m2, const int m3) const;
102
103
104 private:
106
108 int lmax_ = -1;
109
117 std::map<std::array<int, 6>, double> gaunt_table_;
118
121
123 bool gaunt_select_l(const int l1, const int l2, const int l3) const;
124
126 bool gaunt_select_m(const int m1, const int m2, const int m3) const { return m1 + m2 + m3 == 0; }
127
129 bool real_gaunt_select_m(const int m1, const int m2, const int m3) const;
130
137 bool is_valid_lm(const int l1, const int l2, const int l3, const int m1, const int m2, const int m3) const;
138
140 double gaunt_lookup(const int l1, const int l2, const int l3, const int m1, const int m2, const int m3) const;
141
143 double real_gaunt_lookup(const int l1, const int l2, const int l3, const int m1, const int m2, const int m3) const;
144
160 std::array<int, 6> gaunt_key(const int l1, const int l2, const int l3, const int m1, const int m2, const int m3) const;
161
163 void arrange(int& l1, int& l2, int& m1, int& m2) const;
164
166 double factorial(const int n) const;
167
175 int index_map(int l, int m) const;
176
178 int minus_1_pow(int m) const { return m % 2 ? -1 : 1; }
179};
180
181#endif
Table of Gaunt coefficients of real spherical harmonics.
Definition real_gaunt_table.h:25
void build(const int lmax)
Builds the Gaunt table of real spherical harmonics for two-center integrals.
Definition real_gaunt_table.cpp:9
int lmax() const
returns the maximum l (for the first two dimensions; the third dimension is 2*lmax)
Definition real_gaunt_table.h:73
int lmax_
maximum angular momentum of the table (for the first two dimensions)
Definition real_gaunt_table.h:108
size_t memory() const
Returns the amount of heap memory used by this class (in bytes).
Definition real_gaunt_table.h:76
RealGauntTable()
Definition real_gaunt_table.h:105
std::map< std::array< int, 6 >, double > gaunt_table_
Table of standard Gaunt coefficients.
Definition real_gaunt_table.h:117
static RealGauntTable & instance()
Definition real_gaunt_table.h:32
int minus_1_pow(int m) const
returns pow(-1, m)
Definition real_gaunt_table.h:178
bool gaunt_select_m(const int m1, const int m2, const int m3) const
selection rule of standard Gaunt coefficients regarding m1, m2, m3
Definition real_gaunt_table.h:126
double gaunt_lookup(const int l1, const int l2, const int l3, const int m1, const int m2, const int m3) const
Get a Gaunt coefficient by looking up the table.
Definition real_gaunt_table.cpp:181
bool real_gaunt_select_m(const int m1, const int m2, const int m3) const
selection rule of real Gaunt coefficients regarding m1, m2, m3
Definition real_gaunt_table.cpp:173
~RealGauntTable()
Definition real_gaunt_table.h:30
const double & operator()(const int l1, const int l2, const int l3, const int m1, const int m2, const int m3) const
gets the tabulated real Gaunt coefficient
Definition real_gaunt_table.cpp:78
double gaunt(const int l1, const int l2, const int l3, const int m1, const int m2, const int m3) const
Computes the standard Gaunt coefficients.
Definition real_gaunt_table.cpp:121
container::Tensor real_gaunt_table_
table of real Gaunt coefficients
Definition real_gaunt_table.h:120
bool gaunt_select_l(const int l1, const int l2, const int l3) const
selection rule of standard & real Gaunt coefficients regarding l1, l2, l3
Definition real_gaunt_table.cpp:168
double factorial(const int n) const
returns n! as a double
Definition real_gaunt_table.cpp:221
std::array< int, 6 > gaunt_key(const int l1, const int l2, const int l3, const int m1, const int m2, const int m3) const
Symmetry-adapted key for gaunt_table_.
Definition real_gaunt_table.cpp:193
RealGauntTable(RealGauntTable const &)=delete
double real_gaunt_lookup(const int l1, const int l2, const int l3, const int m1, const int m2, const int m3) const
Get a real Gaunt coefficient from the stored Gaunt coefficients.
Definition real_gaunt_table.cpp:87
RealGauntTable & operator=(RealGauntTable const &)=delete
int index_map(int l, int m) const
Returns the linearized index of Y(l,m).
Definition real_gaunt_table.cpp:234
bool is_valid_lm(const int l1, const int l2, const int l3, const int m1, const int m2, const int m3) const
Returns whether the given l & m are valid quantum numbers.
Definition real_gaunt_table.cpp:163
void arrange(int &l1, int &l2, int &m1, int &m2) const
swap (l1,m1) <--> (l2,m2) if l1 < l2; do nothing otherwise
Definition real_gaunt_table.cpp:212
A class for representing the shape of a tensor.
Definition tensor_shape.h:13
A multi-dimensional array of elements of a single data type.
Definition tensor.h:32
int64_t NumElements() const
Get the total number of elements in the tensor.
Definition tensor.cpp:70
@ DT_DOUBLE
Double-precision floating point *‍/.