ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
op_exx_lcao.h
Go to the documentation of this file.
1#ifndef OPEXXLCAO_H
2#define OPEXXLCAO_H
3
4#ifdef __EXX
5
6#include "operator_lcao.h"
7#include "source_cell/klist.h"
9
10#include <RI/global/Tensor.h>
11#include <RI/ri/Cell_Nearest.h>
12
13namespace hamilt
14{
15
16#ifndef __OPEXXTEMPLATE
17#define __OPEXXTEMPLATE
18
19template <class T>
20class OperatorEXX : public T
21{
22};
23
24#endif
25enum Add_Hexx_Type
26{
27 R,
28 k
29};
30template <typename TK, typename TR>
31class OperatorEXX<OperatorLCAO<TK, TR>> : public OperatorLCAO<TK, TR>
32{
33 using TAC = std::pair<int, std::array<int, 3>>;
34
35 public:
36 OperatorEXX<OperatorLCAO<TK, TR>>(
37 HS_Matrix_K<TK>* hsk_in,
39 const UnitCell& ucell,
40 const K_Vectors& kv_in,
41 std::vector<std::map<int, std::map<TAC, RI::Tensor<double>>>>* Hexxd_in = nullptr,
42 std::vector<std::map<int, std::map<TAC, RI::Tensor<std::complex<double>>>>>* Hexxc_in = nullptr,
43 Add_Hexx_Type add_hexx_type_in = Add_Hexx_Type::R,
44 const int istep_in = 0,
45 int* two_level_step_in = nullptr,
46 const bool restart_in = false);
47
48 virtual void contributeHk(int ik) override;
49 virtual void contributeHR() override;
50
51 private:
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
64 int* two_level_step = nullptr;
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
81 std::vector<std::vector<double>> Hexxd_k_load;
82 std::vector<std::vector<std::complex<double>>> Hexxc_k_load;
83};
84
85using TAC = std::pair<int, std::array<int, 3>>;
86
87RI::Cell_Nearest<int, int, 3, double, 3> init_cell_nearest(const UnitCell& ucell, const std::array<int, 3>& Rs_period);
88
89// allocate according to the read-in HexxR, used in nscf
90template <typename Tdata, typename TR>
91void reallocate_hcontainer(const std::vector<std::map<int, std::map<TAC, RI::Tensor<Tdata>>>>& Hexxs,
92 HContainer<TR>* hR,
93 const RI::Cell_Nearest<int, int, 3, double, 3>* const cell_nearest = nullptr);
94
96template <typename TR>
97void 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);
101
102} // namespace hamilt
103#endif // __EXX
104#include "op_exx_lcao.hpp"
105#endif // OPEXXLCAO_H
Definition klist.h:12
Definition unitcell.h:15
Definition hcontainer.h:144
#define T
Definition exp.cpp:237
Restart restart
Definition restart.cpp:47
int istep
Definition ions_move_basic.cpp:12
Definition hamilt.h:13
std::pair< int, TC > TAC
Definition ri_cv_io_test.cpp:10