Skip to content

Commit 88bdd3b

Browse files
authored
Update LAPACK solver (deepmodeling#6870)
1 parent 6ad3b99 commit 88bdd3b

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

source/source_hsolver/diago_lapack.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void DiagoLapack<std::complex<double>>::diag(hamilt::Hamilt<std::complex<double>
5858
Real* eigenvalue_in,
5959
MPI_Comm& comm)
6060
{
61-
ModuleBase::TITLE("DiagoScalapack", "diag_pool");
61+
ModuleBase::TITLE("DiagoLapack", "diag_pool");
6262
assert(h_mat.col == s_mat.col && h_mat.row == s_mat.row && h_mat.desc == s_mat.desc);
6363
std::vector<double> eigen(PARAM.globalv.nlocal, 0.0);
6464
this->dsygvx_diag(h_mat.col, h_mat.row, h_mat.p, s_mat.p, eigen.data(), psi);
@@ -72,7 +72,7 @@ void DiagoLapack<std::complex<double>>::diag(hamilt::Hamilt<std::complex<double>
7272
Real* eigenvalue_in,
7373
MPI_Comm& comm)
7474
{
75-
ModuleBase::TITLE("DiagoScalapack", "diag_pool");
75+
ModuleBase::TITLE("DiagoLapack", "diag_pool");
7676
assert(h_mat.col == s_mat.col && h_mat.row == s_mat.row && h_mat.desc == s_mat.desc);
7777
std::vector<double> eigen(PARAM.globalv.nlocal, 0.0);
7878
this->zhegvx_diag(h_mat.col, h_mat.row, h_mat.p, s_mat.p, eigen.data(), psi);
@@ -207,9 +207,7 @@ std::pair<int, std::vector<int>> DiagoLapack<T>::zhegvx_once(const int ncol,
207207
const int itype = 1, il = 1, iu = PARAM.inp.nbands, one = 1;
208208
int M = 0, NZ = 0, lwork = -1, lrwork = -1, liwork = -1, info = 0;
209209
const double abstol = 0, orfac = -1;
210-
//Note: pzhegvx_ has a bug
211-
// We must give vl,vu a value, although we do not use range 'V'
212-
// We must give rwork at least a memory of sizeof(double) * 3
210+
213211
const double vl = 0, vu = 0;
214212
std::vector<std::complex<double>> work(1, 0);
215213
std::vector<double> rwork(3, 0);

source/source_hsolver/hsolver_lcao.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void HSolverLCAO<TK, Device>::solve(hamilt::Hamilt<TK>* pHamilt,
6161
}else
6262
#endif
6363
if (PARAM.globalv.kpar_lcao > 1
64-
&& (this->method == "genelpa" || this->method == "elpa" || this->method == "scalapack_gvx"))
64+
&& (this->method == "genelpa" || this->method == "elpa" || this->method == "scalapack_gvx" || this->method == "lapack"))
6565
{
6666
this->parakSolve(pHamilt, psi, pes, PARAM.globalv.kpar_lcao);
6767
} else
@@ -254,6 +254,11 @@ void HSolverLCAO<T, Device>::parakSolve(hamilt::Hamilt<T>* pHamilt,
254254
DiagoScalapack<T> sa;
255255
sa.diag_pool(hk_pool, sk_pool, psi_pool, &(pes->ekb(ik_global, 0)), k2d.POOL_WORLD_K2D);
256256
}
257+
else if (this->method == "lapack")
258+
{
259+
DiagoLapack<T> la;
260+
la.diag_pool(hk_pool, sk_pool, psi_pool, &(pes->ekb(ik_global, 0)), k2d.POOL_WORLD_K2D);
261+
}
257262
#ifdef __ELPA
258263
else if (this->method == "genelpa")
259264
{

0 commit comments

Comments
 (0)