Skip to content

Commit 88a230f

Browse files
committed
move exx_lri_double from ESolver_KS_LCAO to Exx_LRI_Interface
1 parent a2bf20d commit 88a230f

File tree

6 files changed

+15
-14
lines changed

6 files changed

+15
-14
lines changed

source/module_esolver/esolver_ks_lcao.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,11 @@ ESolver_KS_LCAO<TK, TR>::ESolver_KS_LCAO()
8787
// because some members like two_level_step are used outside if(cal_exx)
8888
if (GlobalC::exx_info.info_ri.real_number)
8989
{
90-
this->exx_lri_double = std::make_shared<Exx_LRI<double>>(GlobalC::exx_info.info_ri);
91-
this->exd = std::make_shared<Exx_LRI_Interface<TK, double>>(exx_lri_double);
90+
this->exd = std::make_shared<Exx_LRI_Interface<TK, double>>(GlobalC::exx_info.info_ri);
9291
}
9392
else
9493
{
95-
this->exx_lri_complex = std::make_shared<Exx_LRI<std::complex<double>>>(GlobalC::exx_info.info_ri);
96-
this->exc = std::make_shared<Exx_LRI_Interface<TK, std::complex<double>>>(exx_lri_complex);
94+
this->exc = std::make_shared<Exx_LRI_Interface<TK, std::complex<double>>>(GlobalC::exx_info.info_ri);
9795
}
9896
#endif
9997
}

source/module_esolver/esolver_ks_lcao.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ class ESolver_KS_LCAO : public ESolver_KS<TK> {
9595
#ifdef __EXX
9696
std::shared_ptr<Exx_LRI_Interface<TK, double>> exd = nullptr;
9797
std::shared_ptr<Exx_LRI_Interface<TK, std::complex<double>>> exc = nullptr;
98-
std::shared_ptr<Exx_LRI<double>> exx_lri_double = nullptr;
99-
std::shared_ptr<Exx_LRI<std::complex<double>>> exx_lri_complex = nullptr;
10098
#endif
10199

102100
friend class LR::ESolver_LR<double, double>;

source/module_lr/esolver_lrtd_lcao.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,10 @@ LR::ESolver_LR<T, TR>::ESolver_LR(ModuleESolver::ESolver_KS_LCAO<T, TR>&& ks_sol
233233
{
234234
// if the same kernel is calculated in the esolver_ks, move it
235235
std::string dft_functional = LR_Util::tolower(input.dft_functional);
236-
if (ks_sol.exx_lri_double && std::is_same<T, double>::value && xc_kernel == dft_functional) {
237-
this->move_exx_lri(ks_sol.exx_lri_double);
238-
} else if (ks_sol.exx_lri_complex && std::is_same<T, std::complex<double>>::value && xc_kernel == dft_functional) {
239-
this->move_exx_lri(ks_sol.exx_lri_complex);
236+
if (ks_sol.exd && std::is_same<T, double>::value && xc_kernel == dft_functional) {
237+
this->move_exx_lri(ks_sol.exd->exx_ptr);
238+
} else if (ks_sol.exc && std::is_same<T, std::complex<double>>::value && xc_kernel == dft_functional) {
239+
this->move_exx_lri(ks_sol.exc->exx_ptr);
240240
} else // construct C, V from scratch
241241
{
242242
// set ccp_type according to the xc_kernel

source/module_ri/Exx_LRI.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class Exx_LRI
6969

7070
void reset_Cs(const std::map<TA, std::map<TAC, RI::Tensor<Tdata>>>& Cs_in) { this->exx_lri.set_Cs(Cs_in, this->info.C_threshold); }
7171
void reset_Vs(const std::map<TA, std::map<TAC, RI::Tensor<Tdata>>>& Vs_in) { this->exx_lri.set_Vs(Vs_in, this->info.V_threshold); }
72-
std::vector<std::vector<int>> get_abfs_nchis() const;
72+
//std::vector<std::vector<int>> get_abfs_nchis() const;
7373

7474
std::vector< std::map<TA, std::map<TAC, RI::Tensor<Tdata>>>> Hexxs;
7575
double Eexx;

source/module_ri/Exx_LRI.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ void Exx_LRI<Tdata>::cal_exx_stress(const double& omega, const double& lat0)
323323
ModuleBase::timer::tick("Exx_LRI", "cal_exx_stress");
324324
}
325325

326+
/*
326327
template<typename Tdata>
327328
std::vector<std::vector<int>> Exx_LRI<Tdata>::get_abfs_nchis() const
328329
{
@@ -336,5 +337,6 @@ std::vector<std::vector<int>> Exx_LRI<Tdata>::get_abfs_nchis() const
336337
}
337338
return abfs_nchis;
338339
}
340+
*/
339341

340342
#endif

source/module_ri/Exx_LRI_interface.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ class Exx_LRI_Interface
3636
using TAC = std::pair<TA, TC>;
3737

3838
/// @brief Constructor for Exx_LRI_Interface
39-
/// @param exx_ptr
40-
Exx_LRI_Interface(std::shared_ptr<Exx_LRI<Tdata>> exx_ptr) : exx_ptr(exx_ptr) {}
39+
Exx_LRI_Interface(const Exx_Info::Exx_Info_RI& info)
40+
{
41+
this->exx_ptr = std::make_shared<Exx_LRI<Tdata>>(info);
42+
}
4143
Exx_LRI_Interface() = delete;
4244

4345
/// read and write Hexxs using cereal
@@ -115,8 +117,9 @@ class Exx_LRI_Interface
115117
double etot_last_outer_loop = 0.0;
116118
elecstate::DensityMatrix<T, double>* dm_last_step;
117119

118-
private:
119120
std::shared_ptr<Exx_LRI<Tdata>> exx_ptr;
121+
122+
private:
120123
Mix_DMk_2D mix_DMk_2D;
121124

122125
bool exx_spacegroup_symmetry = false;

0 commit comments

Comments
 (0)