ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
gaussian_abfs.h
Go to the documentation of this file.
1//=======================
2// AUTHOR : jiyy
3// DATE : 2024-02-27
4//=======================
5
6#ifndef GAUSSIAN_ABFS_H
7#define GAUSSIAN_ABFS_H
8
10//#include "source_basis/module_pw/pw_basis_k.h"
11#include "source_cell/klist.h"
12
13#include <RI/global/Tensor.h>
14#include <array>
15#include <map>
16#include <vector>
17
19{
25/* Gaussian integral
26 (f_{l_am_a}|f_{l_bm_b})=\sum_{LM}A_{LM}\sum_{\bfG}\largebra{k^{l_a+l_b-L}G_{LM}(\bfk)\tilde{v}(\bfk)e^{-\ci\bfk\cdot\tau}}\Bigg|_{\bfk=\bfq-\bfG}
27
28 A_{LM}=\ci^{(l_a-l_b)}\tilde{N}_{l_a}^*\tilde{N}_{l_b}C^{LM}_{l_am_al_bm_b}
29
30 G_{LM}(\bfk)=k^Le^{-\frac{k^2}{\gamma}}\tilde{Y}_{L}^{M}(\hat{\bfk})
31
32 N_l=\frac{\gamma^{l+3/2}}{\sqrt{\pi/2}(2l-1)!!}
33
34 \tilde{N}_l=\frac{N_l}{\gamma^{l+3/2}}=\frac{1}{\sqrt{\pi/2}(2l-1)!!}
35
36 C^{LM}_{lm,l'm'}: Gaunt coefficient
37*/
38 public:
39 void init(const UnitCell& ucell,
40 const int& Lmax,
41 const std::vector<ModuleBase::Vector3<double>>& kvec_c,
42 const ModuleBase::Matrix3& G,
43 const double& lambda);
44
45 RI::Tensor<std::complex<double>> get_Vq(const int& lp_max,
46 const int& lq_max, // Maximum L for which to calculate interaction.
47 const size_t& ik,
48 const double& chi, // Singularity corrected value at q=0.
50 const ModuleBase::realArray& gaunt);
51
52 std::array<RI::Tensor<std::complex<double>>, 3> get_dVq(
53 const int& lp_max,
54 const int& lq_max, // Maximum L for which to calculate interaction.
55 const size_t& ik,
56 const double& chi, // Singularity corrected value at q=0.
58 const ModuleBase::realArray& gaunt);
59
60 /*
61Calculate the lattice sum over a Gaussian:
62 S(k) := \sum_G |k+G|^{power+L} \exp(-lambda*|k+G|^2) Y_{LM}(k+G) * \exp(i(k+G)\tau)
63 d_S(k) := S(k) * i * (k+G)
64*/
65 std::vector<std::complex<double>> get_lattice_sum(
66 const double& tpiba,
67 const size_t& ik,
68 const double& power, // Will be 0. for straight GTOs and -2. for Coulomb
69 // interaction
70 const double& exponent,
71 const bool& exclude_Gamma, // The R==0. can be excluded by this flag.
72 const int& lmax, // Maximum angular momentum the sum is needed for.
74
75 std::vector<std::array<std::complex<double>, 3>> get_d_lattice_sum(
76 const double& tpiba,
77 const size_t& ik,
78 const double& power, // Will be 0. for straight GTOs and -2. for Coulomb
79 // interaction
80 const double& exponent,
81 const bool& exclude_Gamma, // The R==0. can be excluded by this flag.
82 const int& lmax, // Maximum angular momentum the sum is needed for.
84
85 // construct gaussian basis based on original NAO
86 Numerical_Orbital_Lm Gauss(const Numerical_Orbital_Lm& orb, const double& lambda);
87
88 private:
89 double lambda;
90 double tpiba;
91 double lat0;
92 double omega;
93 std::vector<ModuleBase::Vector3<double>> kvec_c;
94 std::vector<std::vector<ModuleBase::Vector3<double>>> qGvecs;
95 std::vector<int> n_cells;
96 std::vector<std::vector<bool>> check_gamma;
97 std::vector<ModuleBase::matrix> ylm;
98 template <typename Tresult>
99 using T_func_DPcal_phase = std::function<Tresult(const ModuleBase::Vector3<double>& vec)>;
100 template <typename Tresult>
102 = std::function<std::vector<Tresult>(const double& power, // Will be 0. for straight GTOs and -2. for Coulomb
103 // interaction
104 const double& exponent,
105 const bool& exclude_Gamma, // The R==0. can be excluded by this flag.
106 const int& lmax)>;
107
108 template <typename Tout, typename Tin>
109 Tout DPcal_Vq_dVq(const double& omega,
110 const int& lp_max,
111 const int& lq_max, // Maximum L for which to calculate interaction.
112 const size_t& ik,
113 const double& chi, // Singularity corrected value at q=0.
115 const ModuleBase::realArray& gaunt,
116 const T_func_DPcal_lattice_sum<Tin>& func_DPcal_lattice_sum);
117
118 template <typename Tresult>
119 std::vector<Tresult> DPcal_lattice_sum(const double& tpiba,
120 const size_t& ik,
121 const double& power, // Will be 0. for straight GTOs and -2. for Coulomb
122 // interaction
123 const double& exponent,
124 const bool& exclude_Gamma, // The R==0. can be excluded by this flag.
125 const int& lmax, // Maximum angular momentum the sum is needed for.
126 const T_func_DPcal_phase<Tresult>& func_DPcal_phase);
127
128 // calculates the double factorial n!! of n
129 static double double_factorial(const int& n);
130 static std::vector<int> get_n_supercells(const double& lat0, const ModuleBase::Matrix3& G, const double& Gmax);
131};
132
133#endif
Definition gaussian_abfs.h:19
void init(const UnitCell &ucell, const int &Lmax, const std::vector< ModuleBase::Vector3< double > > &kvec_c, const ModuleBase::Matrix3 &G, const double &lambda)
Calculating bare Coulomb integrals in reciprocal space, using Gaussians.
Definition gaussian_abfs.cpp:23
std::vector< std::vector< ModuleBase::Vector3< double > > > qGvecs
Definition gaussian_abfs.h:94
std::vector< ModuleBase::Vector3< double > > kvec_c
Definition gaussian_abfs.h:93
double tpiba
Definition gaussian_abfs.h:90
std::vector< ModuleBase::matrix > ylm
Definition gaussian_abfs.h:97
RI::Tensor< std::complex< double > > get_Vq(const int &lp_max, const int &lq_max, const size_t &ik, const double &chi, const ModuleBase::Vector3< double > &tau, const ModuleBase::realArray &gaunt)
Definition gaussian_abfs.cpp:101
std::function< std::vector< Tresult >(const double &power, const double &exponent, const bool &exclude_Gamma, const int &lmax)> T_func_DPcal_lattice_sum
Definition gaussian_abfs.h:106
static double double_factorial(const int &n)
Definition gaussian_abfs.cpp:303
std::vector< std::vector< bool > > check_gamma
Definition gaussian_abfs.h:96
std::vector< int > n_cells
Definition gaussian_abfs.h:95
static std::vector< int > get_n_supercells(const double &lat0, const ModuleBase::Matrix3 &G, const double &Gmax)
Definition gaussian_abfs.cpp:423
std::vector< Tresult > DPcal_lattice_sum(const double &tpiba, const size_t &ik, const double &power, const double &exponent, const bool &exclude_Gamma, const int &lmax, const T_func_DPcal_phase< Tresult > &func_DPcal_phase)
double lat0
Definition gaussian_abfs.h:91
std::array< RI::Tensor< std::complex< double > >, 3 > get_dVq(const int &lp_max, const int &lq_max, const size_t &ik, const double &chi, const ModuleBase::Vector3< double > &tau, const ModuleBase::realArray &gaunt)
Definition gaussian_abfs.cpp:134
Numerical_Orbital_Lm Gauss(const Numerical_Orbital_Lm &orb, const double &lambda)
Definition gaussian_abfs.cpp:257
double lambda
Definition gaussian_abfs.h:89
std::vector< std::array< std::complex< double >, 3 > > get_d_lattice_sum(const double &tpiba, const size_t &ik, const double &power, const double &exponent, const bool &exclude_Gamma, const int &lmax, const ModuleBase::Vector3< double > &tau)
Definition gaussian_abfs.cpp:333
std::vector< std::complex< double > > get_lattice_sum(const double &tpiba, const size_t &ik, const double &power, const double &exponent, const bool &exclude_Gamma, const int &lmax, const ModuleBase::Vector3< double > &tau)
Definition gaussian_abfs.cpp:316
double omega
Definition gaussian_abfs.h:92
Tout DPcal_Vq_dVq(const double &omega, const int &lp_max, const int &lq_max, const size_t &ik, const double &chi, const ModuleBase::Vector3< double > &tau, const ModuleBase::realArray &gaunt, const T_func_DPcal_lattice_sum< Tin > &func_DPcal_lattice_sum)
std::function< Tresult(const ModuleBase::Vector3< double > &vec)> T_func_DPcal_phase
Definition gaussian_abfs.h:99
3x3 matrix and related mathamatical operations
Definition matrix3.h:19
3 elements vector
Definition vector3.h:24
double float array
Definition realarray.h:21
Definition ORB_atomic_lm.h:21
Definition unitcell.h:15