Skip to content

Commit f9bfddb

Browse files
committed
remove wf from esolver
1 parent 88468ac commit f9bfddb

File tree

4 files changed

+16
-19
lines changed

4 files changed

+16
-19
lines changed

source/module_esolver/esolver_ks.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ class ESolver_KS : public ESolver_FP
6565
//! Charge mixing method, only used in KDSFT, not in OFDFT
6666
Charge_Mixing* p_chgmix = nullptr;
6767

68-
//! wave functions, this one may be deleted in near future
69-
//! mohan note 2024-11-14
70-
wavefunc wf;
71-
7268
//! Electronic wavefunctions
7369
psi::Psi<T>* psi = nullptr;
7470

source/module_esolver/esolver_ks_pw.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ void ESolver_KS_PW<T, Device>::before_all_runners(const Input_para& inp, UnitCel
185185
PARAM.inp.ks_solver,
186186
PARAM.inp.basis_type,
187187
PARAM.inp.psi_initializer,
188-
&this->wf,
189188
this->pw_wfc);
190189
this->p_wf_init->prepare_init(&(this->sf),
191190
&ucell,

source/module_hamilt_pw/hamilt_pwdft/psiinit.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ PSIInit<T, Device>::PSIInit(const std::string& init_wfc_in,
1818
const std::string& ks_solver_in,
1919
const std::string& basis_type_in,
2020
const bool& use_psiinitializer_in,
21-
wavefunc* p_wf_in,
2221
ModulePW::PW_Basis_K* pw_wfc_in)
2322
{
2423
this->init_wfc = init_wfc_in;
2524
this->ks_solver = ks_solver_in;
2625
this->basis_type = basis_type_in;
2726
this->use_psiinitializer = use_psiinitializer_in;
28-
this->p_wf = p_wf_in;
2927
this->pw_wfc = pw_wfc_in;
3028
}
3129

@@ -122,16 +120,16 @@ void PSIInit<T, Device>::allocate_psi(Psi<std::complex<double>>*& psi,
122120
// old method explicitly requires variables such as total number of kpoints, number
123121
// of bands, number of G-vectors, and so on. Comparatively in new method, these
124122
// variables are imported in function called initialize.
125-
psi = this->p_wf->allocate(nkstot, nks, ngk, npwx);
123+
psi = this->wf_old.allocate(nkstot, nks, ngk, npwx);
126124

127125
// however, init_at_1 does not actually initialize the psi, instead, it is a
128126
// function to calculate a interpolate table saving overlap intergral or say
129127
// Spherical Bessel Transform of atomic orbitals.
130-
this->p_wf->init_at_1(p_sf);
128+
this->wf_old.init_at_1(p_sf);
131129
// similarly, wfcinit not really initialize any wavefunction, instead, it initialize
132130
// the mapping from ixy, the 1d flattened index of point on fft grid (x, y) plane,
133131
// to the index of "stick", composed of grid points.
134-
this->p_wf->wfcinit(psi, pw_wfc);
132+
this->wf_old.wfcinit(psi, pw_wfc);
135133
}
136134
}
137135

@@ -143,8 +141,8 @@ void PSIInit<T, Device>::make_table(const int nks, Structure_Factor* p_sf)
143141
} // do not need to do anything because the interpolate table is unchanged
144142
else // old initialization method, used in EXX calculation
145143
{
146-
this->p_wf->init_after_vc(nks); // reallocate wanf2, the planewave expansion of lcao
147-
this->p_wf->init_at_1(p_sf); // re-calculate tab_at, the overlap matrix between atomic pswfc and jlq
144+
this->wf_old.init_after_vc(nks); // reallocate wanf2, the planewave expansion of lcao
145+
this->wf_old.init_at_1(p_sf); // re-calculate tab_at, the overlap matrix between atomic pswfc and jlq
148146
}
149147
}
150148

@@ -271,7 +269,7 @@ void PSIInit<T, Device>::initialize_psi(Psi<std::complex<double>>* psi,
271269
kspw_psi->fix_k(ik);
272270

273271
/// for psi init guess!!!!
274-
hamilt::diago_PAO_in_pw_k2(this->ctx, ik, *(kspw_psi), this->pw_wfc, this->p_wf, p_hamilt);
272+
hamilt::diago_PAO_in_pw_k2(this->ctx, ik, *(kspw_psi), this->pw_wfc, &this->wf_old, p_hamilt);
275273
}
276274
}
277275
else
@@ -280,7 +278,7 @@ void PSIInit<T, Device>::initialize_psi(Psi<std::complex<double>>* psi,
280278
kspw_psi->fix_k(ik);
281279

282280
/// for psi init guess!!!!
283-
hamilt::diago_PAO_in_pw_k2(this->ctx, ik, *(kspw_psi), this->pw_wfc, this->p_wf, p_hamilt);
281+
hamilt::diago_PAO_in_pw_k2(this->ctx, ik, *(kspw_psi), this->pw_wfc, &this->wf_old, p_hamilt);
284282
}
285283
}
286284
}

source/module_hamilt_pw/hamilt_pwdft/psiinit.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ class PSIInit
1616
const std::string& ks_solver_in,
1717
const std::string& basis_type_in,
1818
const bool& use_psiinitializer_in,
19-
wavefunc* p_wf_in,
2019
ModulePW::PW_Basis_K* pw_wfc_in);
2120
~PSIInit(){};
2221

@@ -47,7 +46,7 @@ class PSIInit
4746
*
4847
* @param psi store the wavefunction
4948
* @param p_hamilt Hamiltonian operator
50-
* @param ofs_running output stream for running information
49+
* @param ofs_running output stream for running information
5150
* @param is_already_initpsi whether psi has been initialized
5251
*/
5352
void initialize_psi(Psi<std::complex<double>>* psi,
@@ -73,17 +72,22 @@ class PSIInit
7372
// while the std::make_unique() is not supported till C++14,
7473
// so use the new and std::unique_ptr to manage the memory, but this makes new-delete not symmetric
7574
std::unique_ptr<psi_initializer<T, Device>> psi_init;
76-
// temporary
77-
// wavefunc pointer
78-
wavefunc* p_wf = nullptr;
75+
76+
//! temporary: wave functions, this one may be deleted in future
77+
wavefunc wf_old;
78+
7979
// whether to use psi_initializer
8080
bool use_psiinitializer = false;
81+
8182
// wavefunction initialization type
8283
std::string init_wfc = "none";
84+
8385
// Kohn-Sham solver type
8486
std::string ks_solver = "none";
87+
8588
// basis type
8689
std::string basis_type = "none";
90+
8791
// pw basis
8892
ModulePW::PW_Basis_K* pw_wfc = nullptr;
8993

0 commit comments

Comments
 (0)