From ad1d463658eb13b5a79943795d217ee98960b837 Mon Sep 17 00:00:00 2001 From: haozhihan Date: Tue, 7 Jan 2025 15:48:43 +0800 Subject: [PATCH 1/3] fix #5819 --- source/module_hsolver/diago_iter_assist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/module_hsolver/diago_iter_assist.cpp b/source/module_hsolver/diago_iter_assist.cpp index bdb60ffaff..a2a38b069b 100644 --- a/source/module_hsolver/diago_iter_assist.cpp +++ b/source/module_hsolver/diago_iter_assist.cpp @@ -132,7 +132,7 @@ void DiagoIterAssist::diagH_subspace(const hamilt::Hamilt* nstart, &zero, temp, - dmin); + dmax); } if (!in_place) From 2a41b1d300cd5f5c405c43b3df359b822730dcb6 Mon Sep 17 00:00:00 2001 From: haozhihan Date: Thu, 9 Jan 2025 08:21:52 +0000 Subject: [PATCH 2/3] fux bug --- source/module_hsolver/diago_iter_assist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/module_hsolver/diago_iter_assist.cpp b/source/module_hsolver/diago_iter_assist.cpp index fa48ad4a95..91565f9c6b 100644 --- a/source/module_hsolver/diago_iter_assist.cpp +++ b/source/module_hsolver/diago_iter_assist.cpp @@ -136,7 +136,7 @@ void DiagoIterAssist::diagH_subspace(const hamilt::Hamilt* if (!in_place) { - matrixSetToAnother()(ctx, n_band, temp, dmin, evc.get_pointer(), dmax); + matrixSetToAnother()(ctx, n_band, temp, dmax, evc.get_pointer(), dmax); delmem_complex_op()(ctx, temp); } delmem_complex_op()(ctx, hcc); From 036af8a958d83bc036e2e5a493a6a54e0a7efbbf Mon Sep 17 00:00:00 2001 From: haozhihan Date: Thu, 9 Jan 2025 09:04:12 +0000 Subject: [PATCH 3/3] update diagH_subspace code --- source/module_hsolver/diago_iter_assist.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/module_hsolver/diago_iter_assist.cpp b/source/module_hsolver/diago_iter_assist.cpp index 91565f9c6b..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, - dmax); + ld_temp); } if (!in_place) { - matrixSetToAnother()(ctx, n_band, temp, dmax, 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);