Skip to content

Commit de51553

Browse files
committed
fix bug
1 parent becf33a commit de51553

File tree

3 files changed

+43
-39
lines changed

3 files changed

+43
-39
lines changed

source/module_hamilt_pw/hamilt_pwdft/wfinit.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "module_base/timer.h"
55
#include "module_base/tool_quit.h"
66
#include "module_hsolver/diago_iter_assist.h"
7+
#include "module_parameter/parameter.h"
78
#include "module_psi/psi_initializer_atomic.h"
89
#include "module_psi/psi_initializer_atomic_random.h"
910
#include "module_psi/psi_initializer_nao.h"
@@ -155,7 +156,7 @@ void WFInit<T, Device>::initialize_psi(Psi<std::complex<double>>* psi,
155156
{
156157
ModuleBase::timer::tick("WFInit", "initialize_psi");
157158

158-
if (this->use_psiinitializer)
159+
if (PARAM.inp.psi_initializer)
159160
{
160161
// if psig is not allocated before, allocate it
161162
if (!this->psi_init->psig_use_count())
@@ -253,16 +254,19 @@ void WFInit<T, Device>::initialize_psi(Psi<std::complex<double>>* psi,
253254
}
254255
else
255256
{
256-
for (int ik = 0; ik < this->pw_wfc->nks; ++ik)
257+
if (PARAM.inp.basis_type == "pw")
257258
{
258-
//! Update Hamiltonian from other kpoint to the given one
259-
p_hamilt->updateHk(ik);
259+
for (int ik = 0; ik < this->pw_wfc->nks; ++ik)
260+
{
261+
//! Update Hamiltonian from other kpoint to the given one
262+
p_hamilt->updateHk(ik);
260263

261-
//! Fix the wavefunction to initialize at given kpoint
262-
kspw_psi->fix_k(ik);
264+
//! Fix the wavefunction to initialize at given kpoint
265+
kspw_psi->fix_k(ik);
263266

264-
/// for psi init guess!!!!
265-
hamilt::diago_PAO_in_pw_k2(this->ctx, ik, *kspw_psi, this->pw_wfc, this->p_wf, p_hamilt);
267+
/// for psi init guess!!!!
268+
hamilt::diago_PAO_in_pw_k2(this->ctx, ik, *kspw_psi, this->pw_wfc, this->p_wf, p_hamilt);
269+
}
266270
}
267271
}
268272

source/module_hsolver/hsolver_pw.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -264,20 +264,20 @@ void HSolverPW<T, Device>::solve(hamilt::Hamilt<T, Device>* pHamilt,
264264
//---------------------------------------------------------------------------------------------------------------
265265
//---------------------------------for psi init guess!!!!--------------------------------------------------------
266266
//---------------------------------------------------------------------------------------------------------------
267-
if (!PARAM.inp.psi_initializer && !this->initialed_psi && this->basis_type == "pw")
268-
{
269-
for (int ik = 0; ik < this->wfc_basis->nks; ++ik)
270-
{
271-
/// update H(k) for each k point
272-
pHamilt->updateHk(ik);
273-
274-
/// update psi pointer for each k point
275-
psi.fix_k(ik);
276-
277-
/// for psi init guess!!!!
278-
hamilt::diago_PAO_in_pw_k2(this->ctx, ik, psi, this->wfc_basis, this->pwf, pHamilt);
279-
}
280-
}
267+
// if (!PARAM.inp.psi_initializer && !this->initialed_psi && this->basis_type == "pw")
268+
// {
269+
// for (int ik = 0; ik < this->wfc_basis->nks; ++ik)
270+
// {
271+
// /// update H(k) for each k point
272+
// pHamilt->updateHk(ik);
273+
274+
// /// update psi pointer for each k point
275+
// psi.fix_k(ik);
276+
277+
// /// for psi init guess!!!!
278+
// hamilt::diago_PAO_in_pw_k2(this->ctx, ik, psi, this->wfc_basis, this->pwf, pHamilt);
279+
// }
280+
// }
281281
//---------------------------------------------------------------------------------------------------------------
282282
//---------------------------------------------------------------------------------------------------------------
283283
//---------------------------------------------------------------------------------------------------------------

source/module_hsolver/hsolver_pw_sdft.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,23 @@ void HSolverPW_SDFT<T, Device>::solve(hamilt::Hamilt<T, Device>* pHamilt,
3131
//---------------------------------------------------------------------------------------------------------------
3232
//---------------------------------for psi init guess!!!!--------------------------------------------------------
3333
//---------------------------------------------------------------------------------------------------------------
34-
if (!PARAM.inp.psi_initializer && !this->initialed_psi && this->basis_type == "pw")
35-
{
36-
for (int ik = 0; ik < nks; ++ik)
37-
{
38-
/// update H(k) for each k point
39-
pHamilt->updateHk(ik);
40-
41-
if (nbands > 0 && GlobalV::MY_STOGROUP == 0)
42-
{
43-
/// update psi pointer for each k point
44-
psi.fix_k(ik);
45-
46-
/// for psi init guess!!!!
47-
hamilt::diago_PAO_in_pw_k2(this->ctx, ik, psi, this->wfc_basis, this->pwf, pHamilt);
48-
}
49-
}
50-
}
34+
// if (!PARAM.inp.psi_initializer && !this->initialed_psi && this->basis_type == "pw")
35+
// {
36+
// for (int ik = 0; ik < nks; ++ik)
37+
// {
38+
// /// update H(k) for each k point
39+
// pHamilt->updateHk(ik);
40+
41+
// if (nbands > 0 && GlobalV::MY_STOGROUP == 0)
42+
// {
43+
// /// update psi pointer for each k point
44+
// psi.fix_k(ik);
45+
46+
// /// for psi init guess!!!!
47+
// hamilt::diago_PAO_in_pw_k2(this->ctx, ik, psi, this->wfc_basis, this->pwf, pHamilt);
48+
// }
49+
// }
50+
// }
5151
//---------------------------------------------------------------------------------------------------------------
5252
//---------------------------------------------------------------------------------------------------------------
5353
//---------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)