Skip to content

Commit b1e4de5

Browse files
committed
change GlobalC::ucell in dftu.cpp
1 parent 519c09f commit b1e4de5

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

source/module_esolver/esolver_ks_lcao.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ void ESolver_KS_LCAO<TK, TR>::iter_finish(UnitCell& ucell, const int istep, int&
883883
= dynamic_cast<elecstate::ElecStateLCAO<TK>*>(this->pelec)->get_DM()->get_DMK_vector();
884884
ModuleDFTU::dftu_cal_occup_m(iter, tmp_dm, this->kv, this->p_chgmix->get_mixing_beta(), this->p_hamilt);
885885
}
886-
GlobalC::dftu.cal_energy_correction(istep);
886+
GlobalC::dftu.cal_energy_correction(ucell,istep);
887887
}
888888
GlobalC::dftu.output();
889889
}

source/module_hamilt_lcao/module_dftu/dftu.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ void DFTU::init(UnitCell& cell, // unitcell class
209209
return;
210210
}
211211

212-
void DFTU::cal_energy_correction(const int istep)
212+
void DFTU::cal_energy_correction(const UnitCell& ucell,
213+
const int istep)
213214
{
214215
ModuleBase::TITLE("DFTU", "cal_energy_correction");
215216
ModuleBase::timer::tick("DFTU", "cal_energy_correction");
@@ -221,18 +222,18 @@ void DFTU::cal_energy_correction(const int istep)
221222
this->EU = 0.0;
222223
double EU_dc = 0.0;
223224

224-
for (int T = 0; T < GlobalC::ucell.ntype; T++)
225+
for (int T = 0; T < ucell.ntype; T++)
225226
{
226-
const int NL = GlobalC::ucell.atoms[T].nwl + 1;
227+
const int NL = ucell.atoms[T].nwl + 1;
227228
const int LC = orbital_corr[T];
228-
for (int I = 0; I < GlobalC::ucell.atoms[T].na; I++)
229+
for (int I = 0; I < ucell.atoms[T].na; I++)
229230
{
230231
if (LC == -1)
231232
{
232233
continue;
233234
}
234235

235-
const int iat = GlobalC::ucell.itia2iat(T, I);
236+
const int iat = ucell.itia2iat(T, I);
236237
const int L = orbital_corr[T];
237238

238239
for (int l = 0; l < NL; l++)
@@ -242,7 +243,7 @@ void DFTU::cal_energy_correction(const int istep)
242243
continue;
243244
}
244245

245-
const int N = GlobalC::ucell.atoms[T].l_nchi[l];
246+
const int N = ucell.atoms[T].l_nchi[l];
246247

247248
const int m_tot = 2 * l + 1;
248249

source/module_hamilt_lcao/module_dftu/dftu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class DFTU
4545
);
4646

4747
// calculate the energy correction
48-
void cal_energy_correction(const int istep);
48+
void cal_energy_correction(const UnitCell& ucell, const int istep);
4949
double get_energy(){return EU;}
5050
void uramping_update(); // update U by uramping
5151
bool u_converged(); // check if U is converged

0 commit comments

Comments
 (0)