Skip to content

Commit 244acfa

Browse files
committed
refactor exx lcao
1 parent b997a53 commit 244acfa

File tree

3 files changed

+39
-14
lines changed

3 files changed

+39
-14
lines changed

source/source_esolver/esolver_ks_lcao.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "esolver_ks_lcao.h"
22
#include "source_estate/elecstate_tools.h"
33
#include "source_lcao/module_deltaspin/spin_constrain.h"
4-
#include "source_io/read_wfc_nao.h"
54
#include "source_lcao/hs_matrix_k.hpp" // there may be multiple definitions if using hpp
65
#include "source_estate/module_charge/symmetry_rho.h"
76
#include "source_lcao/LCAO_domain.h" // need DeePKS_init
@@ -214,19 +213,7 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(UnitCell& ucell, const int istep)
214213
}
215214

216215
// 11) set xc type before the first cal of xc in pelec->init_scf, Peize Lin add 2016-12-03
217-
#ifdef __EXX
218-
if (PARAM.inp.calculation != "nscf")
219-
{
220-
if (GlobalC::exx_info.info_ri.real_number)
221-
{
222-
this->exx_nao.exd->exx_beforescf(istep, this->kv, *this->p_chgmix, ucell, orb_);
223-
}
224-
else
225-
{
226-
this->exx_nao.exc->exx_beforescf(istep, this->kv, *this->p_chgmix, ucell, orb_);
227-
}
228-
}
229-
#endif
216+
this->exx_nao.before_scf(ucell, this->kv, orb_, this->p_chgmix, istep, PARAM.inp);
230217

231218
// 12) init_scf, should be before_scf? mohan add 2025-03-10
232219
this->pelec->init_scf(istep, ucell, this->Pgrid, this->sf.strucFac, this->locpp.numeric, ucell.symm);

source/source_lcao/setup_exx.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,34 @@ void Exx_NAO<TK>::before_runner(
6262
#endif
6363
}
6464

65+
template <typename TK>
66+
void Exx_NAO<TK>::before_scf(
67+
const UnitCell &ucell, // unitcell
68+
const K_Vectors &kv,
69+
const LCAO_Orbitals &orb, // orbital info
70+
Charge_Mixing* p_chgmix,
71+
const int istep,
72+
const Input_para& inp)
73+
{
74+
#ifdef __EXX
75+
if (PARAM.inp.calculation != "nscf")
76+
{
77+
if (GlobalC::exx_info.info_ri.real_number)
78+
{
79+
this->exd->exx_beforescf(istep, kv, *p_chgmix, ucell, orb);
80+
}
81+
else
82+
{
83+
this->exc->exx_beforescf(istep, kv, *p_chgmix, ucell, orb);
84+
}
85+
}
86+
else
87+
{
88+
// do nothing
89+
}
90+
#endif
91+
}
92+
93+
6594
template class Exx_NAO<double>;
6695
template class Exx_NAO<std::complex<double>>;

source/source_lcao/setup_exx.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "source_io/module_parameter/input_parameter.h" // Input_para
77
#include "source_basis/module_ao/parallel_orbitals.h" // parallel orbitals
88
#include "source_basis/module_ao/ORB_read.h" // orb
9+
#include "source_estate/module_charge/charge_mixing.h" // use charge mixing
910

1011
// for EXX
1112
#ifdef __EXX
@@ -35,6 +36,14 @@ class Exx_NAO
3536
const Parallel_Orbitals &pv, // parallel orbitals
3637
const Input_para& inp);
3738

39+
void before_scf(
40+
const UnitCell &ucell, // unitcell
41+
const K_Vectors &kv,
42+
const LCAO_Orbitals &orb, // orbital info
43+
Charge_Mixing* p_chgmix,
44+
const int istep,
45+
const Input_para& inp);
46+
3847
};
3948

4049

0 commit comments

Comments
 (0)