Skip to content

Commit 36b7f71

Browse files
Fix: adapt to the latest instruction for variable conv_esolver
1 parent 412df28 commit 36b7f71

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

examples/hse/pw_Si2/INPUT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ smearing_method fixed
1515
mixing_type broyden
1616
mixing_beta 0.7
1717

18-
dft_functional pbe0
18+
dft_functional hse
1919

2020
# init_wfc file
2121
# init_chg file

source/module_esolver/esolver_ks.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -661,21 +661,21 @@ void ESolver_KS<T, Device>::iter_finish(UnitCell& ucell, const int istep, int& i
661661
this->pelec->cal_energies(1);
662662
this->pelec->cal_energies(2);
663663

664-
// for separate loop in hybrid functionals in pw
665-
// this gives correct energy for the first "pure" functional loop
666-
// and update the functional for the next loop
667-
if (PARAM.inp.basis_type == "pw")
668-
{
669-
auto p_esolver_ks_pw = dynamic_cast<ESolver_KS_PW<T, Device>*>(this);
670-
671-
if (this->conv_esolver && GlobalC::exx_info.info_global.cal_exx && GlobalC::exx_info.info_global.separate_loop && p_esolver_ks_pw->exx_helper.first_iter)
672-
{
673-
this->conv_esolver = false;
674-
XC_Functional::set_xc_type(ucell.atoms[0].ncpp.xc_func);
675-
this->update_pot(ucell, istep, iter);
676-
this->conv_esolver = true;
677-
}
678-
}
664+
// // for separate loop in hybrid functionals in pw
665+
// // this gives correct energy for the first "pure" functional loop
666+
// // and update the functional for the next loop
667+
// if (PARAM.inp.basis_type == "pw")
668+
// {
669+
// auto p_esolver_ks_pw = dynamic_cast<ESolver_KS_PW<T, Device>*>(this);
670+
//
671+
// if (conv_esolver && GlobalC::exx_info.info_global.cal_exx && GlobalC::exx_info.info_global.separate_loop && p_esolver_ks_pw->exx_helper.first_iter)
672+
// {
673+
// conv_esolver = false;
674+
// XC_Functional::set_xc_type(ucell.atoms[0].ncpp.xc_func);
675+
// this->update_pot(ucell, istep, iter, conv_esolver);
676+
// conv_esolver = true;
677+
// }
678+
// }
679679

680680
if (iter == 1)
681681
{

source/module_esolver/esolver_ks_pw.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -568,15 +568,19 @@ void ESolver_KS_PW<T, Device>::iter_finish(UnitCell& ucell, const int istep, int
568568
{
569569
if (GlobalC::exx_info.info_global.separate_loop)
570570
{
571-
if (this->conv_esolver)
571+
if (conv_esolver)
572572
{
573573
std::cout << " setting psi for exx inner loop" << std::endl;
574574
exx_helper.set_psi(this->kspw_psi[0]);
575575

576-
this->conv_esolver = exx_helper.exx_after_converge(iter);
577-
exx_helper.first_iter = false;
576+
conv_esolver = exx_helper.exx_after_converge(iter);
578577

579-
XC_Functional::set_xc_type(ucell.atoms[0].ncpp.xc_func);
578+
if (!conv_esolver)
579+
{
580+
exx_helper.first_iter = false;
581+
XC_Functional::set_xc_type(ucell.atoms[0].ncpp.xc_func);
582+
update_pot(ucell, istep, iter, conv_esolver);
583+
}
580584
}
581585
}
582586
else

source/module_hamilt_pw/hamilt_pwdft/operator_pw/op_exx_pw.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,7 @@ void OperatorEXXPW<T, Device>::act_op_ace(const int nbands,
288288
char trans_N = 'N', trans_T = 'T', trans_C = 'C';
289289
T intermediate_one = 1.0, intermediate_zero = 0.0, intermediate_minus_one = -1.0;
290290
// Xi * psi
291-
gemm_complex_op()(this->ctx,
292-
trans_N,
291+
gemm_complex_op()(trans_N,
293292
trans_N,
294293
nbands_tot,
295294
nbands,
@@ -307,8 +306,7 @@ void OperatorEXXPW<T, Device>::act_op_ace(const int nbands,
307306
Parallel_Reduce::reduce_pool(Xi_psi, nbands_tot * nbands);
308307

309308
// Xi^\dagger * (Xi * psi)
310-
gemm_complex_op()(this->ctx,
311-
trans_C,
309+
gemm_complex_op()(trans_C,
312310
trans_N,
313311
nbasis,
314312
nbands,
@@ -415,8 +413,7 @@ void OperatorEXXPW<T, Device>::construct_ace() const
415413

416414
// psi_h_psi_ace = psi^\dagger * h_psi_ace
417415
// p_exx_helper->psi.fix_kb(0, 0);
418-
gemm_complex_op()(this->ctx,
419-
'C',
416+
gemm_complex_op()('C',
420417
'N',
421418
nbands,
422419
nbands,
@@ -512,8 +509,7 @@ void OperatorEXXPW<T, Device>::construct_ace() const
512509
// }
513510

514511
// Xi_ace = L_ace^-1 * h_psi_ace^dagger
515-
gemm_complex_op()(this->ctx,
516-
'N',
512+
gemm_complex_op()('N',
517513
'C',
518514
nbands,
519515
npwk,

0 commit comments

Comments
 (0)