Skip to content

Commit 9f5fa63

Browse files
committed
change ucell in dftu_yukawa
1 parent 05d089c commit 9f5fa63

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

source/module_esolver/esolver_ks_lcao.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ void ESolver_KS_LCAO<TK, TR>::iter_init(UnitCell& ucell, const int istep, const
647647
GlobalC::dftu.set_dmr(dynamic_cast<elecstate::ElecStateLCAO<TK>*>(this->pelec)->get_DM());
648648
}
649649
// Calculate U and J if Yukawa potential is used
650-
GlobalC::dftu.cal_slater_UJ(this->pelec->charge->rho, this->pw_rho->nrxx);
650+
GlobalC::dftu.cal_slater_UJ(ucell,this->pelec->charge->rho, this->pw_rho->nrxx);
651651
}
652652

653653
#ifdef __DEEPKS

source/module_hamilt_lcao/module_dftu/dftu.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,15 @@ class DFTU
244244

245245
public:
246246
bool Yukawa; // 1:use Yukawa potential; 0: do not use Yukawa potential
247-
void cal_slater_UJ(double** rho, const int& nrxx);
247+
void cal_slater_UJ(const UnitCell& ucell, double** rho, const int& nrxx);
248248

249249
private:
250250
double lambda; // the parameter in Yukawa potential
251251
std::vector<std::vector<std::vector<std::vector<double>>>> Fk; // slater integral:Fk[T][L][N][k]
252252
std::vector<std::vector<std::vector<double>>> U_Yukawa; // U_Yukawa[T][L][N]
253253
std::vector<std::vector<std::vector<double>>> J_Yukawa; // J_Yukawa[T][L][N]
254254

255-
void cal_slater_Fk(const int L, const int T); // L:angular momnet, T:atom type
255+
void cal_slater_Fk(const UnitCell& ucell,const int L, const int T); // L:angular momnet, T:atom type
256256
void cal_yukawa_lambda(double** rho, const int& nrxx);
257257

258258
double spherical_Bessel(const int k, const double r, const double lambda);

source/module_hamilt_lcao/module_dftu/dftu_yukawa.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,15 @@ void DFTU::cal_yukawa_lambda(double** rho, const int& nrxx)
6262
return;
6363
}
6464

65-
void DFTU::cal_slater_Fk(const int L, const int T)
65+
void DFTU::cal_slater_Fk(const UnitCell& ucell,
66+
const int L,
67+
const int T)
6668
{
6769
ModuleBase::TITLE("DFTU", "cal_slater_Fk");
6870

6971
if (Yukawa)
7072
{
71-
for (int chi = 0; chi < GlobalC::ucell.atoms[T].l_nchi[L]; chi++)
73+
for (int chi = 0; chi < ucell.atoms[T].l_nchi[L]; chi++)
7274
{
7375
// if(chi!=0) continue;
7476
const int mesh = ptr_orb_->Phi[T].PhiLN(L, chi).getNr();
@@ -110,7 +112,7 @@ void DFTU::cal_slater_Fk(const int L, const int T)
110112
return;
111113
}
112114

113-
void DFTU::cal_slater_UJ(double** rho, const int& nrxx)
115+
void DFTU::cal_slater_UJ(const UnitCell& ucell, double** rho, const int& nrxx)
114116
{
115117
ModuleBase::TITLE("DFTU", "cal_slater_UJ");
116118
if (!Yukawa) {
@@ -119,34 +121,34 @@ void DFTU::cal_slater_UJ(double** rho, const int& nrxx)
119121

120122
this->cal_yukawa_lambda(rho, nrxx);
121123

122-
for (int it = 0; it < GlobalC::ucell.ntype; it++)
124+
for (int it = 0; it < ucell.ntype; it++)
123125
{
124-
const int NL = GlobalC::ucell.atoms[it].nwl + 1;
126+
const int NL = ucell.atoms[it].nwl + 1;
125127

126128
for (int l = 0; l < NL; l++)
127129
{
128-
int N = GlobalC::ucell.atoms[it].l_nchi[l];
130+
int N = ucell.atoms[it].l_nchi[l];
129131
for (int n = 0; n < N; n++)
130132
{
131133
ModuleBase::GlobalFunc::ZEROS(ModuleBase::GlobalFunc::VECTOR_TO_PTR(this->Fk[it][l][n]), l + 1);
132134
}
133135
}
134136
}
135137

136-
for (int T = 0; T < GlobalC::ucell.ntype; T++)
138+
for (int T = 0; T < ucell.ntype; T++)
137139
{
138-
const int NL = GlobalC::ucell.atoms[T].nwl + 1;
140+
const int NL = ucell.atoms[T].nwl + 1;
139141

140142
for (int L = 0; L < NL; L++)
141143
{
142-
const int N = GlobalC::ucell.atoms[T].l_nchi[L];
144+
const int N = ucell.atoms[T].l_nchi[L];
143145

144146
if (L >= PARAM.inp.orbital_corr[T] && PARAM.inp.orbital_corr[T] != -1)
145147
{
146148
if (L != PARAM.inp.orbital_corr[T]) {
147149
continue;
148150
}
149-
this->cal_slater_Fk(L, T);
151+
this->cal_slater_Fk(ucell,L, T);
150152

151153
for (int n = 0; n < N; n++)
152154
{

0 commit comments

Comments
 (0)