Skip to content

Commit

Permalink
Fix: recover the wannier90 interface for lcao_in_pw case (deepmodelin…
Browse files Browse the repository at this point in the history
  • Loading branch information
kirk0830 authored Sep 26, 2024
1 parent 3b2e5ad commit ba0cb21
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions source/module_psi/psi_initializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ psi::Psi<std::complex<double>>* psi_initializer<T, Device>::allocate(const bool
// std::cout << " MEMORY FOR PSI PER PROCESSOR (MB) : " << double(memory_cost_psi)/1024.0/1024.0 << std::endl;
ModuleBase::Memory::record("Psi_PW", memory_cost_psi);
}
// for memory saving, the psig can always only hold one k-point data. But for lcao_in_pw, the psig
// is actcually a transformation matrix. During the SCF, the projection might be quite time-
// consuming.
const int nks_psig = (this->mem_saver_ == 1 && PARAM.inp.basis_type != "lcao_in_pw")? 1 : nks_psi;
// psi_initializer also works for basis transformation tasks. In this case, psig needs to allocate memory for
// each kpoint, otherwise, for initializing pw wavefunction, only one kpoint's space is enough.
const int nks_psig = (PARAM.inp.basis_type == "pw")? 1 : nks_psi;
this->psig_ = std::make_shared<psi::Psi<T, Device>>(nks_psig,
nbands_actual,
nbasis_actual,
Expand Down
2 changes: 1 addition & 1 deletion source/module_psi/psi_initializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class psi_initializer
// avoid memory leak
std::shared_ptr<psi::Psi<T, Device>> psig_;
private:
int mem_saver_ = 1;
int mem_saver_ = 0;
std::string method_ = "none";
int nbands_complem_ = 0;
double random_mix_ = 0;
Expand Down

0 comments on commit ba0cb21

Please sign in to comment.