@@ -28,8 +28,7 @@ namespace hsolver
2828
2929#ifdef USE_PAW
3030template <typename T, typename Device>
31- void HSolverPW<T, Device>::paw_func_in_kloop(const int ik,
32- const double tpiba)
31+ void HSolverPW<T, Device>::paw_func_in_kloop(const int ik, const double tpiba)
3332{
3433 if (this ->use_paw )
3534 {
@@ -97,7 +96,7 @@ void HSolverPW<T, Device>::call_paw_cell_set_currentk(const int ik)
9796}
9897
9998template <typename T, typename Device>
100- void HSolverPW<T, Device>::paw_func_after_kloop(psi::Psi<T, Device>& psi,
99+ void HSolverPW<T, Device>::paw_func_after_kloop(psi::Psi<T, Device>& psi,
101100 elecstate::ElecState* pes,
102101 const double tpiba,
103102 const int nat)
@@ -211,10 +210,10 @@ void HSolverPW<T, Device>::paw_func_after_kloop(psi::Psi<T, Device>& psi,
211210#endif
212211
213212template <typename T, typename Device>
214- void HSolverPW<T, Device>::cal_ethr_band (const double & wk,
215- const double * wg,
216- const double & ethr,
217- std::vector<double >& ethrs)
213+ void HSolverPW<T, Device>::cal_smooth_ethr (const double & wk,
214+ const double * wg,
215+ const double & ethr,
216+ std::vector<double >& ethrs)
218217{
219218 // threshold for classifying occupied and unoccupied bands
220219 const double occ_threshold = 1e-2 ;
@@ -288,7 +287,7 @@ void HSolverPW<T, Device>::solve(hamilt::Hamilt<T, Device>* pHamilt,
288287 pHamilt->updateHk (ik);
289288
290289#ifdef USE_PAW
291- this ->paw_func_in_kloop (ik,tpiba);
290+ this ->paw_func_in_kloop (ik, tpiba);
292291#endif
293292
294293 // / update psi pointer for each k point
@@ -297,14 +296,13 @@ void HSolverPW<T, Device>::solve(hamilt::Hamilt<T, Device>* pHamilt,
297296 // template add precondition calculating here
298297 update_precondition (precondition, ik, this ->wfc_basis ->npwk [ik], Real (pes->pot ->get_vl_of_0 ()));
299298
300- // only dav_subspace method used smooth threshold for all bands now,
301- // for other methods, this trick can be added in the future to accelerate calculation without accuracy loss.
302- if (this ->method == " dav_subspace" )
299+ // use smooth threshold for all iter methods
300+ if (PARAM.inp .diago_smooth_ethr == true )
303301 {
304- this ->cal_ethr_band (pes->klist ->wk [ik],
305- &pes->wg (ik, 0 ),
306- DiagoIterAssist<T, Device>::PW_DIAG_THR,
307- ethr_band);
302+ this ->cal_smooth_ethr (pes->klist ->wk [ik],
303+ &pes->wg (ik, 0 ),
304+ DiagoIterAssist<T, Device>::PW_DIAG_THR,
305+ ethr_band);
308306 }
309307
310308#ifdef USE_PAW
@@ -347,7 +345,7 @@ void HSolverPW<T, Device>::solve(hamilt::Hamilt<T, Device>* pHamilt,
347345 reinterpret_cast <elecstate::ElecStatePW<T, Device>*>(pes)->psiToRho (psi);
348346
349347#ifdef USE_PAW
350- this ->paw_func_after_kloop (psi, pes,tpiba,nat);
348+ this ->paw_func_after_kloop (psi, pes, tpiba, nat);
351349#endif
352350
353351 ModuleBase::timer::tick (" HSolverPW" , " solve" );
@@ -473,7 +471,7 @@ void HSolverPW<T, Device>::hamiltSolvePsiK(hamilt::Hamilt<T, Device>* hm,
473471 }
474472 else if (this ->method == " bpcg" )
475473 {
476- const int nband = psi.get_nbands ();
474+ const int nband = psi.get_nbands ();
477475 const int nbasis = psi.get_nbasis ();
478476 auto ngk_pointer = psi.get_ngk_pointer ();
479477 // hpsi_func (X, HX, ld, nvec) -> HX = H(X), X and HX blockvectors of size ld x nvec
0 commit comments