Skip to content

Commit c6e1aae

Browse files
committed
fix bug
1 parent a8bdbda commit c6e1aae

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

source/module_hsolver/test/diago_david_float_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class DiagoDavPrepare
113113
auto hpsi_func = [phm](std::complex<float>* psi_in,std::complex<float>* hpsi_out,
114114
const int ld_psi, const int nvec)
115115
{
116-
auto psi_iter_wrapper = psi::Psi<std::complex<float>>(psi_in, 1, nvec, ld_psi, nullptr);
116+
auto psi_iter_wrapper = psi::Psi<std::complex<float>>(psi_in, 1, nvec, ld_psi);
117117
psi::Range bands_range(true, 0, 0, nvec-1);
118118
using hpsi_info = typename hamilt::Operator<std::complex<float>>::hpsi_info;
119119
hpsi_info info(&psi_iter_wrapper, bands_range, hpsi_out);

source/module_hsolver/test/diago_david_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class DiagoDavPrepare
115115
auto hpsi_func = [phm](std::complex<double>* psi_in,std::complex<double>* hpsi_out,
116116
const int ld_psi, const int nvec)
117117
{
118-
auto psi_iter_wrapper = psi::Psi<std::complex<double>>(psi_in, 1, nvec, ld_psi, nullptr);
118+
auto psi_iter_wrapper = psi::Psi<std::complex<double>>(psi_in, 1, nvec, ld_psi);
119119
psi::Range bands_range(true, 0, 0, nvec-1);
120120
using hpsi_info = typename hamilt::Operator<std::complex<double>>::hpsi_info;
121121
hpsi_info info(&psi_iter_wrapper, bands_range, hpsi_out);

source/module_lr/utils/lr_util.hpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,15 @@ namespace LR_Util
122122
int ib_now = psi_bfirst.get_current_b();
123123
int ik_now = psi_bfirst.get_current_k();
124124
psi_bfirst.fix_kb(0, 0); // for get_pointer() to get the head pointer
125-
psi::Psi<T, Device> psi_kfirst(psi_bfirst.get_pointer(), 1, psi_bfirst.get_nbands(), psi_bfirst.get_nk() * psi_bfirst.get_nbasis(), psi_bfirst.get_ngk_pointer(), true);
125+
126+
std::vector<int> ngk_vector_temp(psi_bfirst.get_nk(), 0);
127+
128+
for (size_t i = 0; i < ngk_vector_temp.size(); i++)
129+
{
130+
ngk_vector_temp[i] = psi_bfirst.get_ngk_pointer()[i];
131+
}
132+
133+
psi::Psi<T, Device> psi_kfirst(psi_bfirst.get_pointer(), 1, psi_bfirst.get_nbands(), psi_bfirst.get_nk() * psi_bfirst.get_nbasis(), ngk_vector_temp, true);
126134
psi_bfirst.fix_kb(ik_now, ib_now);
127135
return psi_kfirst;
128136
}

0 commit comments

Comments
 (0)