Skip to content

Commit 9b60a10

Browse files
committed
fix bug in sdft
1 parent 9c014d8 commit 9b60a10

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

source/module_base/math_chebyshev.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,7 @@ bool Chebyshev<REAL>::checkconverge(
575575
std::function<void(std::complex<REAL>* in, std::complex<REAL>* out, const int)> funA,
576576
std::complex<REAL>* wavein,
577577
const int N,
578+
const int LDA,
578579
REAL& tmax,
579580
REAL& tmin,
580581
REAL stept)
@@ -584,9 +585,9 @@ bool Chebyshev<REAL>::checkconverge(
584585
std::complex<REAL>* arrayn;
585586
std::complex<REAL>* arrayn_1;
586587

587-
arraynp1 = new std::complex<REAL>[N];
588-
arrayn = new std::complex<REAL>[N];
589-
arrayn_1 = new std::complex<REAL>[N];
588+
arraynp1 = new std::complex<REAL>[LDA];
589+
arrayn = new std::complex<REAL>[LDA];
590+
arrayn_1 = new std::complex<REAL>[LDA];
590591

591592
ModuleBase::GlobalFunc::DCOPY(wavein, arrayn_1, N);
592593

source/module_base/math_chebyshev.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ class Chebyshev
191191
bool checkconverge(std::function<void(std::complex<REAL>* in, std::complex<REAL>* out, const int)> funA,
192192
std::complex<REAL>* wavein,
193193
const int N,
194+
const int LDA,
194195
REAL& tmax, // trial number for upper bound
195196
REAL& tmin, // trial number for lower bound
196197
REAL stept); // tmax = max() + stept, tmin = min() - stept

source/module_hamilt_pw/hamilt_stodft/sto_iter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ void Stochastic_Iter::checkemm(const int& ik, const int istep, const int iter, S
140140
std::placeholders::_1,
141141
std::placeholders::_2,
142142
std::placeholders::_3);
143-
converge = p_che->checkconverge(hchi_norm, pchi, npw, *p_hamilt_sto->emax, *p_hamilt_sto->emin, 5.0);
143+
converge = p_che->checkconverge(hchi_norm, pchi, npw, stowf.npwx, *p_hamilt_sto->emax, *p_hamilt_sto->emin, 5.0);
144144

145145
if (!converge)
146146
{

source/module_hamilt_pw/hamilt_stodft/sto_tool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void check_che(const int& nche_in,
7474
std::placeholders::_1,
7575
std::placeholders::_2,
7676
std::placeholders::_3);
77-
converge = chetest.checkconverge(hchi_norm, pchi, npw, *p_hamilt_sto->emax, *p_hamilt_sto->emin, 2.0);
77+
converge = chetest.checkconverge(hchi_norm, pchi, npw, p_stowf->npwx, *p_hamilt_sto->emax, *p_hamilt_sto->emin, 2.0);
7878

7979
if (!converge)
8080
{

0 commit comments

Comments
 (0)