Skip to content

Commit a4baf84

Browse files
committed
change ucell in rmdft/update_state_rmdft.cpp
1 parent 739816a commit a4baf84

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

source/module_esolver/esolver_ks_lcao.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ void ESolver_KS_LCAO<TK, TR>::after_scf(UnitCell& ucell, const int istep)
10521052
occ_number_ks(ik, inb) /= this->kv.wk[ik];
10531053
}
10541054
}
1055-
this->rdmft_solver.update_elec(occ_number_ks, *(this->psi));
1055+
this->rdmft_solver.update_elec(ucell,occ_number_ks, *(this->psi));
10561056

10571057
//! initialize the gradients of Etotal with respect to occupation numbers and wfc,
10581058
//! and set all elements to 0.

source/module_rdmft/rdmft.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class RDMFT
9090

9191
//! update in elec-step
9292
// Or we can use rdmft_solver.wfc/occ_number directly when optimizing, so that the update_elec() function does not require parameters.
93-
void update_elec(const ModuleBase::matrix& occ_number_in, const psi::Psi<TK>& wfc_in, const Charge* charge_in = nullptr);
93+
void update_elec(UnitCell& ucell, const ModuleBase::matrix& occ_number_in, const psi::Psi<TK>& wfc_in, const Charge* charge_in = nullptr);
9494

9595
//! obtain the gradient of total energy with respect to occupation number and wfc
9696
double cal_E_grad_wfc_occ_num();
@@ -122,7 +122,7 @@ class RDMFT
122122
//! get the total Hamilton in k-space
123123
void cal_Hk_Hpsi();
124124

125-
void update_charge();
125+
void update_charge(UnitCell& ucell_in);
126126

127127
private:
128128

source/module_rdmft/update_state_rdmft.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ void RDMFT<TK, TR>::update_ion(UnitCell& ucell_in, ModulePW::PW_Basis& rho_basis
4545

4646

4747
template <typename TK, typename TR>
48-
void RDMFT<TK, TR>::update_elec(const ModuleBase::matrix& occ_number_in, const psi::Psi<TK>& wfc_in, const Charge* charge_in)
48+
void RDMFT<TK, TR>::update_elec(UnitCell& ucell_in,
49+
const ModuleBase::matrix& occ_number_in,
50+
const psi::Psi<TK>& wfc_in,
51+
const Charge* charge_in)
4952
{
5053
// update occ_number, wg, wk_fun_occNum
5154
occ_number = (occ_number_in);
@@ -67,7 +70,7 @@ void RDMFT<TK, TR>::update_elec(const ModuleBase::matrix& occ_number_in, const p
6770
}
6871

6972
// update charge
70-
this->update_charge();
73+
this->update_charge(ucell_in);
7174

7275
// "default" = "pbe"
7376
// if( !only_exx_type || this->cal_E_type != 1 )
@@ -87,7 +90,7 @@ void RDMFT<TK, TR>::update_elec(const ModuleBase::matrix& occ_number_in, const p
8790

8891
// this code is copying from function ElecStateLCAO<TK>::psiToRho(), in elecstate_lcao.cpp
8992
template <typename TK, typename TR>
90-
void RDMFT<TK, TR>::update_charge()
93+
void RDMFT<TK, TR>::update_charge(UnitCell& ucell_in)
9194
{
9295
if( PARAM.inp.gamma_only )
9396
{
@@ -156,7 +159,7 @@ void RDMFT<TK, TR>::update_charge()
156159
Symmetry_rho srho;
157160
for (int is = 0; is < nspin; is++)
158161
{
159-
srho.begin(is, *(this->charge), rho_basis, GlobalC::ucell.symm);
162+
srho.begin(is, *(this->charge), rho_basis, ucell_in.symm);
160163
}
161164

162165
}

0 commit comments

Comments
 (0)