|
2 | 2 | #include "source_lcao/module_dftu/dftu.h" |
3 | 3 | #include "source_lcao/module_deltaspin/spin_constrain.h" |
4 | 4 |
|
5 | | -void module_charge::chgmixing(const int iter, // scf iteration number |
| 5 | +void module_charge::chgmixing_ks_pw(const int iter, // scf iteration number |
6 | 6 | Charge_Mixing* p_chgmix, // charge mixing class |
7 | 7 | const Input_para& inp) // input parameters |
8 | 8 | { |
9 | | - ModuleBase::TITLE("module_charge", "setup_chgmixing"); |
| 9 | + ModuleBase::TITLE("module_charge", "chgmixing_ks_pw"); |
10 | 10 |
|
11 | 11 | if (iter == 1) |
12 | 12 | { |
@@ -55,3 +55,61 @@ void module_charge::chgmixing(const int iter, // scf iteration number |
55 | 55 |
|
56 | 56 | return; |
57 | 57 | } |
| 58 | + |
| 59 | +/* |
| 60 | +void module_charge::chgmixing_ks_lcao(const int iter, // scf iteration number |
| 61 | + Charge_Mixing* p_chgmix, // charge mixing class |
| 62 | + const Input_para& inp) // input parameters |
| 63 | +{ |
| 64 | + ModuleBase::TITLE("module_charge", "chgmixing_ks_lcao"); |
| 65 | +
|
| 66 | + if (iter == 1) |
| 67 | + { |
| 68 | + p_chgmix->mix_reset(); // init mixing |
| 69 | + p_chgmix->mixing_restart_step = inp.scf_nmax + 1; |
| 70 | + p_chgmix->mixing_restart_count = 0; |
| 71 | + // this output will be removed once the feeature is stable |
| 72 | + if (GlobalC::dftu.uramping > 0.01) |
| 73 | + { |
| 74 | + std::cout << " U-Ramping! Current U = "; |
| 75 | + for (int i = 0; i < GlobalC::dftu.U0.size(); i++) |
| 76 | + { |
| 77 | + std::cout << GlobalC::dftu.U[i] * ModuleBase::Ry_to_eV << " "; |
| 78 | + } |
| 79 | + std::cout << " eV " << std::endl; |
| 80 | + } |
| 81 | + } |
| 82 | +
|
| 83 | + // for mixing restart |
| 84 | + if (iter == p_chgmix->mixing_restart_step && inp.mixing_restart > 0.0) |
| 85 | + { |
| 86 | + p_chgmix->init_mixing(); |
| 87 | + p_chgmix->mixing_restart_count++; |
| 88 | + if (inp.dft_plus_u) |
| 89 | + { |
| 90 | + GlobalC::dftu.uramping_update(); // update U by uramping if uramping > 0.01 |
| 91 | + if (GlobalC::dftu.uramping > 0.01) |
| 92 | + { |
| 93 | + std::cout << " U-Ramping! Current U = "; |
| 94 | + for (int i = 0; i < GlobalC::dftu.U0.size(); i++) |
| 95 | + { |
| 96 | + std::cout << GlobalC::dftu.U[i] * ModuleBase::Ry_to_eV << " "; |
| 97 | + } |
| 98 | + std::cout << " eV " << std::endl; |
| 99 | + } |
| 100 | + if (GlobalC::dftu.uramping > 0.01 && !GlobalC::dftu.u_converged()) |
| 101 | + { |
| 102 | + p_chgmix->mixing_restart_step = inp.scf_nmax + 1; |
| 103 | + } |
| 104 | + } |
| 105 | + if (inp.mixing_dmr) // for mixing_dmr |
| 106 | + { |
| 107 | + // allocate memory for dmr_mdata |
| 108 | + const elecstate::DensityMatrix<TK, double>* dm |
| 109 | + = dynamic_cast<const elecstate::ElecStateLCAO<TK>*>(this->pelec)->get_DM(); |
| 110 | + int nnr_tmp = dm->get_DMR_pointer(1)->get_nnr(); |
| 111 | + p_chgmix->allocate_mixing_dmr(nnr_tmp); |
| 112 | + } |
| 113 | + } |
| 114 | +} |
| 115 | +*/ |
0 commit comments