@@ -115,9 +115,9 @@ ESolver_KS_PW<T, Device>::~ESolver_KS_PW()
115115}
116116
117117template <typename T, typename Device>
118- void ESolver_KS_PW<T, Device>::allocate_hamilt()
118+ void ESolver_KS_PW<T, Device>::allocate_hamilt(const UnitCell& ucell )
119119{
120- this ->p_hamilt = new hamilt::HamiltPW<T, Device>(this ->pelec ->pot , this ->pw_wfc , &this ->kv , &this ->ppcell );
120+ this ->p_hamilt = new hamilt::HamiltPW<T, Device>(this ->pelec ->pot , this ->pw_wfc , &this ->kv , &this ->ppcell , &ucell );
121121}
122122template <typename T, typename Device>
123123void ESolver_KS_PW<T, Device>::deallocate_hamilt()
@@ -202,10 +202,10 @@ void ESolver_KS_PW<T, Device>::before_all_runners(UnitCell& ucell, const Input_p
202202 }
203203
204204 // ! init pseudopotential
205- this ->ppcell .init (ucell. ntype , &this ->sf , this ->pw_wfc );
205+ this ->ppcell .init (ucell, &this ->sf , this ->pw_wfc );
206206
207207 // ! initalize local pseudopotential
208- this ->ppcell .init_vloc (this ->pw_rhod );
208+ this ->ppcell .init_vloc (ucell, this ->pw_rhod );
209209 ModuleBase::GlobalFunc::DONE (GlobalV::ofs_running, " LOCAL POTENTIAL" );
210210
211211 // ! Initalize non-local pseudopotential
@@ -279,7 +279,7 @@ void ESolver_KS_PW<T, Device>::before_scf(UnitCell& ucell, const int istep)
279279 this ->deallocate_hamilt ();
280280
281281 // allocate HamiltPW
282- this ->allocate_hamilt ();
282+ this ->allocate_hamilt (ucell );
283283
284284 // ----------------------------------------------------------
285285 // about vdw, jiyy add vdwd3 and linpz add vdwd2
@@ -585,8 +585,8 @@ void ESolver_KS_PW<T, Device>::after_scf(UnitCell& ucell, const int istep)
585585 PARAM.inp .out_wannier_wvfn_formatted ,
586586 PARAM.inp .nnkpfile ,
587587 PARAM.inp .wannier_spin );
588-
589- wan.calculate (this ->pelec ->ekb , this ->pw_wfc , this ->pw_big , this ->kv , this ->psi );
588+ wan. set_tpiba_omega (ucell. tpiba , ucell. omega );
589+ wan.calculate (ucell, this ->pelec ->ekb , this ->pw_wfc , this ->pw_big , this ->kv , this ->psi );
590590 std::cout << FmtCore::format (" >> Finish %s.\n * * * * * *\n " , " Wannier functions calculation" );
591591 }
592592
@@ -595,7 +595,7 @@ void ESolver_KS_PW<T, Device>::after_scf(UnitCell& ucell, const int istep)
595595 {
596596 std::cout << FmtCore::format (" \n * * * * * *\n << Start %s.\n " , " Berry phase polarization" );
597597 berryphase bp;
598- bp.Macroscopic_polarization (this ->pw_wfc ->npwk_max , this ->psi , this ->pw_rho , this ->pw_wfc , this ->kv );
598+ bp.Macroscopic_polarization (ucell, this ->pw_wfc ->npwk_max , this ->psi , this ->pw_rho , this ->pw_wfc , this ->kv );
599599 std::cout << FmtCore::format (" >> Finish %s.\n * * * * * *\n " , " Berry phase polarization" );
600600 }
601601}
@@ -621,7 +621,8 @@ void ESolver_KS_PW<T, Device>::cal_force(UnitCell& ucell, ModuleBase::matrix& fo
621621 : reinterpret_cast <psi::Psi<std::complex <double >, Device>*>(this ->kspw_psi );
622622
623623 // Calculate forces
624- ff.cal_force (force,
624+ ff.cal_force (ucell,
625+ force,
625626 *this ->pelec ,
626627 this ->pw_rhod ,
627628 &ucell.symm ,
@@ -782,7 +783,7 @@ void ESolver_KS_PW<T, Device>::after_all_runners(UnitCell& ucell)
782783 // ! 6) Print out electronic wave functions in real space
783784 if (PARAM.inp .out_wfc_r == 1 ) // Peize Lin add 2021.11.21
784785 {
785- ModuleIO::write_psi_r_1 (this ->psi [0 ], this ->pw_wfc , " wfc_realspace" , true , this ->kv );
786+ ModuleIO::write_psi_r_1 (ucell, this ->psi [0 ], this ->pw_wfc , " wfc_realspace" , true , this ->kv );
786787 }
787788
788789 // ! 7) Use Kubo-Greenwood method to compute conductivities
0 commit comments