|
17 | 17 | #include "source_io/ctrl_runner_lcao.h" // use ctrl_runner_lcao() |
18 | 18 | #include "source_io/ctrl_iter_lcao.h" // use ctrl_iter_lcao() |
19 | 19 | #include "source_io/ctrl_scf_lcao.h" // use ctrl_scf_lcao() |
20 | | -#include "source_psi/setup_psi.h" // mohan add 20251019 |
21 | | -#include "source_io/read_wfc_nao.h" |
22 | 20 | #include "source_io/print_info.h" |
23 | 21 | #include "source_lcao/rho_tau_lcao.h" // mohan add 20251024 |
| 22 | +#include "source_lcao/LCAO_set.h" // mohan add 20251111 |
| 23 | + |
| 24 | + |
| 25 | +// tmp |
| 26 | +#include "source_psi/setup_psi.h" // use Setup_Psi |
| 27 | +#include "source_io/read_wfc_nao.h" // use read_wfc_nao |
| 28 | +#include "source_estate/elecstate_tools.h" // use fixed_weights |
| 29 | + |
24 | 30 |
|
25 | 31 | namespace ModuleESolver |
26 | 32 | { |
@@ -74,62 +80,17 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(UnitCell& ucell, const Input_pa |
74 | 80 | return; |
75 | 81 | } |
76 | 82 |
|
77 | | - // 5) init electronic wave function psi |
78 | | - Setup_Psi<TK>::allocate_psi(this->psi, this->kv, this->pv, inp); |
79 | | - |
80 | | - //! read psi from file |
81 | | - if (inp.init_wfc == "file" && inp.esolver_type != "tddft") |
82 | | - { |
83 | | - if (!ModuleIO::read_wfc_nao(PARAM.globalv.global_readin_dir, |
84 | | - this->pv, *this->psi, this->pelec->ekb, this->pelec->wg, this->kv.ik2iktot, |
85 | | - this->kv.get_nkstot(), inp.nspin)) |
86 | | - { |
87 | | - ModuleBase::WARNING_QUIT("ESolver_KS_LCAO", "read electronic wave functions failed"); |
88 | | - } |
89 | | - } |
90 | | - |
| 83 | + LCAO_domain::set_psi_occ_dm_chg<TK>(this->kv, this->psi, this->pv, this->pelec, |
| 84 | + this->dmat, this->chr, inp); |
91 | 85 |
|
92 | | - // 7) init DMK, but DMR is constructed in before_scf() |
93 | | - this->dmat.allocate_dm(&this->kv, &this->pv, inp.nspin); |
| 86 | + LCAO_domain::set_pot<TK>(ucell, this->kv, this->sf, *this->pw_rho, *this->pw_rhod, |
| 87 | + this->pelec, this->orb_, this->pv, this->locpp, this->dftu, |
| 88 | + this->solvent, this->exx_nao, this->deepks, inp); |
94 | 89 |
|
95 | | - // 8) init exact exchange calculations |
96 | | - this->exx_nao.before_runner(ucell, this->kv, this->orb_, this->pv, inp); |
97 | | - |
98 | | - // 9) initialize DFT+U |
99 | | - if (inp.dft_plus_u) |
100 | | - { |
101 | | - this->dftu.init(ucell, &this->pv, this->kv.get_nks(), &orb_); |
102 | | - } |
103 | | - |
104 | | - // 10) init local pseudopotentials |
105 | | - this->locpp.init_vloc(ucell, this->pw_rho); |
106 | | - ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "LOCAL POTENTIAL"); |
107 | | - |
108 | | - // 11) init charge density |
109 | | - this->chr.allocate(inp.nspin); |
110 | | - |
111 | | - // 12) init potentials |
112 | | - if (this->pelec->pot == nullptr) |
113 | | - { |
114 | | - this->pelec->pot = new elecstate::Potential(this->pw_rhod, this->pw_rho, |
115 | | - &ucell, &(this->locpp.vloc), &(this->sf), &(this->solvent), |
116 | | - &(this->pelec->f_en.etxc), &(this->pelec->f_en.vtxc)); |
117 | | - } |
118 | | - |
119 | | - // 13) init deepks |
120 | | - this->deepks.before_runner(ucell, this->kv.get_nks(), this->orb_, this->pv, inp); |
121 | | - |
122 | | - // 14) set occupations, tddft does not need to set occupations in the first scf |
123 | | - if (inp.ocp && inp.esolver_type != "tddft") |
124 | | - { |
125 | | - elecstate::fixed_weights(inp.ocp_kb, inp.nbands, inp.nelec, |
126 | | - this->pelec->klist, this->pelec->wg, this->pelec->skip_weights); |
127 | | - } |
128 | | - |
129 | | - // 15) if kpar is not divisible by nks, print a warning |
| 90 | + //! if kpar is not divisible by nks, print a warning |
130 | 91 | ModuleIO::print_kpar(this->kv.get_nks(), PARAM.globalv.kpar_lcao); |
131 | 92 |
|
132 | | - // 16) init rdmft, added by jghan |
| 93 | + //! init rdmft, added by jghan |
133 | 94 | if (inp.rdmft == true) |
134 | 95 | { |
135 | 96 | rdmft_solver.init(this->pv, ucell, |
@@ -310,8 +271,6 @@ void ESolver_KS_LCAO<TK, TR>::after_all_runners(UnitCell& ucell) |
310 | 271 |
|
311 | 272 | ESolver_KS<TK>::after_all_runners(ucell); |
312 | 273 |
|
313 | | - const int nspin0 = (PARAM.inp.nspin == 2) ? 2 : 1; |
314 | | - |
315 | 274 | auto* hamilt_lcao = dynamic_cast<hamilt::HamiltLCAO<TK, TR>*>(this->p_hamilt); |
316 | 275 | if(!hamilt_lcao) |
317 | 276 | { |
|
0 commit comments