|
22 | 22 | #include "source_base/kernels/dsp/dsp_connector.h" |
23 | 23 | #endif |
24 | 24 |
|
25 | | -#include <chrono> |
| 25 | +//#include <chrono> |
26 | 26 |
|
27 | 27 | #include "source_pw/module_pwdft/setup_pot.h" // mohan add 20250929 |
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 | +#include "source_estate/module_charge/chgmixing.h" // use charge mixing, mohan add 20251006 |
30 | 31 |
|
31 | 32 | namespace ModuleESolver |
32 | 33 | { |
@@ -185,50 +186,8 @@ void ESolver_KS_PW<T, Device>::iter_init(UnitCell& ucell, const int istep, const |
185 | 186 | // Call iter_init() of ESolver_KS |
186 | 187 | ESolver_KS<T, Device>::iter_init(ucell, istep, iter); |
187 | 188 |
|
188 | | - if (iter == 1) |
189 | | - { |
190 | | - this->p_chgmix->init_mixing(); |
191 | | - this->p_chgmix->mixing_restart_step = PARAM.inp.scf_nmax + 1; |
192 | | - } |
193 | | - |
194 | | - // For mixing restart |
195 | | - if (iter == this->p_chgmix->mixing_restart_step && PARAM.inp.mixing_restart > 0.0) |
196 | | - { |
197 | | - this->p_chgmix->init_mixing(); |
198 | | - this->p_chgmix->mixing_restart_count++; |
199 | | - |
200 | | - if (PARAM.inp.dft_plus_u) |
201 | | - { |
202 | | - auto* dftu = ModuleDFTU::DFTU::get_instance(); |
203 | | - if (dftu->uramping > 0.01 && !dftu->u_converged()) |
204 | | - { |
205 | | - this->p_chgmix->mixing_restart_step = PARAM.inp.scf_nmax + 1; |
206 | | - } |
207 | | - if (dftu->uramping > 0.01) |
208 | | - { |
209 | | - bool do_uramping = true; |
210 | | - if (PARAM.inp.sc_mag_switch) |
211 | | - { |
212 | | - spinconstrain::SpinConstrain<std::complex<double>>& sc |
213 | | - = spinconstrain::SpinConstrain<std::complex<double>>::getScInstance(); |
214 | | - if (!sc.mag_converged()) // skip uramping if mag not converged |
215 | | - { |
216 | | - do_uramping = false; |
217 | | - } |
218 | | - } |
219 | | - if (do_uramping) |
220 | | - { |
221 | | - dftu->uramping_update(); // update U by uramping if uramping > 0.01 |
222 | | - std::cout << " U-Ramping! Current U = "; |
223 | | - for (int i = 0; i < dftu->U0.size(); i++) |
224 | | - { |
225 | | - std::cout << dftu->U[i] * ModuleBase::Ry_to_eV << " "; |
226 | | - } |
227 | | - std::cout << " eV " << std::endl; |
228 | | - } |
229 | | - } |
230 | | - } |
231 | | - } |
| 189 | + // perform charge mixing |
| 190 | + module_charge::chgmixing(iter, this->p_chgmix, PARAM.inp); |
232 | 191 |
|
233 | 192 | // mohan move harris functional to here, 2012-06-05 |
234 | 193 | // use 'rho(in)' and 'v_h and v_xc'(in) |
|
0 commit comments