ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
hamilt_lcao.h
Go to the documentation of this file.
1#ifndef HAMILT_LCAO_H
2#define HAMILT_LCAO_H
3
5#include "source_cell/klist.h"
11
12#include <memory>
13#include <vector>
14
15#include "source_lcao/setup_deepks.h" // mohan add 20251008
16
17#ifdef __EXX
19#endif
20
21#include "source_lcao/setup_exx.h" // for exx, mohan add 20251022
22#include "source_lcao/module_dftu/dftu.h" // mohan add 2025-11-05
23
24namespace hamilt
25{
26
27// template first for type of k space H matrix elements
28// template second for type of temporary matrix,
29// gamma_only fix-gamma-matrix + S-gamma,
30// multi-k fix-Real + S-Real
31template <typename TK, typename TR>
32class HamiltLCAO : public Hamilt<TK>
33{
34 public:
35
36
37 using TAC = std::pair<int, std::array<int, 3>>;
38
39
44 HamiltLCAO(const UnitCell& ucell,
45 const Grid_Driver& grid_d,
46 const Parallel_Orbitals* paraV,
48 const K_Vectors& kv_in,
49 const TwoCenterBundle& two_center_bundle,
50 const LCAO_Orbitals& orb,
52 Plus_U* p_dftu, // mohan add 2025-11-05
53 Setup_DeePKS<TK> &deepks,
54 const int istep,
55 Exx_NAO<TK> &exx_nao);
56
60 HamiltLCAO(const UnitCell& ucell,
61 const Grid_Driver& grid_d,
62 const Parallel_Orbitals* paraV,
63 const K_Vectors& kv_in,
64 const TwoCenterIntegrator& intor_overlap_orb,
65 const std::vector<double>& orb_cutoff);
66
68 {
69 if (this->ops != nullptr)
70 {
71 delete this->ops;
72 }
73 delete this->hR;
74 delete this->sR;
75 delete this->hsk;
76 }
77
80
82 TK* getHk() const
83 {
84 return this->hsk->get_hk();
85 }
86
88 TK* getSk() const
89 {
90 return this->hsk->get_sk();
91 }
92
93 int get_size_hsk() const
94 {
95 return this->hsk->get_size();
96 }
97
100 {
101 return this->hR;
102 }
103 const HContainer<TR>* getHR() const
104 {
105 return this->hR;
106 }
107
110 {
111 return this->sR;
112 }
113 const HContainer<TR>* getSR() const
114 {
115 return this->sR;
116 }
117
118#ifdef __MLALGO
121 {
122 return this->V_delta_R;
123 }
124#endif
125
127 std::vector<TR>& getHRS2() { return this->hRS2; }
128
132 std::vector<HContainer<TR>*> getHR_vector();
133
135 void refresh(bool yes) override;
136
137 // for target K point, update consequence of hPsi() and matrix()
138 virtual void updateHk(const int ik) override;
139
148 void updateSk(const int ik, const int hk_type = 0);
149
150 // core function: return H(k) and S(k) matrixs for direct solving eigenvalues.
151 // not used in PW base
152 void matrix(MatrixBlock<TK>& hk_in, MatrixBlock<TK>& sk_in) override;
153
154 private:
155
156 const K_Vectors* kv = nullptr;
157
159 HContainer<TR>* hR = nullptr;
160
162 HContainer<TR>* sR = nullptr;
163
164#ifdef __MLALGO
166#endif
167
170
171 // special case for NSPIN=2 , data of HR should be separated into two parts
172 // save them in this->hRS2;
173 std::vector<TR> hRS2;
174
177 std::unique_ptr<HContainer<TR>> hr_spin_up_;
178 std::unique_ptr<HContainer<TR>> hr_spin_dn_;
179
181
186
187 const int istep = 0;
188};
189
190} // namespace hamilt
191
192#endif
Definition setup_exx.h:18
Definition sltk_grid_driver.h:40
Definition klist.h:12
Definition ORB_read.h:18
Definition parallel_orbitals.h:9
Definition dftu.h:19
Definition setup_deepks.h:23
Definition two_center_bundle.h:11
A class to compute two-center integrals.
Definition two_center_integrator.h:35
Definition unitcell.h:15
Definition density_matrix.h:70
Definition potential_new.h:48
Definition hcontainer.h:144
Definition hs_matrix_k.hpp:11
Definition hamilt_lcao.h:33
std::vector< TR > hRS2
Definition hamilt_lcao.h:173
std::vector< TR > & getHRS2()
get hRS2 buffer for NSPIN=2 case (spin-up in first half, spin-down in second half)
Definition hamilt_lcao.h:127
TK * getHk() const
get H(k) pointer
Definition hamilt_lcao.h:82
virtual void updateHk(const int ik) override
for target K point, update consequence of hPsi() and matrix()
Definition hamilt_lcao.cpp:507
std::vector< HContainer< TR > * > getHR_vector()
Definition hamilt_lcao.cpp:482
int current_spin
Definition hamilt_lcao.h:185
const int istep
Definition hamilt_lcao.h:187
void updateSk(const int ik, const int hk_type=0)
special for LCAO, update SK only
Definition hamilt_lcao.cpp:572
int refresh_times
Definition hamilt_lcao.h:180
const K_Vectors * kv
Definition hamilt_lcao.h:156
std::pair< int, std::array< int, 3 > > TAC
Definition hamilt_lcao.h:37
int get_size_hsk() const
Definition hamilt_lcao.h:93
Operator< TK > *& getOperator()
get pointer of Operator<TK> ops
Definition hamilt_lcao.cpp:566
const HContainer< TR > * getSR() const
Definition hamilt_lcao.h:113
HS_Matrix_K< TK > * hsk
Hamiltonian and overlap matrices for a specific k point.
Definition hamilt_lcao.h:169
TK * getSk() const
get S(k) pointer
Definition hamilt_lcao.h:88
HContainer< TR > * hR
Real space Hamiltonian H(R), where R is the Bravis lattice vector.
Definition hamilt_lcao.h:159
HContainer< TR > * V_delta_R
Definition hamilt_lcao.h:165
std::unique_ptr< HContainer< TR > > hr_spin_dn_
Definition hamilt_lcao.h:178
void refresh(bool yes) override
refresh the status of HR
Definition hamilt_lcao.cpp:533
HContainer< TR > *& getHR()
get HR pointer of *this->hR, which is a HContainerand contains H(R)
Definition hamilt_lcao.h:99
~HamiltLCAO()
Definition hamilt_lcao.h:67
HContainer< TR > *& get_V_delta_R()
get V_delta_R pointer of *this->V_delta_R, which is a HContainerand contains V_delta(R)
Definition hamilt_lcao.h:120
HContainer< TR > * sR
Real space overlap matrix S(R), where R is the Bravis lattice vector.
Definition hamilt_lcao.h:162
HContainer< TR > *& getSR()
get SR pointer of *this->sR, which is a HContainerand contains S(R)
Definition hamilt_lcao.h:109
const HContainer< TR > * getHR() const
Definition hamilt_lcao.h:103
std::unique_ptr< HContainer< TR > > hr_spin_up_
Definition hamilt_lcao.h:177
Definition hamilt.h:17
virtual std::vector< TK > matrix()
Definition hamilt.h:61
Operator< TK, base_device::DEVICE_CPU > * ops
first node operator, add operations from each operators
Definition hamilt.h:66
Definition operator.h:36
Definition hamilt.h:13
Definition matrixblock.h:9