33
44#ifdef __EXX
55
6- #include < RI/global/Tensor.h>
7- #include < RI/ri/Cell_Nearest.h>
86#include " operator_lcao.h"
97#include " source_cell/klist.h"
108#include " source_hamilt/module_xc/exx_info.h"
119
10+ #include < RI/global/Tensor.h>
11+ #include < RI/ri/Cell_Nearest.h>
12+
1213namespace hamilt
1314{
1415
@@ -21,13 +22,19 @@ class OperatorEXX : public T
2122};
2223
2324#endif
24- enum Add_Hexx_Type { R, k };
25+ enum Add_Hexx_Type
26+ {
27+ R,
28+ k
29+ };
2530template <typename TK , typename TR >
2631class OperatorEXX <OperatorLCAO<TK , TR >> : public OperatorLCAO<TK , TR >
2732{
2833 using TAC = std::pair<int , std::array<int , 3 >>;
29- public:
30- OperatorEXX<OperatorLCAO<TK , TR >>(HS_Matrix_K<TK >* hsk_in,
34+
35+ public:
36+ OperatorEXX<OperatorLCAO<TK , TR >>(
37+ HS_Matrix_K<TK >* hsk_in,
3138 hamilt::HContainer<TR >* hR_in,
3239 const UnitCell& ucell,
3340 const K_Vectors& kv_in,
@@ -42,36 +49,37 @@ class OperatorEXX<OperatorLCAO<TK, TR>> : public OperatorLCAO<TK, TR>
4249 virtual void contributeHR () override ;
4350
4451 private:
45- Add_Hexx_Type add_hexx_type = Add_Hexx_Type::R;
46- int current_spin = 0 ;
47- bool HR_fixed_done = false ;
48-
49- std::vector<std::map<int , std::map<TAC , RI ::Tensor<double >>>>* Hexxd = nullptr ;
50- std::vector<std::map<int , std::map<TAC , RI ::Tensor<std::complex <double >>>>>* Hexxc = nullptr ;
51-
52- // / @brief the step of the outer loop.
53- // / nullptr: no dependence on the number of two_level_step, contributeHk will do enerything normally.
54- // / 0: the first outer loop. If restart, contributeHk will directly add Hexx to Hloc. else, do nothing.
55- // / >0: not the first outer loop. contributeHk will do enerything normally.
56- int * two_level_step = nullptr ;
57- // / @brief if restart, read and save Hexx, and directly use it during the first outer loop.
58- bool restart = false ;
59-
60- const int istep = 0 ; // the ion step
61-
62- void add_loaded_Hexx (const int ik);
63-
64- const UnitCell& ucell;
65-
66- const K_Vectors& kv;
67-
68- // if k points has no shift, use cell_nearest to reduce the memory cost
69- RI ::Cell_Nearest<int , int , 3 , double , 3 > cell_nearest;
70- bool use_cell_nearest = true ;
71-
72- // / @brief Hexxk for all k-points, only for the 1st scf loop ofrestart load
73- std::vector<std::vector<double >> Hexxd_k_load;
74- std::vector<std::vector<std::complex <double >>> Hexxc_k_load;
52+ Add_Hexx_Type add_hexx_type = Add_Hexx_Type::R;
53+ int current_spin = 0 ;
54+ bool HR_fixed_done = false ;
55+ bool initial_gga_done = false ; // Taoni Bao add 2026-05-18, to fix RT-TDDFT EXX missing problem in the evolution
56+
57+ std::vector<std::map<int , std::map<TAC , RI ::Tensor<double >>>>* Hexxd = nullptr ;
58+ std::vector<std::map<int , std::map<TAC , RI ::Tensor<std::complex <double >>>>>* Hexxc = nullptr ;
59+
60+ // / @brief the step of the outer loop.
61+ // / nullptr: no dependence on the number of two_level_step, contributeHk will do enerything normally.
62+ // / 0: the first outer loop. If restart, contributeHk will directly add Hexx to Hloc. else, do nothing.
63+ // / >0: not the first outer loop. contributeHk will do enerything normally.
64+ int * two_level_step = nullptr ;
65+ // / @brief if restart, read and save Hexx, and directly use it during the first outer loop.
66+ bool restart = false ;
67+
68+ const int istep = 0 ; // the ion step
69+
70+ void add_loaded_Hexx (const int ik);
71+
72+ const UnitCell& ucell;
73+
74+ const K_Vectors& kv;
75+
76+ // if k points has no shift, use cell_nearest to reduce the memory cost
77+ RI ::Cell_Nearest<int , int , 3 , double , 3 > cell_nearest;
78+ bool use_cell_nearest = true ;
79+
80+ // / @brief Hexxk for all k-points, only for the 1st scf loop ofrestart load
81+ std::vector<std::vector<double >> Hexxd_k_load;
82+ std::vector<std::vector<std::complex <double >>> Hexxc_k_load;
7583};
7684
7785using TAC = std::pair<int , std::array<int , 3 >>;
@@ -81,14 +89,15 @@ RI::Cell_Nearest<int, int, 3, double, 3> init_cell_nearest(const UnitCell& ucell
8189// allocate according to the read-in HexxR, used in nscf
8290template <typename Tdata, typename TR >
8391void reallocate_hcontainer (const std::vector<std::map<int , std::map<TAC , RI ::Tensor<Tdata>>>>& Hexxs,
84- HContainer<TR >* hR,
85- const RI ::Cell_Nearest<int , int , 3 , double , 3 >* const cell_nearest = nullptr );
92+ HContainer<TR >* hR,
93+ const RI ::Cell_Nearest<int , int , 3 , double , 3 >* const cell_nearest = nullptr );
8694
8795// / allocate according to BvK cells, used in scf
8896template <typename TR >
89- void reallocate_hcontainer (const int nat, HContainer<TR >* hR,
90- const std::array<int , 3 >& Rs_period,
91- const RI ::Cell_Nearest<int , int , 3 , double , 3 >* const cell_nearest = nullptr );
97+ void reallocate_hcontainer (const int nat,
98+ HContainer<TR >* hR,
99+ const std::array<int , 3 >& Rs_period,
100+ const RI ::Cell_Nearest<int , int , 3 , double , 3 >* const cell_nearest = nullptr );
92101
93102} // namespace hamilt
94103#endif // __EXX
0 commit comments