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 <RI/global/Tensor.h>
7#include <RI/ri/Cell_Nearest.h>
8#include "operator_lcao.h"
9#include "source_cell/klist.h"
10
11namespace hamilt
12{
13
14#ifndef __OPEXXTEMPLATE
15#define __OPEXXTEMPLATE
16
17template <class T>
18class OperatorEXX : public T
19{
20};
21
22#endif
23enum Add_Hexx_Type { R, k };
24template <typename TK, typename TR>
25class OperatorEXX<OperatorLCAO<TK, TR>> : public OperatorLCAO<TK, TR>
26{
27 using TAC = std::pair<int, std::array<int, 3>>;
28public:
29 OperatorEXX<OperatorLCAO<TK, TR>>(HS_Matrix_K<TK>* hsk_in,
31 const UnitCell& ucell,
32 const K_Vectors& kv_in,
33 std::vector<std::map<int, std::map<TAC, RI::Tensor<double>>>>* Hexxd_in = nullptr,
34 std::vector<std::map<int, std::map<TAC, RI::Tensor<std::complex<double>>>>>* Hexxc_in = nullptr,
35 Add_Hexx_Type add_hexx_type_in = Add_Hexx_Type::R,
36 const int istep_in = 0,
37 int* two_level_step_in = nullptr,
38 const bool restart_in = false);
39
40 virtual void contributeHk(int ik) override;
41 virtual void contributeHR() override;
42
43 private:
44 Add_Hexx_Type add_hexx_type = Add_Hexx_Type::R;
45 int current_spin = 0;
46 bool HR_fixed_done = false;
47
48 std::vector<std::map<int, std::map<TAC, RI::Tensor<double>>>>* Hexxd = nullptr;
49 std::vector<std::map<int, std::map<TAC, RI::Tensor<std::complex<double>>>>>* Hexxc = nullptr;
50
55 int* two_level_step = nullptr;
57 bool restart = false;
58
59 const int istep = 0; // the ion step
60
61 void add_loaded_Hexx(const int ik);
62
63 const UnitCell& ucell;
64
65 const K_Vectors& kv;
66
67 // if k points has no shift, use cell_nearest to reduce the memory cost
68 RI::Cell_Nearest<int, int, 3, double, 3> cell_nearest;
69 bool use_cell_nearest = true;
70
72 std::vector<std::vector<double>> Hexxd_k_load;
73 std::vector<std::vector<std::complex<double>>> Hexxc_k_load;
74};
75
76using TAC = std::pair<int, std::array<int, 3>>;
77
78RI::Cell_Nearest<int, int, 3, double, 3> init_cell_nearest(const UnitCell& ucell, const std::array<int, 3>& Rs_period);
79
80// allocate according to the read-in HexxR, used in nscf
81template <typename Tdata, typename TR>
82void reallocate_hcontainer(const std::vector<std::map<int, std::map<TAC, RI::Tensor<Tdata>>>>& Hexxs,
83 HContainer<TR>* hR,
84 const RI::Cell_Nearest<int, int, 3, double, 3>* const cell_nearest = nullptr);
85
87template <typename TR>
88void reallocate_hcontainer(const int nat, HContainer<TR>* hR,
89 const std::array<int, 3>& Rs_period,
90 const RI::Cell_Nearest<int, int, 3, double, 3>* const cell_nearest = nullptr);
91
92} // namespace hamilt
93#endif // __EXX
94#include "op_exx_lcao.hpp"
95#endif // OPEXXLCAO_H
Definition klist.h:13
Definition unitcell.h:16
Definition hcontainer.h:144
#define T
Definition exp.cpp:237
Restart restart
Definition for_testing_input_conv.h:255
int istep
Definition ions_move_basic.cpp:12
Definition hamilt.h:12
std::pair< int, TC > TAC
Definition ri_cv_io_test.cpp:10