ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
exx_lip.h
Go to the documentation of this file.
1//==========================================================
2// AUTHOR : Peize Lin
3// DATE : 2015-03-10
4//==========================================================
5#ifndef EXX_LIP_H
6#define EXX_LIP_H
7
10#include "source_base/matrix.h"
11
12#include <vector>
13#include <memory.h>
14
15 class K_Vectors;
16 class UnitCell;
17 class Structure_Factor;
18 namespace elecstate{ class ElecState; }
19 namespace ModulePW{ class PW_Basis_K; }
20 namespace ModulePW{ class PW_Basis; }
21 namespace ModuleSymmetry{ class Symmetry; }
22 namespace psi
23 {
24 template <typename T, typename Device>
25 class PSIInit;
26 }
27
28template<typename T, typename Device = base_device::DEVICE_CPU>
30{
31 using Treal = typename GetTypeReal<T>::type;
32public:
34 ~Exx_Lip();
35
37
38 Exx_Lip(const Exx_Info::Exx_Info_Lip& info_in,
39 const ModuleSymmetry::Symmetry& symm,
40 K_Vectors* kv_ptr_in,
41 psi::Psi<T, Device>* psi_local_in,
42 psi::Psi<T, Device>* kspw_psi_ptr_in,
43 const ModulePW::PW_Basis_K* wfc_basis_in,
44 const ModulePW::PW_Basis* rho_basis_in,
45 const Structure_Factor& sf,
46 const UnitCell* ucell_ptr_in,
47 const elecstate::ElecState* pelec_in);
48
49 // void cal_exx(const int& nks);
50 void cal_exx();
51 const std::vector<std::vector<std::vector<T>>>& get_exx_matrix() const
52 {
53 return this->exx_matrix;
54 }
56 {
57 return this->exx_energy;
58 }
59
60 void write_q_pack() const;
61
62 void set_hvec(const int ik, const T* const hvec, const int naos, const int nbands)
63 {
64 memcpy(&(*this->k_pack->hvec_array)(ik, 0, 0), hvec, sizeof(T) * naos * nbands);
65 }
67 {
68 return *this->k_pack->hvec_array;
69 }
70
71private:
72
74
75 // template<typename T, typename Device = base_device::DEVICE_CPU>
76 struct k_package
77 {
78 K_Vectors* kv_ptr = nullptr;
79 // wavefunc* wf_ptr;
83
86 const elecstate::ElecState* pelec = nullptr;
87 } *k_pack = nullptr, * q_pack = nullptr;
88
90
91 std::vector<std::vector<T>> phi;
92 std::vector<std::vector<std::vector<T>>> psi;
93 std::vector<Treal> recip_qkg2;
95 std::vector<T> b;
96 std::vector<T> b0;
97 std::vector<T> sum1;
98 std::vector<std::vector<T>> sum3;
99
100 std::vector<std::vector<std::vector<T>>> exx_matrix;
102
103 void wf_wg_cal();
104 void phi_cal(k_package* kq_pack, const int ikq);
105 void psi_cal();
106 void judge_singularity(const int ik);
107 void qkg2_exp(const int ik, const int iq);
108 void b_cal(const int ik, int iq, const int ib);
109 void sum3_cal(const int iq, const int ib);
110 void b_sum(const int iq, const int ib);
111 void sum_all(const int ik);
112 void exx_energy_cal();
113 // void read_q_pack(const ModuleSymmetry::Symmetry& symm,
114 // const ModulePW::PW_Basis_K* wfc_basis,
115 // const Structure_Factor& sf);
116
117 //2*pi*i
118 const T two_pi_i = Treal(ModuleBase::TWO_PI) * T(0.0, 1.0);
119public:
122
123 const UnitCell* ucell_ptr = nullptr;
124};
125
126#include "exx_lip.hpp"
127
128#endif
Definition exx_lip.h:30
int gzero_rank_in_pool
Definition exx_lip.h:73
std::vector< T > b
Definition exx_lip.h:95
std::vector< std::vector< T > > phi
Definition exx_lip.h:91
int iq_vecik
Definition exx_lip.h:89
const UnitCell * ucell_ptr
Definition exx_lip.h:123
struct Exx_Lip::k_package * q_pack
struct Exx_Lip::k_package * k_pack
void sum_all(const int ik)
Definition exx_lip.hpp:424
const Exx_Info::Exx_Info_Lip & info
Definition exx_lip.h:36
void b_sum(const int iq, const int ib)
Definition exx_lip.hpp:407
psi::Psi< T, Device > get_hvec() const
Definition exx_lip.h:66
const std::vector< std::vector< std::vector< T > > > & get_exx_matrix() const
Definition exx_lip.h:51
void cal_exx()
Definition exx_lip.hpp:31
Treal exx_energy
Definition exx_lip.h:101
const ModulePW::PW_Basis_K * wfc_basis
Definition exx_lip.h:121
void write_q_pack() const
Definition exx_lip.hpp:480
const T two_pi_i
Definition exx_lip.h:118
void exx_energy_cal()
Definition exx_lip.hpp:458
~Exx_Lip()
Definition exx_lip.hpp:172
void set_hvec(const int ik, const T *const hvec, const int naos, const int nbands)
Definition exx_lip.h:62
std::vector< Treal > recip_qkg2
Definition exx_lip.h:93
void qkg2_exp(const int ik, const int iq)
Definition exx_lip.hpp:320
typename GetTypeReal< T >::type Treal
Definition exx_lip.h:31
std::vector< std::vector< std::vector< T > > > exx_matrix
Definition exx_lip.h:100
void phi_cal(k_package *kq_pack, const int ikq)
Definition exx_lip.hpp:210
std::vector< T > sum1
Definition exx_lip.h:97
void wf_wg_cal()
Definition exx_lip.hpp:192
Exx_Lip(const Exx_Info::Exx_Info_Lip &info_in)
std::vector< std::vector< T > > sum3
Definition exx_lip.h:98
void judge_singularity(const int ik)
Definition exx_lip.hpp:296
std::vector< T > b0
Definition exx_lip.h:96
void sum3_cal(const int iq, const int ib)
Definition exx_lip.hpp:395
Treal sum2_factor
Definition exx_lip.h:94
Treal get_exx_energy() const
Definition exx_lip.h:55
std::vector< std::vector< std::vector< T > > > psi
Definition exx_lip.h:92
void b_cal(const int ik, int iq, const int ib)
Definition exx_lip.hpp:351
void psi_cal()
Definition exx_lip.hpp:239
const ModulePW::PW_Basis * rho_basis
Definition exx_lip.h:120
Definition klist.h:13
Definition matrix.h:19
Special pw_basis class. It includes different k-points.
Definition pw_basis_k.h:57
A class which can convert a function of "r" to the corresponding linear superposition of plane waves ...
Definition pw_basis.h:56
Definition symmetry.h:16
Definition structure_factor.h:11
Definition unitcell.h:16
Definition elecstate.h:15
Definition psi_init.h:12
Definition psi.h:37
#define T
Definition exp.cpp:237
const double TWO_PI
Definition constants.h:21
Definition pw_op.cpp:3
Definition symm_other.cpp:4
Definition cal_dm.h:10
Definition exx_lip.h:23
Definition exx_info.h:41
Definition exx_lip.h:77
const elecstate::ElecState * pelec
Definition exx_lip.h:86
psi::Psi< T, Device > * kspw_psi_ptr
PW wavefunction.
Definition exx_lip.h:80
K_Vectors * kv_ptr
Definition exx_lip.h:78
psi::Psi< T, Device > * psi_local
NAOs in PW.
Definition exx_lip.h:81
psi::Psi< T, Device > * hvec_array
LCAO wavefunction, the eigenvectors from lapack diagonalization.
Definition exx_lip.h:85
ModuleBase::matrix wf_wg
Definition exx_lip.h:82
T type
Definition macros.h:8