11 template<
typename T =
double>
15 static const size_t Ndim = 3;
16 using TC = std::array<int, Ndim>;
17 using TAC = std::pair<TA, TC>;
20 OperatorLREXX(
const int& nspin,
33 const double& alpha = 1.0,
34 const std::vector<int>& aims_nbasis = {})
35 : nspin(nspin), naos(naos), nocc(nocc), nvirt(nvirt), nk(kv_in.get_nks() / nspin),
36 psi_ks(psi_ks_in), DM_trans(DM_trans_in), exx_lri(exx_lri_in), kv(kv_in),
37 pX(pX_in), pc(pc_in), pmat(pmat_in), ucell(ucell_in), alpha(alpha),
38 aims_nbasis(aims_nbasis)
42 this->is_first_node =
false;
45 this->psi_ks_full.resize(this->nk, nocc + nvirt, this->naos);
46 for (
int ik = 0;ik < nk;++ik)
55 this->allocate_Ds_onebase();
56 this->exx_lri.lock()->Hexxs.resize(1);
59 void init(
const int ik_in)
override {};
61 virtual void act(
const int nbands,
67 const bool is_first_node =
false)
const override;
76 const double alpha = 1.0;
77 const bool cal_dm_trans =
false;
78 const bool tdm_sym =
false;
83 const std::vector<int> aims_nbasis={};
86 std::unique_ptr<elecstate::DensityMatrix<T, T>>& DM_trans;
92 mutable std::map<TA, std::map<TAC, RI::Tensor<T>>> Ds_onebase;
95 std::vector<std::array<int, Ndim>> BvK_cells;
104 std::weak_ptr<Exx_LRI<T>> exx_lri;
115 void allocate_Ds_onebase();
117 void cal_DM_onebase(
const int io,
const int iv,
const int ik)
const;
This class packs the basic information of 2D-block-cyclic parallel distribution of an arbitrary matri...
Definition parallel_2d.h:12
Definition parallel_orbitals.h:9
Definition density_matrix.h:36
#define T
Definition exp.cpp:237
void gather_2d_to_full(const Parallel_2D &pv, const T *submat, T *fullmat, bool col_first, int global_nrow, int global_ncol)
gather 2d matrix to full matrix the defination of row and col is consistent with setup_2d_division
Definition lr_util.hpp:148
Definition esolver_ks_lcao.h:37
void TITLE(const std::string &class_name, const std::string &function_name, const bool disable)
Definition tool_title.cpp:18
int TA
Definition RI_2D_Comm.h:25
std::array< int, 3 > get_Born_vonKarmen_period(const K_Vectors &kv)
Definition RI_Util.hpp:16
std::vector< std::array< Tcell, Ndim > > get_Born_von_Karmen_cells(const std::array< Tcell, Ndim > &Born_von_Karman_period)
Definition RI_Util.hpp:34
std::array< int, 3 > TC
Definition ri_cv_io_test.cpp:9
std::pair< int, TC > TAC
Definition ri_cv_io_test.cpp:10