Skip to content

Commit

Permalink
fix compile
Browse files Browse the repository at this point in the history
  • Loading branch information
Qianruipku committed Jan 4, 2025
1 parent cbc5a99 commit f48d076
Show file tree
Hide file tree
Showing 12 changed files with 109 additions and 404 deletions.
2 changes: 1 addition & 1 deletion source/module_esolver/esolver_ks_lcaopw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ namespace ModuleESolver
this->exx_lip = std::unique_ptr<Exx_Lip<T>>(new Exx_Lip<T>(GlobalC::exx_info.info_lip,
ucell.symm,
&this->kv,
this->p_psi_init,
this->psi_local,
this->kspw_psi,
this->pw_wfc,
this->pw_rho,
Expand Down
26 changes: 5 additions & 21 deletions source/module_esolver/esolver_ks_pw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,27 +386,11 @@ void ESolver_KS_PW<T, Device>::before_scf(UnitCell& ucell, const int istep)
auto* dftu = ModuleDFTU::DFTU::get_instance();
dftu->init(ucell, nullptr, this->kv.get_nks());
}
// after init_rho (in pelec->init_scf), we have rho now.
// before hamilt2density, we update Hk and initialize psi

// before_scf function will be called everytime before scf. However, once
// atomic coordinates changed, structure factor will change, therefore all
// atomwise properties will change. So we need to reinitialize psi every
// time before scf. But for random wavefunction, we dont, because random
// wavefunction is not related to atomic coordinates. What the old strategy
// does is only to initialize for once...
if (((PARAM.inp.init_wfc == "random") && (istep == 0)) || (PARAM.inp.init_wfc != "random"))
{
this->p_psi_init->initialize_psi(this->psi,
this->kspw_psi,
this->p_hamilt,
GlobalV::ofs_running,
this->already_initpsi);

if (this->already_initpsi == false)
{
this->already_initpsi = true;
}

if (!this->already_initpsi)
{
this->p_psi_init->initialize_psi(this->psi, this->kspw_psi, this->p_hamilt, GlobalV::ofs_running);
this->already_initpsi = true;
}

ModuleBase::timer::tick("ESolver_KS_PW", "before_scf");
Expand Down
36 changes: 0 additions & 36 deletions source/module_hsolver/test/hsolver_pw_sup.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,39 +180,3 @@ template class DiagoIterAssist<std::complex<float>, base_device::DEVICE_CPU>;
template class DiagoIterAssist<std::complex<double>, base_device::DEVICE_CPU>;

} // namespace hsolver

namespace hamilt {

template <>
void diago_PAO_in_pw_k2(
const base_device::DEVICE_CPU* ctx,
const int& ik,
psi::Psi<std::complex<float>, base_device::DEVICE_CPU>& wvf,
ModulePW::PW_Basis_K* wfc_basis,
wavefunc* p_wf,
const ModuleBase::realArray& tab_at,
const int& lmaxkb,
const UnitCell& ucell,
hamilt::Hamilt<std::complex<float>, base_device::DEVICE_CPU>* phm_in) {
for (int i = 0; i < wvf.size(); i++) {
wvf.get_pointer()[i] = std::complex<float>((float)i + 1, 0);
}
}

template <>
void diago_PAO_in_pw_k2(
const base_device::DEVICE_CPU* ctx,
const int& ik,
psi::Psi<std::complex<double>, base_device::DEVICE_CPU>& wvf,
ModulePW::PW_Basis_K* wfc_basis,
wavefunc* p_wf,
const ModuleBase::realArray& tab_at,
const int& lmaxkb,
const UnitCell& ucell,
hamilt::Hamilt<std::complex<double>, base_device::DEVICE_CPU>* phm_in) {
for (int i = 0; i < wvf.size(); i++) {
wvf.get_pointer()[i] = std::complex<double>((double)i + 1, 0);
}
}

}//namespace hsolver
6 changes: 0 additions & 6 deletions source/module_hsolver/test/hsolver_supplementary_mock.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,3 @@ K_Vectors::K_Vectors()
K_Vectors::~K_Vectors()
{
}
WF_atomic::WF_atomic()
{
}
WF_atomic::~WF_atomic()
{
}
3 changes: 0 additions & 3 deletions source/module_hsolver/test/test_hsolver_sdft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ void Stochastic_Iter<T, Device>::cal_storho(const UnitCell& ucell,
}
template class Stochastic_Iter<std::complex<double>, base_device::DEVICE_CPU>;

template class Stochastic_Iter<std::complex<double>, base_device::DEVICE_CPU>;

Charge::Charge(){};
Charge::~Charge(){};

Expand All @@ -157,7 +155,6 @@ class TestHSolverPW_SDFT : public ::testing::Test
ModulePW::PW_Basis_K pwbk;
Stochastic_WF<std::complex<double>> stowf;
K_Vectors kv;
wavefunc wf;
StoChe<double> stoche;
hamilt::HamiltSdftPW<std::complex<double>>* p_hamilt_sto = nullptr;
hsolver::HSolverPW_SDFT<std::complex<double>, base_device::DEVICE_CPU> hs_d
Expand Down
12 changes: 0 additions & 12 deletions source/module_io/test/for_testing_input_conv.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,6 @@ Structure_Factor::Structure_Factor()
Structure_Factor::~Structure_Factor()
{
}
WF_atomic::WF_atomic()
{
}
WF_atomic::~WF_atomic()
{
}
wavefunc::wavefunc()
{
}
wavefunc::~wavefunc()
{
}
UnitCell::UnitCell()
{
itia2iat.create(1, 1);
Expand Down
7 changes: 1 addition & 6 deletions source/module_psi/psi_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,12 @@ template <typename T, typename Device>
void PSIInit<T, Device>::initialize_psi(Psi<std::complex<double>>* psi,
psi::Psi<T, Device>* kspw_psi,
hamilt::Hamilt<T, Device>* p_hamilt,
std::ofstream& ofs_running,
const bool is_already_initpsi)
std::ofstream& ofs_running)
{
if (kspw_psi->get_nbands() == 0 || GlobalV::MY_STOGROUP != 0)
{
return;
}
if (is_already_initpsi)
{
return;
}
if (this->basis_type == "lcao_in_pw")
{
return;
Expand Down
3 changes: 1 addition & 2 deletions source/module_psi/psi_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ class PSIInit
void initialize_psi(Psi<std::complex<double>>* psi,
psi::Psi<T, Device>* kspw_psi,
hamilt::Hamilt<T, Device>* p_hamilt,
std::ofstream& ofs_running,
const bool is_already_initpsi);
std::ofstream& ofs_running);

/**
* @brief initialize NAOs in plane wave basis, only for LCAO_IN_PW
Expand Down
3 changes: 3 additions & 0 deletions source/module_psi/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ AddTest(
../../module_cell/parallel_kpoints.cpp
../../module_cell/test/support/mock_unitcell.cpp
../../module_io/orb_io.cpp
../../module_io/write_pao.cpp
../../module_io/read_wfc_pw.cpp
../../module_io/binstream.cpp
)
endif()

Expand Down
Loading

0 comments on commit f48d076

Please sign in to comment.