33#include " module_base/global_variable.h"
44#include " module_base/lapack_connector.h"
55#include " module_base/timer.h"
6+ #include " module_base/tool_quit.h"
67extern " C"
78{
89#include " module_base/blacs_connector.h"
@@ -54,6 +55,7 @@ inline int set_elpahandle(elpa_t &handle,
5455
5556void DiagoElpa::diag (hamilt::Hamilt *phm_in, psi::Psi<std::complex <double >> &psi, double *eigenvalue_in)
5657{
58+ #ifdef __MPI
5759 matcd h_mat, s_mat;
5860 phm_in->matrix (h_mat, s_mat);
5961
@@ -86,10 +88,14 @@ void DiagoElpa::diag(hamilt::Hamilt *phm_in, psi::Psi<std::complex<double>> &psi
8688 // the eigenvalues.
8789 const int inc = 1 ;
8890 BlasConnector::copy (GlobalV::NBANDS, eigen.data (), inc, eigenvalue_in, inc);
91+ #elif
92+ ModuleBase::WARNING_QUIT (" DiagoElpa" , " DiagoElpa only can be used with macro __MPI" );
93+ #endif
8994}
9095
9196void DiagoElpa::diag (hamilt::Hamilt *phm_in, psi::Psi<double > &psi, double *eigenvalue_in)
9297{
98+ #ifdef __MPI
9399 matd h_mat, s_mat;
94100 phm_in->matrix (h_mat, s_mat);
95101
@@ -134,8 +140,12 @@ void DiagoElpa::diag(hamilt::Hamilt *phm_in, psi::Psi<double> &psi, double *eige
134140 ModuleBase::GlobalFunc::OUT (GlobalV::ofs_running, " K-S equation was solved by genelpa2" );
135141 BlasConnector::copy (GlobalV::NBANDS, eigen.data (), inc, eigenvalue_in, inc);
136142 ModuleBase::GlobalFunc::OUT (GlobalV::ofs_running, " eigenvalues were copied to ekb" );
143+ #elif
144+ ModuleBase::WARNING_QUIT (" DiagoElpa" , " DiagoElpa only can be used with macro __MPI" );
145+ #endif
137146}
138147
148+ #ifdef __MPI
139149bool DiagoElpa::ifElpaHandle (const bool &newIteration, const bool &ifNSCF)
140150{
141151 int doHandle = false ;
@@ -145,5 +155,6 @@ bool DiagoElpa::ifElpaHandle(const bool &newIteration, const bool &ifNSCF)
145155 doHandle = true ;
146156 return doHandle;
147157}
158+ #endif
148159
149160} // namespace hsolver
0 commit comments