|
28 | 28 | #include "source_estate/setup_estate_pw.h" // mohan add 20251005 |
29 | 29 | #include "source_io/ctrl_output_pw.h" // mohan add 20250927 |
30 | 30 | #include "source_estate/module_charge/chgmixing.h" // use charge mixing, mohan add 20251006 |
| 31 | +#include "source_estate/update_pot.h" // mohan add 20251016 |
31 | 32 |
|
32 | 33 | namespace ModuleESolver |
33 | 34 | { |
@@ -268,24 +269,6 @@ void ESolver_KS_PW<T, Device>::hamilt2rho_single(UnitCell& ucell, const int iste |
268 | 269 | ModuleBase::timer::tick("ESolver_KS_PW", "hamilt2rho_single"); |
269 | 270 | } |
270 | 271 |
|
271 | | -// Temporary, it should be rewritten with Hamilt class. |
272 | | -template <typename T, typename Device> |
273 | | -void ESolver_KS_PW<T, Device>::update_pot(UnitCell& ucell, const int istep, const int iter, const bool conv_esolver) |
274 | | -{ |
275 | | - if (!conv_esolver) |
276 | | - { |
277 | | - elecstate::cal_ux(ucell); |
278 | | - this->pelec->pot->update_from_charge(&this->chr, &ucell); |
279 | | - this->pelec->f_en.descf = this->pelec->cal_delta_escf(); |
280 | | -#ifdef __MPI |
281 | | - MPI_Bcast(&(this->pelec->f_en.descf), 1, MPI_DOUBLE, 0, BP_WORLD); |
282 | | -#endif |
283 | | - } |
284 | | - else |
285 | | - { |
286 | | - this->pelec->cal_converged(); |
287 | | - } |
288 | | -} |
289 | 272 |
|
290 | 273 | template <typename T, typename Device> |
291 | 274 | void ESolver_KS_PW<T, Device>::iter_finish(UnitCell& ucell, const int istep, int& iter, bool& conv_esolver) |
@@ -343,8 +326,8 @@ void ESolver_KS_PW<T, Device>::iter_finish(UnitCell& ucell, const int istep, int |
343 | 326 | << std::endl; |
344 | 327 | exx_helper.op_exx->first_iter = false; |
345 | 328 | XC_Functional::set_xc_type(ucell.atoms[0].ncpp.xc_func); |
346 | | - update_pot(ucell, istep, iter, conv_esolver); |
347 | | - exx_helper.iter_inc(); |
| 329 | + elecstate::update_pot(ucell, this->pelec, this->chr, conv_esolver); |
| 330 | + exx_helper.iter_inc(); |
348 | 331 | } |
349 | 332 | } |
350 | 333 | } |
|
0 commit comments