diff --git a/source/module_hsolver/diago_iter_assist.cpp b/source/module_hsolver/diago_iter_assist.cpp index 14662291c8..c05ecdf8ec 100644 --- a/source/module_hsolver/diago_iter_assist.cpp +++ b/source/module_hsolver/diago_iter_assist.cpp @@ -117,6 +117,9 @@ void DiagoIterAssist::diagH_subspace(const hamilt::Hamilt* // after generation of H and S matrix, diag them DiagoIterAssist::diagH_LAPACK(nstart, n_band, hcc, scc, nstart, en, vcc); + + const int ld_temp = in_place ? dmax : dmin; + { // code block to calculate evc gemm_op()(ctx, 'N', @@ -131,12 +134,12 @@ void DiagoIterAssist::diagH_subspace(const hamilt::Hamilt* nstart, &zero, temp, - dmin); + ld_temp); } if (!in_place) { - matrixSetToAnother()(ctx, n_band, temp, dmin, evc.get_pointer(), dmax); + matrixSetToAnother()(ctx, n_band, temp, ld_temp, evc.get_pointer(), dmax); delmem_complex_op()(ctx, temp); } delmem_complex_op()(ctx, hcc);