Skip to content

Commit b3340bb

Browse files
committed
Refactor: update access permissions of variables in esolver
1 parent 2d09ea6 commit b3340bb

File tree

4 files changed

+31
-33
lines changed

4 files changed

+31
-33
lines changed

source/module_esolver/esolver_fp.h

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,7 @@ namespace ModuleESolver
2222
{
2323
class ESolver_FP : public ESolver
2424
{
25-
public:
26-
27-
ModulePW::PW_Basis* pw_rho;
28-
29-
/**
30-
* @brief same as pw_rho for ncpp. Here 'd' stands for 'dense'
31-
* dense grid for for uspp, used for ultrasoft augmented charge density.
32-
* charge density and potential are defined on dense grids,
33-
* but effective potential needs to be interpolated on smooth grids in order to compute Veff|psi>
34-
*/
35-
ModulePW::PW_Basis* pw_rhod;
36-
ModulePW::PW_Basis_Big* pw_big; ///< [temp] pw_basis_big class
37-
25+
public:
3826
//! Constructor
3927
ESolver_FP();
4028

@@ -44,6 +32,10 @@ namespace ModuleESolver
4432
//! Initialize of the first-principels energy solver
4533
virtual void before_all_runners(const Input_para& inp, UnitCell& cell) override;
4634

35+
protected:
36+
//! Something to do after SCF iterations when SCF is converged or comes to the max iter step.
37+
virtual void after_scf(const int istep);
38+
4739
virtual void init_after_vc(const Input_para& inp, UnitCell& cell); // liuyu add 2023-03-09
4840

4941
//! Electronic states
@@ -58,9 +50,16 @@ namespace ModuleESolver
5850
//! K points in Brillouin zone
5951
K_Vectors kv;
6052

61-
protected:
62-
//! Something to do after SCF iterations when SCF is converged or comes to the max iter step.
63-
virtual void after_scf(const int istep);
53+
ModulePW::PW_Basis* pw_rho;
54+
55+
/**
56+
* @brief same as pw_rho for ncpp. Here 'd' stands for 'dense'
57+
* dense grid for for uspp, used for ultrasoft augmented charge density.
58+
* charge density and potential are defined on dense grids,
59+
* but effective potential needs to be interpolated on smooth grids in order to compute Veff|psi>
60+
*/
61+
ModulePW::PW_Basis* pw_rhod;
62+
ModulePW::PW_Basis_Big* pw_big; ///< [temp] pw_basis_big class
6463

6564
//! Charge extrapolation
6665
Charge_Extra CE;

source/module_esolver/esolver_ks_lcao_tddft.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ class ESolver_KS_LCAO_TDDFT : public ESolver_KS_LCAO<std::complex<double>, doubl
1818

1919
void before_all_runners(const Input_para& inp, UnitCell& cell) override;
2020

21+
protected:
22+
virtual void hamilt2density_single(const int istep, const int iter, const double ethr) override;
23+
24+
virtual void update_pot(const int istep, const int iter) override;
25+
26+
virtual void iter_finish(const int istep, int& iter) override;
27+
28+
virtual void after_scf(const int istep) override;
29+
2130
//! wave functions of last time step
2231
psi::Psi<std::complex<double>>* psi_laststep = nullptr;
2332

@@ -31,16 +40,6 @@ class ESolver_KS_LCAO_TDDFT : public ESolver_KS_LCAO<std::complex<double>, doubl
3140
elecstate::ElecStateLCAO_TDDFT* pelec_td = nullptr;
3241

3342
int td_htype = 1;
34-
35-
protected:
36-
37-
virtual void hamilt2density_single(const int istep, const int iter, const double ethr) override;
38-
39-
virtual void update_pot(const int istep, const int iter) override;
40-
41-
virtual void iter_finish(const int istep, int& iter) override;
42-
43-
virtual void after_scf(const int istep) override;
4443
};
4544

4645
} // namespace ModuleESolver

source/module_esolver/esolver_ks_lcaopw.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ namespace ModuleESolver
2020

2121
~ESolver_KS_LIP();
2222

23-
/// All the other interfaces except this one are the same as ESolver_KS_PW.
24-
virtual void hamilt2density_single(const int istep, const int iter, const double ethr) override;
25-
2623
void before_all_runners(const Input_para& inp, UnitCell& cell) override;
2724
void after_all_runners()override;
2825

2926
protected:
3027
virtual void iter_init(const int istep, const int iter) override;
3128
virtual void iter_finish(const int istep, int& iter) override;
3229

30+
/// All the other interfaces except this one are the same as ESolver_KS_PW.
31+
virtual void hamilt2density_single(const int istep, const int iter, const double ethr) override;
32+
3333
virtual void allocate_hamilt() override;
3434
virtual void deallocate_hamilt() override;
3535

source/module_esolver/esolver_ks_pw.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,12 @@ class ESolver_KS_PW : public ESolver_KS<T, Device>
2323

2424
void before_all_runners(const Input_para& inp, UnitCell& cell) override;
2525

26-
void init_after_vc(const Input_para& inp, UnitCell& cell) override;
27-
2826
double cal_energy() override;
2927

3028
void cal_force(ModuleBase::matrix& force) override;
3129

3230
void cal_stress(ModuleBase::matrix& stress) override;
3331

34-
virtual void hamilt2density_single(const int istep, const int iter, const double ethr) override;
35-
3632
void after_all_runners() override;
3733

3834
protected:
@@ -48,6 +44,10 @@ class ESolver_KS_PW : public ESolver_KS<T, Device>
4844

4945
virtual void others(const int istep) override;
5046

47+
virtual void hamilt2density_single(const int istep, const int iter, const double ethr) override;
48+
49+
void init_after_vc(const Input_para& inp, UnitCell& cell) override;
50+
5151
// temporary, this will be removed in the future;
5252
// Init Global class
5353
void Init_GlobalC(const Input_para& inp, UnitCell& ucell, pseudopot_cell_vnl& ppcell);

0 commit comments

Comments
 (0)