Skip to content

Commit

Permalink
fix compile without LibRI
Browse files Browse the repository at this point in the history
  • Loading branch information
maki49 committed Sep 11, 2024
1 parent 64d7be0 commit b66049b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
4 changes: 4 additions & 0 deletions source/module_lr/esolver_lrtd_lcao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,13 +561,17 @@ void LR::ESolver_LR<T, TR>::read_ks_wfc()

if (input.ri_hartree_benchmark == "aims") // for aims benchmark
{
#ifdef __EXX
int ncore = 0;
std::vector<double> eig_ks_vec = RI_Benchmark::read_aims_ebands<double>(GlobalV::global_readin_dir + "band_out", nocc, nvirt, ncore);
std::cout << "ncore=" << ncore << ", nocc=" << nocc << ", nvirt=" << nvirt << ", nbands=" << this->nbands << std::endl;
std::cout << "eig_ks_vec.size()=" << eig_ks_vec.size() << std::endl;
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<T>(*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)) {
Expand Down
4 changes: 4 additions & 0 deletions source/module_lr/hamilt_casida.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ namespace LR
#endif
if (ri_hartree_benchmark != "none")
{
#ifdef __EXX
if (spin_type == "Spin Singlet")
{
if (ri_hartree_benchmark == "aims")
Expand All @@ -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::endl;}
#else
ModuleBase::WARNING_QUIT("ESolver_LR", "RI benchmark is only supported when compile with LibRI.");
#endif
}
else
#endif
Expand Down
4 changes: 3 additions & 1 deletion source/module_lr/ri_benchmark/ri_benchmark.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifdef __EXX
#pragma once
#include "module_cell/unitcell.h"
#include "module_psi/psi.h"
Expand Down Expand Up @@ -75,4 +76,5 @@ namespace RI_Benchmark
template <typename TR>
std::vector<TLRI<TR>> split_Ds(const std::vector<std::vector<TR>>& Ds, const std::vector<int>& aims_nbasis, const UnitCell& ucell);
}
#include "ri_benchmark.hpp"
#include "ri_benchmark.hpp"
#endif
12 changes: 7 additions & 5 deletions source/module_lr/ri_benchmark/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
AddTest(
TARGET ri_benchmark_test
LIBS psi base ${math_libs} device container
SOURCES ri_benchmark_test.cpp
)
if (ENABLE_LIBRI)
AddTest(
TARGET ri_benchmark_test
LIBS psi base ${math_libs} device container
SOURCES ri_benchmark_test.cpp
)
endif()

0 comments on commit b66049b

Please sign in to comment.