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// elecstate::Potential forward declaration, full definition in potential_new.h (moved to .cpp)
16namespace elecstate { class Potential; }
17
18// module_dm::DensityMatrix forward declaration, full definition in density_matrix.h (moved to .cpp)
19namespace module_dm { template <typename TK, typename TR> class DensityMatrix; }
20
21// Setup_DeePKS forward declaration, full definition in setup_deepks.h (moved to .cpp)
22template <typename TK> class Setup_DeePKS;
23// Plus_U_Base forward declaration, full definition in source_pw/module_pwdft/dftu_base.h
24class Plus_U_Base;
25
26// Exx_NAO forward declaration, full definition in setup_exx.h (moved to .cpp)
27template <typename TK> class Exx_NAO;
28
30struct Exx_Info;
31
32// Input_para forward declaration, full definition in input_parameter.h
33struct Input_para;
34
35class BasisFlattenedIndexing; // Defined in source/source_base/basis_flattened_indexing.h
36class Parallel_Blkcyclic; // Defined in source/source_base/parallel_blkcyc.h
37
38namespace hamilt
39{
40
41// OperatorLCAO forward declaration, full definition in
42// module_operator_lcao/operator_lcao.h (moved to .cpp)
43template <typename TK, typename TR> class OperatorLCAO;
44
45// template first for type of k space H matrix elements
46// template second for type of temporary matrix,
47// gamma_only fix-gamma-matrix + S-gamma,
48// multi-k fix-Real + S-Real
49template <typename TK, typename TR>
50class HamiltLCAO : public Hamilt<TK>
51{
52 public:
53
58 HamiltLCAO(const UnitCell& ucell,
59 const Grid_Driver& grid_d,
60 const Parallel_Orbitals* paraV,
64 const K_Vectors& kv_in,
65 const TwoCenterBundle& two_center_bundle,
66 const LCAO_Orbitals& orb,
68 Plus_U_Base* p_dftu, // mohan add 2025-11-05
69 Setup_DeePKS<TK> &deepks,
70 const int istep,
71 Exx_NAO<TK> &exx_nao,
72 const Exx_Info& exx_info,
73 const Input_para& inp,
74 const bool load_exx_flag,
75 TD_info* td_info);
76
80 HamiltLCAO(const UnitCell& ucell,
81 const Grid_Driver& grid_d,
82 const Parallel_Orbitals* paraV,
85 const K_Vectors& kv_in,
86 const TwoCenterIntegrator& intor_overlap_orb,
87 const std::vector<double>& orb_cutoff);
88
90 {
91 delete this->ops;
92 }
93
96
98 TK* getHk() const
99 {
100 return this->hsk->get_hk();
101 }
102
104 TK* getSk() const
105 {
106 return this->hsk->get_sk();
107 }
108
111 {
112 return this->hR.get();
113 }
114 const HContainer<TR>* getHR() const
115 {
116 return this->hR.get();
117 }
118
121 {
122 return this->sR.get();
123 }
124 const HContainer<TR>* getSR() const
125 {
126 return this->sR.get();
127 }
128
130 {
131 return basis_;
132 }
133
135 {
136 return layout_;
137 }
138
139#ifdef __MLALGO
142 {
143 return this->V_delta_R;
144 }
145#endif
146
148 std::vector<TR>& getHRS2() { return this->hRS2; }
149
153 std::vector<HContainer<TR>*> getHR_vector();
154
156 void refresh(bool yes) override;
157
158 // for target K point, update consequence of hPsi() and matrix()
159 void updateHk(const int ik) override;
160
169 void updateSk(const int ik, const int hk_type);
170
171 // core function: return H(k) and S(k) matrixs for direct solving eigenvalues.
172 // not used in PW base
173 void matrix(MatrixBlock<TK>& hk_in, MatrixBlock<TK>& sk_in) override;
174
175 private:
176
179
180 const K_Vectors* kv = nullptr;
181
183 std::unique_ptr<HContainer<TR>> hR;
184
186 std::unique_ptr<HContainer<TR>> sR;
187
188#ifdef __MLALGO
190#endif
191
193 std::unique_ptr<HS_Matrix_K<TK>> hsk;
194
195 // special case for NSPIN=2 , data of HR should be separated into two parts
196 // save them in this->hRS2;
197 std::vector<TR> hRS2;
198
201 std::unique_ptr<HContainer<TR>> hr_spin_up_;
202 std::unique_ptr<HContainer<TR>> hr_spin_dn_;
203
206
208
213
215 int nspin = 1;
216
218 bool vl_in_h = true;
219
223
226};
227
228} // namespace hamilt
229
230#endif
Canonical atom-major flattening of the LCAO basis hierarchy.
Definition basis_flattened_indexing.h:40
Definition setup_exx.h:21
Grid_Driver class for neighbor search interface.
Definition sltk_grid_driver.h:63
Class for k-points management.
Definition klist.h:20
Definition orb_read.h:18
Parallel block-cyclic matrix distribution.
Definition parallel_blkcyc.h:25
Definition parallel_orbitals.h:16
Definition dftu_base.h:21
Definition setup_deepks.h:23
Definition td_info.h:18
Definition two_center_bundle.h:11
A class to compute two-center integrals.
Definition two_center_integrator.h:35
Provide the basic information about unitcell.
Definition unitcell.h:16
Definition potential_new.h:58
Definition hcontainer.h:147
std::unique_ptr< HContainer< TR > > sR
Real space overlap matrix S(R), where R is the Bravis lattice vector.
Definition hamilt_lcao.h:186
const Parallel_Blkcyclic & layout() const
Definition hamilt_lcao.h:134
std::vector< TR > hRS2
Definition hamilt_lcao.h:197
HContainer< TR > * getSR()
get SR pointer of *this->sR, which is a HContainerand contains S(R)
Definition hamilt_lcao.h:120
const Parallel_Blkcyclic & layout_
Definition hamilt_lcao.h:178
void matrix(MatrixBlock< TK > &hk_in, MatrixBlock< TK > &sk_in) override
Definition hamilt_lcao.cpp:220
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:148
HContainer< TR > * getHR()
get HR pointer of *this->hR, which is a HContainerand contains H(R)
Definition hamilt_lcao.h:110
TK * getHk() const
get H(k) pointer
Definition hamilt_lcao.h:98
void updateHk(const int ik) override
for target K point, update consequence of hPsi() and matrix()
Definition hamilt_lcao.cpp:228
void updateSk(const int ik, const int hk_type)
special for LCAO, update SK only
Definition hamilt_lcao.cpp:291
std::vector< HContainer< TR > * > getHR_vector()
Definition hamilt_lcao.cpp:170
int current_spin
Definition hamilt_lcao.h:212
bool vl_in_h
snapshot of inp.vl_in_h taken at construction; avoids PARAM dependency
Definition hamilt_lcao.h:218
OperatorLCAO< TK, TR > * getOperatorLCAO()
get this->ops downcast to OperatorLCAO<TK, TR>*, cached in ops_lcao_
Definition hamilt_lcao.cpp:209
const BasisFlattenedIndexing & basis() const
Definition hamilt_lcao.h:129
int nspin
snapshot of inp.nspin taken at construction; avoids PARAM dependency
Definition hamilt_lcao.h:215
int refresh_times
Definition hamilt_lcao.h:207
const K_Vectors * kv
Definition hamilt_lcao.h:180
Operator< TK > *& getOperator()
get pointer of Operator<TK> ops
Definition hamilt_lcao.cpp:285
const HContainer< TR > * getSR() const
Definition hamilt_lcao.h:124
std::unique_ptr< HS_Matrix_K< TK > > hsk
Hamiltonian and overlap matrices for a specific k point.
Definition hamilt_lcao.h:193
std::unique_ptr< HContainer< TR > > hR
Real space Hamiltonian H(R), where R is the Bravis lattice vector.
Definition hamilt_lcao.h:183
TK * getSk() const
get S(k) pointer
Definition hamilt_lcao.h:104
void synchronize_spin_storage()
Keep both spin channels aligned with dynamically added H(R) blocks.
Definition hamilt_lcao.cpp:193
HContainer< TR > * V_delta_R
Definition hamilt_lcao.h:189
std::unique_ptr< HContainer< TR > > hr_spin_dn_
Definition hamilt_lcao.h:202
void refresh(bool yes) override
refresh the status of HR
Definition hamilt_lcao.cpp:256
~HamiltLCAO()
Definition hamilt_lcao.h:89
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:141
const BasisFlattenedIndexing & basis_
Definition hamilt_lcao.h:177
HamiltLCAO(const UnitCell &ucell, const Grid_Driver &grid_d, const Parallel_Orbitals *paraV, const BasisFlattenedIndexing &basis, const Parallel_Blkcyclic &layout, elecstate::Potential *pot_in, const K_Vectors &kv_in, const TwoCenterBundle &two_center_bundle, const LCAO_Orbitals &orb, module_dm::DensityMatrix< TK, double > *DM_in, Plus_U_Base *p_dftu, Setup_DeePKS< TK > &deepks, const int istep, Exx_NAO< TK > &exx_nao, const Exx_Info &exx_info, const Input_para &inp, const bool load_exx_flag, TD_info *td_info)
Constructor of Hamiltonian for LCAO base HR and SR will be allocated with Operators.
Definition hamilt_lcao.cpp:57
OperatorLCAO< TK, TR > * ops_lcao_
Definition hamilt_lcao.h:222
const HContainer< TR > * getHR() const
Definition hamilt_lcao.h:114
std::unique_ptr< HContainer< TR > > hr_spin_up_
Definition hamilt_lcao.h:201
Definition hamilt.h:17
Operator< TK, base_device::DEVICE_CPU > * ops
Definition hamilt.h:57
Definition operator_lcao.h:13
Definition operator.h:42
DensityMatrix Class <TK,TR> = <double,double> for Gamma-only calculation <TK,TR> = <std::complex<doub...
Definition density_matrix.h:172
Definition read_atoms_hlp_test.cpp:13
Definition wf_op.cpp:6
Definition density_matrix.cpp:13
Grid_Driver class for neighbor search interface.
Definition exx_info.h:10
Definition input_parameter.h:13
A non-owning description of a matrix stored in memory.
Definition matrix_block.h:23