Skip to content

Commit e432d86

Browse files
committed
Fix: let nk_total *= nspin, in rdmft
1 parent b13bc06 commit e432d86

File tree

4 files changed

+17
-18
lines changed

4 files changed

+17
-18
lines changed

source/module_esolver/esolver_ks_lcao.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,6 @@ void ESolver_KS_LCAO<TK, TR>::iter_finish(int& iter)
11161116
}
11171117

11181118
this->rdmft_solver.update_elec(occ_number_ks, *(this->psi));
1119-
std::cout << "\n******\n" << "update elec in rdmft successfully" << "\n******\n" << std::endl;
11201119

11211120
//initialize the gradients of Etotal on occupation numbers and wfc, and set all elements to 0.
11221121
ModuleBase::matrix dE_dOccNum(this->pelec->wg.nr, this->pelec->wg.nc, true);

source/module_io/read_input_item_other.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ void ReadInput::item_others()
504504
{
505505
Input_Item item("rdmft_power_alpha");
506506
item.annotation = "the alpha parameter of power-functional, g(occ_number) = occ_number^alpha"
507-
"used in exx-type functionals such as muller and power";
507+
" used in exx-type functionals such as muller and power";
508508
read_sync_double(input.rdmft_power_alpha);
509509
item.reset_value = [](const Input_Item& item, Parameter& para) {
510510
if( para.input.dft_functional == "hf" || para.input.dft_functional == "pbe0" )

source/module_rdmft/rdmft.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@ void RDMFT<TK, TR>::init(Gint_Gamma& GG_in, Gint_k& GK_in, Parallel_Orbitals& Pa
9494
XC_func_rdmft = XC_func_rdmft_in;
9595
alpha_power = alpha_power_in;
9696

97-
nk_total = ModuleSymmetry::Symmetry::symm_flag == -1 ? kv->get_nkstot_full(): kv->get_nks();
98-
nbands_total = PARAM.inp.nbands;
9997
nspin = PARAM.inp.nspin;
98+
nbands_total = PARAM.inp.nbands;
99+
nk_total = ModuleSymmetry::Symmetry::symm_flag == -1 ? kv->get_nkstot_full(): kv->get_nks();
100+
nk_total *= nspin;
100101
only_exx_type = ( XC_func_rdmft == "hf" || XC_func_rdmft == "muller" || XC_func_rdmft == "power" );
101102

102103
// // create desc[] and something about MPI to Eij(nbands*nbands)

source/module_rdmft/update_state_rdmft.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ void RDMFT<TK, TR>::update_elec(const ModuleBase::matrix& occ_number_in, const p
8080
this->cal_V_hartree();
8181
this->cal_V_XC();
8282
// this->cal_Hk_Hpsi();
83+
84+
std::cout << "\n******\n" << "update elec in rdmft successfully" << "\n******\n" << std::endl;
8385
}
8486

8587

@@ -148,27 +150,24 @@ void RDMFT<TK, TR>::update_charge()
148150
charge->renormalize_rho();
149151
}
150152

151-
/*********** what's this? When we use PBE-functional, this can't be deleted *************/
153+
// charge density symmetrization
152154
// this->pelec->calculate_weights();
153155
// this->pelec->calEBand();
154156
Symmetry_rho srho;
155157
for (int is = 0; is < nspin; is++)
156158
{
157159
srho.begin(is, *(this->charge), rho_basis, GlobalC::ucell.symm);
158160
}
159-
/*********** what's this? When we use PBE-functional, this can't be deleted *************/
160-
161-
// // what this?
162-
// if(GlobalV::VL_IN_H)
163-
// {
164-
// // update Gint_K
165-
// if (!PARAM.inp.gamma_only)
166-
// {
167-
// this->UHM.GK.renew();
168-
// }
169-
// // update real space Hamiltonian
170-
// // this->p_hamilt->refresh();
171-
// }
161+
162+
// what this? it seems that it needs to be updated at each iteration
163+
if (PARAM.inp.vl_in_h)
164+
{
165+
// update Gint_K
166+
if (!PARAM.globalv.gamma_only_local)
167+
{
168+
this->GK->renew();
169+
}
170+
}
172171

173172
}
174173

0 commit comments

Comments
 (0)