1+ // ===================
2+ // Author: Minye Zhang, almost completely copied from Exx.hpp
3+ // date: 2022.12.18
4+ // ===================
5+ #pragma once
6+
7+ #include " GW.h"
8+ #include " ../ri/Label.h"
9+
10+ namespace RI
11+ {
12+
13+ template <typename TA, typename Tcell, std::size_t Ndim, typename Tdata>
14+ void G0W0<TA,Tcell,Ndim,Tdata>::set_parallel(
15+ const MPI_Comm &mpi_comm_in,
16+ const std::map<TA,Tatom_pos> &atoms_pos_in,
17+ const std::array<Tatom_pos,Ndim> &latvec_in,
18+ const std::array<Tcell,Ndim> &period_in)
19+ {
20+ this ->mpi_comm = mpi_comm_in;
21+ this ->atoms_pos = atoms_pos_in;
22+ this ->latvec = latvec_in;
23+ this ->period = period_in;
24+
25+ this ->lri .set_parallel (this ->mpi_comm , this ->atoms_pos , this ->latvec , this ->period );
26+ this ->flag_finish .stru = true ;
27+ // if()
28+ // this->post_2D.set_parallel(this->mpi_comm, this->atoms_pos, this->period);
29+ }
30+
31+ template <typename TA, typename Tcell, std::size_t Ndim, typename Tdata>
32+ void G0W0<TA,Tcell,Ndim,Tdata>::set_Cs(
33+ const std::map<TA, std::map<TAC, Tensor<Tdata>>> &Cs,
34+ const Tdata_real &threshold_C)
35+ {
36+ this ->lri .set_tensors_map2 ( Cs, Label::ab::a, threshold_C );
37+ this ->lri .set_tensors_map2 ( Cs, Label::ab::b, threshold_C );
38+ this ->flag_finish .C = true ;
39+ }
40+
41+
42+ template <typename TA, typename Tcell, std::size_t Ndim, typename Tdata>
43+ void G0W0<TA, Tcell, Ndim, Tdata>::cal_Sigc(
44+ const std::map<TA, std::map<TAC, Tensor<Tdata>>> gf_tau,
45+ const Tdata_real &threshold_G,
46+ const std::map<TA, std::map<TAC, Tensor<Tdata>>> Wc_tau,
47+ const Tdata_real &threshold_W)
48+ {
49+ assert (this ->flag_finish .stru );
50+ assert (this ->flag_finish .C );
51+ // setup Green's function
52+ this ->lri .set_tensors_map2 ( gf_tau, Label::ab::a1b1, threshold_G );
53+ this ->lri .set_tensors_map2 ( gf_tau, Label::ab::a1b2, threshold_G );
54+ this ->lri .set_tensors_map2 ( gf_tau, Label::ab::a2b1, threshold_G );
55+ this ->lri .set_tensors_map2 ( gf_tau, Label::ab::a2b2, threshold_G );
56+
57+ // setup screened Coulomb interaction
58+ this ->lri .set_tensors_map2 ( Wc_tau, Label::ab::a0b0, threshold_W );
59+
60+ std::vector<std::map<TA, std::map<TAC, Tensor<Tdata>>>> Sigc_vec (1 );
61+ this ->lri .coefficients = {nullptr };
62+ this ->lri .cal (
63+ {Label::ab_ab::a0b0_a1b1,
64+ Label::ab_ab::a0b0_a1b2,
65+ Label::ab_ab::a0b0_a2b1,
66+ Label::ab_ab::a0b0_a2b2},
67+ Sigc_vec);
68+ this ->Sigc_tau = std::move (Sigc_vec[0 ]);
69+ }
70+
71+ } // namespace RI
0 commit comments