Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
21e9caf
refactor(dftu_base): reorganize Plus_U_Base members by access level
Aug 26, 2026
fd25200
refactor(dftu_base): encapsulate Plus_U_Base data members
Aug 26, 2026
25314b4
重构 dftu_folding.cpp:抽取邻居判断与矩阵索引两个辅助函数
Aug 26, 2026
08661e4
refactor(dftu_pw): merge CPU/GPU branches into template, drop unused …
Aug 26, 2026
9e5caa4
refactor(dftu_folding): extract Plus_U folding helpers into free func…
Aug 26, 2026
06a75bc
refactor(dftu_pw): merge nspin==4 Pauli block 0 and 1-3 VU loops
Aug 26, 2026
a314a82
refactor(dftu_pw): extract compute_eff_pot_and_energy from cal_occ_pw
Aug 26, 2026
7b7dc7c
refactor(dftu_pw): extract reduce_occ_mat and sync_occ_to_uom from ca…
Aug 26, 2026
cf0e6b8
refactor(dftu_pw): add dftu_pw.h with pauli_to_spin_basis free function
Aug 26, 2026
e6b9925
refactor(dftu_pw): add compute_vu_spinor and compute_vu_scalar free f…
Aug 26, 2026
27342ab
refactor(dftu_pw): add accumulate_occ_spinor and accumulate_occ_scala…
Aug 26, 2026
45189f6
refactor(dftu_pw): split into dftu_tools_pw.{h,cpp} and dftu_cal_occ_…
Aug 26, 2026
c27c60d
test(dftu_pw): rewire 7 dftu_pw_test cases to call real free functions
Aug 26, 2026
144c795
refactor(dftu_lcao): extract force/stress as free functions, unify DF…
Aug 26, 2026
1d87c67
refactor(dftu): prune redundant #include in module_dftu
Aug 26, 2026
5ac6ca7
refactor(dftu): rename Plus_U members and extract pot_uterm_* to DFTU…
Aug 26, 2026
b138c8a
refactor(dftu): split pot_uterm_* / cal_occ_mat declarations into dft…
Aug 26, 2026
3a64bf8
refactor(dftu): use DFTU_LCAO as TITLE/timer owner for pot_uterm_* fr…
Aug 26, 2026
3ac7790
refactor(dftu): rename VU/eff_pot variables to pot_onsite/pot_uterm a…
Aug 26, 2026
3dd8883
fix(dftu): rename remaining vu_device / vu_begin_iat / vu_in members …
Aug 26, 2026
36b5ac0
fix(dftu): restore cal_eff_pot_mat_R_{double,complex_double} function…
Aug 26, 2026
a9678d8
refactor(dftu): rename 'locale' to 'occ_mat' in DFT+U tests and input…
Aug 26, 2026
342a8c6
refactor(dftu): remove redundant includes in module_pwdft dftu files
Aug 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion source/Makefile.Objects
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,8 @@ OBJS_SRCPW=h_ewald_pw.o\
update_cell_pw.o\
dftu_base.o\
dftu_output.o\
dftu_pw.o\
dftu_tools_pw.o\
dftu_cal_occ_pw.o\
setup_dftu_pw.o\
deltaspin_pw.o\
force_pw.o\
Expand Down
2 changes: 1 addition & 1 deletion source/source_esolver/esolver_ks_lcao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ void ESolver_KS_LCAO<TK, TR>::iter_finish(UnitCell& ucell, const int istep, int&

// mohan add 2025-11: push DFT+U energy from Plus_U instance to ElecState.
// Covers both dft_plus_u==1 (new method, energy accumulated by DFTU::contributeHR
// via cal_v_of_u) and dft_plus_u==2 (old method, energy from cal_energy_correction).
// via cal_pot_onsite) and dft_plus_u==2 (old method, energy from cal_energy_correction).
if (this->inp_->dft_plus_u)
{
this->pelec->set_dftu_energy(this->dftu.get_energy());
Expand Down
2 changes: 1 addition & 1 deletion source/source_estate/module_charge/charge_mixing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ void Charge_Mixing::allocate_mixing_uom(int uom_size)
ModuleBase::TITLE("Charge_Mixing", "allocate_mixing_uom");
ModuleBase::timer::start("Charge_Mixing", "allocate_mixing_uom");
// For nspin=2, uom_size already includes both spin channels
// (eff_pot_pw.size() = pot_index * 2 for nspin=2)
// (pot_uterm_pw.size() = pot_index * 2 for nspin=2)
// So uom_fold should always be 1
this->mixing->init_mixing_data(this->uom_mdata, uom_size, sizeof(double));
this->uom_mdata.reset();
Expand Down
12 changes: 6 additions & 6 deletions source/source_estate/module_charge/chgmixing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void module_charge::chgmixing_ks_pw(const int iter, // scf iteration number
// enable mixing_dftu for DFT+U occupation mixing
dftu.enable_mixing();
// allocate memory for uom_mdata
p_chgmix->allocate_mixing_uom(dftu.get_size_eff_pot_pw());
p_chgmix->allocate_mixing_uom(dftu.get_size_pot_uterm_pw());
}
}

Expand All @@ -145,11 +145,11 @@ void module_charge::chgmixing_ks_pw(const int iter, // scf iteration number

if (inp.dft_plus_u)
{
if (dftu.uramping > 0.01 && !dftu.u_converged())
if (dftu.get_uramping() > 0.01 && !dftu.u_converged())
{
p_chgmix->mixing_restart_step = inp.scf_nmax + 1;
}
if (dftu.uramping > 0.01)
if (dftu.get_uramping() > 0.01)
{
bool do_uramping = true;
if (inp.sc_mag_switch)
Expand Down Expand Up @@ -197,7 +197,7 @@ void module_charge::chgmixing_ks_lcao(const int iter, // scf iteration number
dftu.enable_mixing();
}
// this output will be removed once the feeature is stable
if (dftu.uramping > 0.01)
if (dftu.get_uramping() > 0.01)
{
std::cout << " U-Ramping! Current U = ";
for (int i = 0; i < dftu.get_num_u_types(); i++)
Expand All @@ -216,7 +216,7 @@ void module_charge::chgmixing_ks_lcao(const int iter, // scf iteration number
if (inp.dft_plus_u)
{
dftu.uramping_update(); // update U by uramping if uramping > 0.01
if (dftu.uramping > 0.01)
if (dftu.get_uramping() > 0.01)
{
std::cout << " U-Ramping! Current U = ";
for (int i = 0; i < dftu.get_num_u_types(); i++)
Expand All @@ -225,7 +225,7 @@ void module_charge::chgmixing_ks_lcao(const int iter, // scf iteration number
}
std::cout << " eV " << std::endl;
}
if (dftu.uramping > 0.01 && !dftu.u_converged())
if (dftu.get_uramping() > 0.01 && !dftu.u_converged())
{
p_chgmix->mixing_restart_step = inp.scf_nmax + 1;
}
Expand Down
2 changes: 1 addition & 1 deletion source/source_io/module_parameter/input_parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ struct Input_para
double mixing_gg0_min = 0.1;
double mixing_angle = -10.0;
bool mixing_tau = false; ///< whether to mix tau in mgga
bool mixing_dftu = false; ///< whether to mix locale in DFT+U
bool mixing_dftu = false; ///< whether to mix occ_mat in DFT+U
bool mixing_dmr = false; ///< whether to mix real space density matrix

bool gamma_only = false; ///< for plane wave.
Expand Down
2 changes: 1 addition & 1 deletion source/source_io/module_parameter/read_inp_estruc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ This setting takes effect only when the selected exchange-correlation functional
}
{
Input_Item item("mixing_dftu");
item.annotation = "whether to mix locale in DFT+U calculation";
item.annotation = "whether to mix occ_mat in DFT+U calculation";
item.category = "Electronic structure";
item.type = "Boolean";
item.description = R"(Whether to mix the occupation matrices.
Expand Down
3 changes: 2 additions & 1 deletion source/source_lcao/force_stress_lcao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "source_base/parallel_reduce.h"
#include "source_lcao/module_dftu/dftu_lcao.h" //Quxin add for DFT+U on 20201029
#include "source_lcao/module_dftu/dftu_force.h"
#include "source_io/module_output/output_log.h"
#include "source_io/module_parameter/parameter.h"
// new
Expand Down Expand Up @@ -456,7 +457,7 @@ void Force_Stress_LCAO<T>::getForceStress(UnitCell& ucell,
std::vector<std::vector<double>>* dmk_d = nullptr;
std::vector<std::vector<std::complex<double>>>* dmk_c = nullptr;
assign_dmk_ptr<T>(dmat.dm, dmk_d, dmk_c, PARAM.globalv.gamma_only_local);
dftu.force_stress(ucell, gd, dmk_d, dmk_c, pv, fsr_dftu, force_u, stress_u, kv, PARAM.globalv.npol);
DFTU_LCAO::force_stress(dftu, ucell, gd, dmk_d, dmk_c, pv, fsr_dftu, force_u, stress_u, kv, PARAM.globalv.npol);
}
else
{
Expand Down
Loading
Loading