@@ -23,15 +23,16 @@ namespace ModuleESolver
2323
2424ESolver_FP::ESolver_FP ()
2525{
26- // pw_rho = new ModuleBase::PW_Basis();
27- // LCAO basis doesn't support GPU acceleration on FFT currently
2826 std::string fft_device = PARAM.inp .device ;
27+
28+ // LCAO basis doesn't support GPU acceleration on FFT currently
2929 if (PARAM.inp .basis_type == " lcao" )
3030 {
3131 fft_device = " cpu" ;
3232 }
33+
3334 pw_rho = new ModulePW::PW_Basis_Big (fft_device, PARAM.inp .precision );
34- if ( PARAM.globalv .double_grid )
35+ if (PARAM.globalv .double_grid )
3536 {
3637 pw_rhod = new ModulePW::PW_Basis_Big (fft_device, PARAM.inp .precision );
3738 }
@@ -44,6 +45,7 @@ ESolver_FP::ESolver_FP()
4445 pw_big = static_cast <ModulePW::PW_Basis_Big*>(pw_rhod);
4546 pw_big->setbxyz (PARAM.inp .bx , PARAM.inp .by , PARAM.inp .bz );
4647 sf.set (pw_rhod, PARAM.inp .nbspline );
48+
4749}
4850
4951ESolver_FP::~ESolver_FP ()
@@ -140,7 +142,7 @@ void ESolver_FP::after_scf(UnitCell& ucell, const int istep, const bool conv_eso
140142 // 2) write fermi energy
141143 ModuleIO::output_efermi (conv_esolver, this ->pelec ->eferm .ef );
142144
143- // 3) update delta rho for charge extrapolation
145+ // 3) update delta_rho for charge extrapolation
144146 CE.update_delta_rho (ucell, &(this ->chr ), &(this ->sf ));
145147
146148 if (istep % PARAM.inp .out_interval == 0 )
@@ -153,13 +155,13 @@ void ESolver_FP::after_scf(UnitCell& ucell, const int istep, const bool conv_eso
153155 double * data = nullptr ;
154156 if (PARAM.inp .dm_to_rho )
155157 {
156- data = this ->pelec -> charge -> rho [is];
157- this ->pw_rhod ->real2recip (this ->pelec -> charge -> rho [is], this ->pelec -> charge -> rhog [is]);
158+ data = this ->chr . rho [is];
159+ this ->pw_rhod ->real2recip (this ->chr . rho [is], this ->chr . rhog [is]);
158160 }
159161 else
160162 {
161- data = this ->pelec -> charge -> rho_save [is];
162- this ->pw_rhod ->real2recip (this ->pelec -> charge -> rho_save [is], this ->pelec -> charge -> rhog_save [is]);
163+ data = this ->chr . rho_save [is];
164+ this ->pw_rhod ->real2recip (this ->chr . rho_save [is], this ->chr . rhog_save [is]);
163165 }
164166 std::string fn =PARAM.globalv .global_out_dir + " /SPIN" + std::to_string (is + 1 ) + " _CHG.cube" ;
165167 ModuleIO::write_vdata_palgrid (Pgrid,
@@ -176,7 +178,7 @@ void ESolver_FP::after_scf(UnitCell& ucell, const int istep, const bool conv_eso
176178 {
177179 fn =PARAM.globalv .global_out_dir + " /SPIN" + std::to_string (is + 1 ) + " _TAU.cube" ;
178180 ModuleIO::write_vdata_palgrid (Pgrid,
179- this ->pelec -> charge -> kin_r_save [is],
181+ this ->chr . kin_r_save [is],
180182 is,
181183 PARAM.inp .nspin ,
182184 istep,
@@ -217,7 +219,7 @@ void ESolver_FP::after_scf(UnitCell& ucell, const int istep, const bool conv_eso
217219 fn,
218220 istep,
219221 this ->pw_rhod ,
220- this ->pelec -> charge ,
222+ & this ->chr ,
221223 &(ucell),
222224 this ->pelec ->pot ->get_fixed_v (),
223225 this ->solvent );
@@ -226,11 +228,11 @@ void ESolver_FP::after_scf(UnitCell& ucell, const int istep, const bool conv_eso
226228 // 6) write ELF
227229 if (PARAM.inp .out_elf [0 ] > 0 )
228230 {
229- this ->pelec -> charge -> cal_elf = true ;
231+ this ->chr . cal_elf = true ;
230232 Symmetry_rho srho;
231233 for (int is = 0 ; is < PARAM.inp .nspin ; is++)
232234 {
233- srho.begin (is, *( this ->pelec -> charge ) , this ->pw_rhod , ucell.symm );
235+ srho.begin (is, this ->chr , this ->pw_rhod , ucell.symm );
234236 }
235237
236238 std::string out_dir =PARAM.globalv .global_out_dir ;
@@ -242,8 +244,8 @@ void ESolver_FP::after_scf(UnitCell& ucell, const int istep, const bool conv_eso
242244 out_dir,
243245 istep,
244246 PARAM.inp .nspin ,
245- this ->pelec -> charge -> rho ,
246- this ->pelec -> charge -> kin_r ,
247+ this ->chr . rho ,
248+ this ->chr . kin_r ,
247249 this ->pw_rhod ,
248250 this ->Pgrid ,
249251 &(ucell),
@@ -260,9 +262,9 @@ void ESolver_FP::before_scf(UnitCell& ucell, const int istep)
260262 {
261263 // only G-vector and K-vector are changed due to the change of lattice
262264 // vector FFT grids do not change!!
263- pw_rho->initgrids (ucell.lat0 , ucell.latvec , pw_rho->nx , pw_rho->ny , pw_rho->nz );
264- pw_rho->collect_local_pw ();
265- pw_rho->collect_uniqgg ();
265+ this -> pw_rho ->initgrids (ucell.lat0 , ucell.latvec , pw_rho->nx , pw_rho->ny , pw_rho->nz );
266+ this -> pw_rho ->collect_local_pw ();
267+ this -> pw_rho ->collect_uniqgg ();
266268
267269 if (PARAM.globalv .double_grid )
268270 {
@@ -292,7 +294,7 @@ void ESolver_FP::before_scf(UnitCell& ucell, const int istep)
292294 this ->CE .update_all_dis (ucell);
293295 this ->CE .extrapolate_charge (&(this ->Pgrid ),
294296 ucell,
295- this ->pelec -> charge ,
297+ & this ->chr ,
296298 &(this ->sf ),
297299 GlobalV::ofs_running,
298300 GlobalV::ofs_warning);
@@ -327,7 +329,7 @@ void ESolver_FP::before_scf(UnitCell& ucell, const int istep)
327329 std::stringstream ss;
328330 ss << PARAM.globalv .global_out_dir << " SPIN" << is + 1 << " _CHG_INI.cube" ;
329331 ModuleIO::write_vdata_palgrid (this ->Pgrid ,
330- this ->pelec -> charge -> rho [is],
332+ this ->chr . rho [is],
331333 is,
332334 PARAM.inp .nspin ,
333335 istep,
@@ -368,8 +370,8 @@ void ESolver_FP::iter_finish(UnitCell& ucell, const int istep, int& iter, bool&
368370 if (iter % PARAM.inp .out_freq_elec == 0 || iter == PARAM.inp .scf_nmax || conv_esolver)
369371 {
370372 std::complex <double >** rhog_tot
371- = (PARAM.inp .dm_to_rho ) ? this ->pelec -> charge -> rhog : this ->pelec -> charge -> rhog_save ;
372- double ** rhor_tot = (PARAM.inp .dm_to_rho ) ? this ->pelec -> charge -> rho : this ->pelec -> charge -> rho_save ;
373+ = (PARAM.inp .dm_to_rho ) ? this ->chr . rhog : this ->chr . rhog_save ;
374+ double ** rhor_tot = (PARAM.inp .dm_to_rho ) ? this ->chr . rho : this ->chr . rho_save ;
373375 for (int is = 0 ; is < PARAM.inp .nspin ; is++)
374376 {
375377 this ->pw_rhod ->real2recip (rhor_tot[is], rhog_tot[is]);
@@ -386,12 +388,12 @@ void ESolver_FP::iter_finish(UnitCell& ucell, const int istep, int& iter, bool&
386388
387389 if (XC_Functional::get_ked_flag ())
388390 {
389- std::vector<std::complex <double >> kin_g_space (PARAM.inp .nspin * this ->pelec -> charge -> ngmc , {0.0 , 0.0 });
391+ std::vector<std::complex <double >> kin_g_space (PARAM.inp .nspin * this ->chr . ngmc , {0.0 , 0.0 });
390392 std::vector<std::complex <double >*> kin_g;
391393 for (int is = 0 ; is < PARAM.inp .nspin ; is++)
392394 {
393- kin_g.push_back (kin_g_space.data () + is * this ->pelec -> charge -> ngmc );
394- this ->pw_rhod ->real2recip (this ->pelec -> charge -> kin_r_save [is], kin_g[is]);
395+ kin_g.push_back (kin_g_space.data () + is * this ->chr . ngmc );
396+ this ->pw_rhod ->real2recip (this ->chr . kin_r_save [is], kin_g[is]);
395397 }
396398 ModuleIO::write_rhog (PARAM.globalv .global_out_dir + PARAM.inp .suffix + " -TAU-DENSITY.restart" ,
397399 PARAM.globalv .gamma_only_pw || PARAM.globalv .gamma_only_local ,
0 commit comments