diff --git a/source/module_lr/esolver_lrtd_lcao.cpp b/source/module_lr/esolver_lrtd_lcao.cpp index d6231c7cd0..9a6b2e925d 100644 --- a/source/module_lr/esolver_lrtd_lcao.cpp +++ b/source/module_lr/esolver_lrtd_lcao.cpp @@ -561,6 +561,7 @@ void LR::ESolver_LR::read_ks_wfc() if (input.ri_hartree_benchmark == "aims") // for aims benchmark { +#ifdef __EXX int ncore = 0; std::vector eig_ks_vec = RI_Benchmark::read_aims_ebands(GlobalV::global_readin_dir + "band_out", nocc, nvirt, ncore); std::cout << "ncore=" << ncore << ", nocc=" << nocc << ", nvirt=" << nvirt << ", nbands=" << this->nbands << std::endl; @@ -568,6 +569,9 @@ void LR::ESolver_LR::read_ks_wfc() if(eig_ks_vec.size() != this->nbands) {ModuleBase::WARNING_QUIT("ESolver_LR", "read_aims_ebands failed.");}; for (int i = 0;i < nbands;++i) { this->pelec->ekb(0, i) = eig_ks_vec[i]; } RI_Benchmark::read_aims_eigenvectors(*this->psi_ks, GlobalV::global_readin_dir + "KS_eigenvectors.out", ncore, nbands, nbasis); +#else + ModuleBase::WARNING_QUIT("ESolver_LR", "RI benchmark is only supported when compile with LibRI."); +#endif } else if (!ModuleIO::read_wfc_nao(GlobalV::global_readin_dir, this->paraMat_, *this->psi_ks, this->pelec, /*skip_bands=*/this->nocc_max - this->nocc)) { diff --git a/source/module_lr/hamilt_casida.h b/source/module_lr/hamilt_casida.h index 69da43c06f..e1b83d98b6 100644 --- a/source/module_lr/hamilt_casida.h +++ b/source/module_lr/hamilt_casida.h @@ -61,6 +61,7 @@ namespace LR #endif if (ri_hartree_benchmark != "none") { +#ifdef __EXX if (spin_type == "Spin Singlet") { if (ri_hartree_benchmark == "aims") @@ -80,6 +81,9 @@ namespace LR this->ops->add(ri_hartree_op); } else if (spin_type == "Spin Triplet") {std::cout<<"f_Hxc based on grid integral is not needed."< std::vector> split_Ds(const std::vector>& Ds, const std::vector& aims_nbasis, const UnitCell& ucell); } -#include "ri_benchmark.hpp" \ No newline at end of file +#include "ri_benchmark.hpp" +#endif \ No newline at end of file diff --git a/source/module_lr/ri_benchmark/test/CMakeLists.txt b/source/module_lr/ri_benchmark/test/CMakeLists.txt index 8430235eee..e83d6d6f9f 100644 --- a/source/module_lr/ri_benchmark/test/CMakeLists.txt +++ b/source/module_lr/ri_benchmark/test/CMakeLists.txt @@ -1,5 +1,7 @@ -AddTest( - TARGET ri_benchmark_test - LIBS psi base ${math_libs} device container - SOURCES ri_benchmark_test.cpp -) \ No newline at end of file +if (ENABLE_LIBRI) + AddTest( + TARGET ri_benchmark_test + LIBS psi base ${math_libs} device container + SOURCES ri_benchmark_test.cpp + ) +endif() \ No newline at end of file