Skip to content

Commit b541cbf

Browse files
committed
fix bug
1 parent de51553 commit b541cbf

File tree

6 files changed

+260
-349
lines changed

6 files changed

+260
-349
lines changed

examples/scf/pw_Si2/test.txt

Lines changed: 0 additions & 132 deletions
This file was deleted.

source/module_esolver/esolver_ks_pw.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,27 @@ void ESolver_KS_PW<T, Device>::hamilt2density_single(const int istep, const int
359359
}
360360
bool skip_charge = PARAM.inp.calculation == "nscf" ? true : false;
361361

362+
//---------------------------------------------------------------------------------------------------------------
363+
//---------------------------------for psi init guess!!!!--------------------------------------------------------
364+
//---------------------------------------------------------------------------------------------------------------
365+
if (!PARAM.inp.psi_initializer && PARAM.inp.basis_type == "pw" && iter == 1)
366+
{
367+
for (int ik = 0; ik < this->pw_wfc->nks; ++ik)
368+
{
369+
//! Update Hamiltonian from other kpoint to the given one
370+
this->p_hamilt->updateHk(ik);
371+
372+
//! Fix the wavefunction to initialize at given kpoint
373+
this->kspw_psi->fix_k(ik);
374+
375+
/// for psi init guess!!!!
376+
hamilt::diago_PAO_in_pw_k2(this->ctx, ik, *(this->kspw_psi), this->pw_wfc, &this->wf, this->p_hamilt);
377+
}
378+
}
379+
//---------------------------------------------------------------------------------------------------------------
380+
//---------------------------------END: for psi init guess!!!!--------------------------------------------------------
381+
//---------------------------------------------------------------------------------------------------------------
382+
362383
hsolver::HSolverPW<T, Device> hsolver_pw_obj(this->pw_wfc,
363384
&this->wf,
364385
PARAM.inp.calculation,

source/module_esolver/esolver_sdft_pw.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,28 @@ void ESolver_SDFT_PW<T, Device>::hamilt2density_single(int istep, int iter, doub
187187
hsolver::DiagoIterAssist<T, Device>::PW_DIAG_THR = ethr;
188188
hsolver::DiagoIterAssist<T, Device>::PW_DIAG_NMAX = PARAM.inp.pw_diag_nmax;
189189

190+
//---------------------------------------------------------------------------------------------------------------
191+
//---------------------------------for psi init guess!!!!--------------------------------------------------------
192+
//---------------------------------------------------------------------------------------------------------------
193+
if (!PARAM.inp.psi_initializer && PARAM.inp.basis_type == "pw" && iter == 1)
194+
{
195+
for (int ik = 0; ik < this->pw_wfc->nks; ++ik)
196+
{
197+
//! Update Hamiltonian from other kpoint to the given one
198+
this->p_hamilt->updateHk(ik);
199+
200+
//! Fix the wavefunction to initialize at given kpoint
201+
this->kspw_psi->fix_k(ik);
202+
203+
/// for psi init guess!!!!
204+
hamilt::diago_PAO_in_pw_k2(this->ctx, ik, *(this->kspw_psi), this->pw_wfc, &this->wf, this->p_hamilt);
205+
}
206+
}
207+
//---------------------------------------------------------------------------------------------------------------
208+
//---------------------------------END: for psi init guess!!!!--------------------------------------------------------
209+
//---------------------------------------------------------------------------------------------------------------
210+
211+
190212
// hsolver only exists in this function
191213
hsolver::HSolverPW_SDFT<T, Device> hsolver_pw_sdft_obj(&this->kv,
192214
this->pw_wfc,

source/module_hamilt_pw/hamilt_pwdft/wfinit.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -254,20 +254,20 @@ void WFInit<T, Device>::initialize_psi(Psi<std::complex<double>>* psi,
254254
}
255255
else
256256
{
257-
if (PARAM.inp.basis_type == "pw")
258-
{
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);
257+
// if (PARAM.inp.basis_type == "pw")
258+
// {
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);
263263

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

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-
}
270-
}
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+
// }
270+
// }
271271
}
272272

273273
ModuleBase::timer::tick("WFInit", "initialize_psi");

0 commit comments

Comments
 (0)