|
4 | 4 | #include "source_lcao/hs_matrix_k.hpp" // there may be multiple definitions if using hpp |
5 | 5 | #include "source_estate/module_charge/symmetry_rho.h" |
6 | 6 | #include "source_lcao/LCAO_domain.h" // need DeePKS_init |
7 | | -#include "source_lcao/module_dftu/dftu.h" |
8 | 7 | #include "source_lcao/FORCE_STRESS.h" |
9 | 8 | #include "source_estate/elecstate_lcao.h" |
10 | 9 | #include "source_lcao/hamilt_lcao.h" |
@@ -99,8 +98,7 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(UnitCell& ucell, const Input_pa |
99 | 98 | // 9) initialize DFT+U |
100 | 99 | if (inp.dft_plus_u) |
101 | 100 | { |
102 | | - auto* dftu = ModuleDFTU::DFTU::get_instance(); |
103 | | - dftu->init(ucell, &this->pv, this->kv.get_nks(), &orb_); |
| 101 | + this->dftu.init(ucell, &this->pv, this->kv.get_nks(), &orb_); |
104 | 102 | } |
105 | 103 |
|
106 | 104 | // 10) init local pseudopotentials |
@@ -189,7 +187,7 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(UnitCell& ucell, const int istep) |
189 | 187 | { |
190 | 188 | this->p_hamilt = new hamilt::HamiltLCAO<TK, TR>( |
191 | 189 | ucell, this->gd, &this->pv, this->pelec->pot, this->kv, |
192 | | - two_center_bundle_, orb_, this->dmat.dm, this->deepks, istep, exx_nao); |
| 190 | + two_center_bundle_, orb_, this->dmat.dm, &this->dftu, this->deepks, istep, exx_nao); |
193 | 191 | } |
194 | 192 |
|
195 | 193 | // 9) for each ionic step, the overlap <phi|alpha> must be rebuilt |
@@ -274,7 +272,7 @@ void ESolver_KS_LCAO<TK, TR>::cal_force(UnitCell& ucell, ModuleBase::matrix& for |
274 | 272 | this->gd, this->pv, this->pelec, this->dmat, this->psi, |
275 | 273 | two_center_bundle_, orb_, force, this->scs, |
276 | 274 | this->locpp, this->sf, this->kv, |
277 | | - this->pw_rho, this->solvent, this->deepks, |
| 275 | + this->pw_rho, this->solvent, this->dftu, this->deepks, |
278 | 276 | this->exx_nao, &ucell.symm); |
279 | 277 |
|
280 | 278 | // delete RA after cal_force |
@@ -338,7 +336,8 @@ void ESolver_KS_LCAO<TK, TR>::iter_init(UnitCell& ucell, const int istep, const |
338 | 336 | // call iter_init() of ESolver_KS |
339 | 337 | ESolver_KS<TK>::iter_init(ucell, istep, iter); |
340 | 338 |
|
341 | | - module_charge::chgmixing_ks_lcao(iter, this->p_chgmix, this->dmat.dm->get_DMR_pointer(1)->get_nnr(), PARAM.inp); |
| 339 | + module_charge::chgmixing_ks_lcao(iter, this->p_chgmix, this->dftu, |
| 340 | + this->dmat.dm->get_DMR_pointer(1)->get_nnr(), PARAM.inp); |
342 | 341 |
|
343 | 342 | // mohan update 2012-06-05 |
344 | 343 | this->pelec->f_en.deband_harris = this->pelec->cal_delta_eband(ucell); |
@@ -377,10 +376,10 @@ void ESolver_KS_LCAO<TK, TR>::iter_init(UnitCell& ucell, const int istep, const |
377 | 376 | { |
378 | 377 | if (istep != 0 || iter != 1) |
379 | 378 | { |
380 | | - GlobalC::dftu.set_dmr(this->dmat.dm); |
| 379 | + this->dftu.set_dmr(this->dmat.dm); |
381 | 380 | } |
382 | 381 | // Calculate U and J if Yukawa potential is used |
383 | | - GlobalC::dftu.cal_slater_UJ(ucell, this->chr.rho, this->pw_rho->nrxx); |
| 382 | + this->dftu.cal_slater_UJ(ucell, this->chr.rho, this->pw_rho->nrxx); |
384 | 383 | } |
385 | 384 |
|
386 | 385 | #ifdef __MLALGO |
@@ -489,18 +488,18 @@ void ESolver_KS_LCAO<TK, TR>::iter_finish(UnitCell& ucell, const int istep, int& |
489 | 488 | // 1) calculate the local occupation number matrix and energy correction in DFT+U |
490 | 489 | if (PARAM.inp.dft_plus_u) |
491 | 490 | { |
492 | | - // only old DFT+U method should calculated energy correction in esolver, |
493 | | - // new DFT+U method will calculate energy in calculating Hamiltonian |
| 491 | + // old DFT+U method calculates energy correction in esolver, |
| 492 | + // new DFT+U method calculates energy in Hamiltonian |
494 | 493 | if (PARAM.inp.dft_plus_u == 2) |
495 | 494 | { |
496 | | - if (GlobalC::dftu.omc != 2) |
| 495 | + if (this->dftu.omc != 2) |
497 | 496 | { |
498 | | - ModuleDFTU::dftu_cal_occup_m(iter, ucell, dm_vec, this->kv, |
499 | | - this->p_chgmix->get_mixing_beta(), hamilt_lcao); |
| 497 | + dftu_cal_occup_m(iter, ucell, dm_vec, this->kv, |
| 498 | + this->p_chgmix->get_mixing_beta(), hamilt_lcao, this->dftu); |
500 | 499 | } |
501 | | - GlobalC::dftu.cal_energy_correction(ucell, istep); |
| 500 | + this->dftu.cal_energy_correction(ucell, istep); |
502 | 501 | } |
503 | | - GlobalC::dftu.output(ucell); |
| 502 | + this->dftu.output(ucell); |
504 | 503 | } |
505 | 504 |
|
506 | 505 | // 2) for deepks, calculate delta_e, output labels during electronic steps |
@@ -532,7 +531,7 @@ void ESolver_KS_LCAO<TK, TR>::iter_finish(UnitCell& ucell, const int istep, int& |
532 | 531 | // use the converged occupation matrix for next MD/Relax SCF calculation |
533 | 532 | if (PARAM.inp.dft_plus_u && conv_esolver) |
534 | 533 | { |
535 | | - GlobalC::dftu.initialed_locale = true; |
| 534 | + this->dftu.initialed_locale = true; |
536 | 535 | } |
537 | 536 |
|
538 | 537 | // control the output related to the finished iteration |
@@ -566,7 +565,7 @@ void ESolver_KS_LCAO<TK, TR>::after_scf(UnitCell& ucell, const int istep, const |
566 | 565 | //! 2) output of lcao every few ionic steps |
567 | 566 | ModuleIO::ctrl_scf_lcao<TK, TR>(ucell, |
568 | 567 | PARAM.inp, this->kv, this->pelec, this->dmat.dm, this->pv, |
569 | | - this->gd, this->psi, hamilt_lcao, this->two_center_bundle_, |
| 568 | + this->gd, this->psi, hamilt_lcao, this->dftu, this->two_center_bundle_, |
570 | 569 | this->orb_, this->pw_wfc, this->pw_rho, this->pw_big, this->sf, |
571 | 570 | this->rdmft_solver, this->deepks, this->exx_nao, |
572 | 571 | this->conv_esolver, this->scf_nmax_flag, istep); |
|
0 commit comments