Skip to content

Commit ba0cb21

Browse files
authored
Fix: recover the wannier90 interface for lcao_in_pw case (#5177)
1 parent 3b2e5ad commit ba0cb21

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

source/module_psi/psi_initializer.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,9 @@ psi::Psi<std::complex<double>>* psi_initializer<T, Device>::allocate(const bool
8282
// std::cout << " MEMORY FOR PSI PER PROCESSOR (MB) : " << double(memory_cost_psi)/1024.0/1024.0 << std::endl;
8383
ModuleBase::Memory::record("Psi_PW", memory_cost_psi);
8484
}
85-
// for memory saving, the psig can always only hold one k-point data. But for lcao_in_pw, the psig
86-
// is actcually a transformation matrix. During the SCF, the projection might be quite time-
87-
// consuming.
88-
const int nks_psig = (this->mem_saver_ == 1 && PARAM.inp.basis_type != "lcao_in_pw")? 1 : nks_psi;
85+
// psi_initializer also works for basis transformation tasks. In this case, psig needs to allocate memory for
86+
// each kpoint, otherwise, for initializing pw wavefunction, only one kpoint's space is enough.
87+
const int nks_psig = (PARAM.inp.basis_type == "pw")? 1 : nks_psi;
8988
this->psig_ = std::make_shared<psi::Psi<T, Device>>(nks_psig,
9089
nbands_actual,
9190
nbasis_actual,

source/module_psi/psi_initializer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class psi_initializer
175175
// avoid memory leak
176176
std::shared_ptr<psi::Psi<T, Device>> psig_;
177177
private:
178-
int mem_saver_ = 1;
178+
int mem_saver_ = 0;
179179
std::string method_ = "none";
180180
int nbands_complem_ = 0;
181181
double random_mix_ = 0;

0 commit comments

Comments
 (0)