Skip to content

Commit e9e91d7

Browse files
author
dyzheng
committed
Fix: nscf for pw code
1 parent d7409e5 commit e9e91d7

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

source/module_esolver/esolver_ks_pw.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,12 @@ void ESolver_KS_PW<T, Device>::after_all_runners() {
12411241

12421242
template <typename T, typename Device>
12431243
void ESolver_KS_PW<T, Device>::hamilt2estates(const double ethr) {
1244+
if(PARAM.inp.dft_plus_u)
1245+
{
1246+
auto* dftu = ModuleDFTU::DFTU::get_instance();
1247+
dftu->cal_occ_pw(0, this->kspw_psi, this->pelec->wg, GlobalC::ucell, nullptr);
1248+
dftu->output();
1249+
}
12441250
if (this->phsol != nullptr) {
12451251
hsolver::DiagoIterAssist<T, Device>::need_subspace = false;
12461252
hsolver::DiagoIterAssist<T, Device>::PW_DIAG_THR = ethr;

source/module_hamilt_lcao/module_dftu/dftu_occup.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ void DFTU::copy_locale()
5656
{
5757
locale_save[iat][target_l][0][0] = locale[iat][target_l][0][0];
5858
locale_save[iat][target_l][0][1] = locale[iat][target_l][0][1];
59+
if(this->uom_save.size() != 0)
60+
{
61+
const int size = locale[iat][target_l][0][0].nr * locale[iat][target_l][0][0].nc;
62+
for(int mm=0; mm<size; mm++)
63+
{
64+
this->uom_save[eff_pot_pw_index[iat]+mm] = locale[iat][target_l][0][0].c[mm];
65+
this->uom_save[eff_pot_pw_index[iat]+mm+size] = locale[iat][target_l][0][1].c[mm];
66+
}
67+
}
5968
}
6069
}
6170
}

source/module_hamilt_lcao/module_dftu/dftu_pw.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,14 @@ void DFTU::cal_occ_pw(const int iter, const void* psi_in, const ModuleBase::matr
212212
if(GlobalV::NSPIN == 2)
213213
{
214214
Parallel_Reduce::reduce_double_allpool(GlobalV::KPAR, GlobalV::NPROC_IN_POOL, this->locale[iat][target_l][0][1].c, size);
215+
//save locale matrix for spin=1 to uom_array
216+
if(this->uom_array.size() != 0)
217+
{
218+
for(int mm=0;mm<size;mm++)
219+
{
220+
this->uom_array[eff_pot_pw_index[iat]+mm+size] = this->locale[iat][target_l][0][1].c[mm];
221+
}
222+
}
215223
}
216224
}
217225
}//end if initialed_locale

0 commit comments

Comments
 (0)