Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
242184c
add update_pot in source_estate
mohanchen Oct 16, 2025
9441396
split update_pot in rt-TDDFT into two functions, one is the original …
mohanchen Oct 17, 2025
dc20084
fix bugs
mohanchen Oct 17, 2025
7829228
update
mohanchen Oct 17, 2025
e842ff4
update esolver_ks
mohanchen Oct 18, 2025
5ade8bb
small updates
mohanchen Oct 18, 2025
d04e97d
small bug fixed
mohanchen Oct 18, 2025
b8237aa
update E_bandgap to E_gap(k)
mohanchen Oct 18, 2025
266fbc2
delete rho_restart file
mohanchen Oct 18, 2025
715f03f
Merge branch 'develop' of https://github.com/mohanchen/abacus-mc into…
mohanchen Oct 18, 2025
3cc238d
Merge branch '20251018' into develop
mohanchen Oct 18, 2025
11d9427
change setup_parameters to print_parameters
mohanchen Oct 18, 2025
4998c0c
move setup_pw.cpp to setup_pwwfc.cpp in module_pwdft
mohanchen Oct 18, 2025
e1154d8
Merge branch 'deepmodeling:develop' into develop
mohanchen Oct 18, 2025
e31c3aa
update esolver, small things
mohanchen Oct 18, 2025
9429236
delete some old_gint codes in esolver
mohanchen Oct 18, 2025
78829e9
fix bugs, update outputs
mohanchen Oct 18, 2025
5463571
fix bug in tests
mohanchen Oct 18, 2025
6f095fb
change efermi to Efermi in fp_energy.h
mohanchen Oct 18, 2025
6b4d7c8
fix bugs
mohanchen Oct 18, 2025
010a575
fix exd and exc in ctrl_runner_lcao
mohanchen Oct 18, 2025
3f23f15
fix cmake
mohanchen Oct 18, 2025
cc834e9
fix bug
mohanchen Oct 18, 2025
fe3bc01
Merge branch 'deepmodeling:develop' into develop
mohanchen Oct 19, 2025
803468f
delete lcao_after_scf and lcao_before_scf
mohanchen Oct 19, 2025
63eab55
modify codes including read_wfc_nao to delete pelec, add setup_psi_lc…
mohanchen Oct 19, 2025
f39bc50
fix bugs
mohanchen Oct 19, 2025
367db31
delete grid integral in FORCE_STRESS
mohanchen Oct 19, 2025
d8bd20a
move read psi to esolver, not in psi
mohanchen Oct 19, 2025
66445eb
fix system bug
mohanchen Oct 19, 2025
73965ea
fix bug in read_wfc_nao.h
mohanchen Oct 19, 2025
4870f18
Merge branch 'develop' into develop
mohanchen Oct 21, 2025
dc2592d
Merge branch 'deepmodeling:develop' into develop
mohanchen Oct 22, 2025
d521c44
change PARAM.inp to inp
mohanchen Oct 22, 2025
5130f4b
fix bugs
mohanchen Oct 22, 2025
10c4d9c
delete omega in pelec, remove some deepks codes to setup_deepks.cpp
mohanchen Oct 22, 2025
207d396
Merge branch 'develop' into develop
mohanchen Oct 22, 2025
a969207
remove exx redundant parameters in Hamilt_LCAO
mohanchen Oct 22, 2025
b32d47a
Merge branch 'develop' of https://github.com/mohanchen/abacus-mc into…
mohanchen Oct 22, 2025
9691f3d
Fix circular dependencies of header files.
mohanchen Oct 22, 2025
54d5c08
Merge branch 'develop' into develop
mohanchen Oct 22, 2025
b997a53
fix bugs in MLALGO
mohanchen Oct 22, 2025
244acfa
refactor exx lcao
mohanchen Oct 23, 2025
a49c409
add rho_tau_lcao files
mohanchen Oct 23, 2025
d309cba
fix bug in setup_deepks
mohanchen Oct 24, 2025
c446b3c
Merge branch 'develop' into 20251023-rho_tau
mohanchen Oct 24, 2025
b8e0d85
move rho_tau_lcao to source_lcao
mohanchen Oct 24, 2025
e493841
remove old psiToRho function in elecstate_lcao and replace with new r…
mohanchen Oct 24, 2025
64f1757
update estate
mohanchen Oct 24, 2025
8e5677f
fix bug in ELF
mohanchen Oct 24, 2025
6559a61
fix bug
mohanchen Oct 24, 2025
8966a3b
update to develop
mohanchen Oct 27, 2025
45e5a9b
Merge branch 'develop' of https://github.com/mohanchen/abacus-mc into…
mohanchen Oct 30, 2025
449d1eb
move DM outside of pelec
mohanchen Oct 30, 2025
e01f84a
deal with init_dm functions
mohanchen Oct 31, 2025
7a6f839
remove pelec in dftu, replace with dmk_d(ouble) and dmk_c(omplex)
mohanchen Nov 2, 2025
7d052a8
fix cal_ldos with DM
mohanchen Nov 2, 2025
26ce47d
update delta_spin
mohanchen Nov 2, 2025
20c5889
update delta spin run_lambda_loop
mohanchen Nov 3, 2025
49301a3
the big issue to remove dm may be caused by cal_mw_from_lambda
mohanchen Nov 3, 2025
ba7d6e6
remove some DM
mohanchen Nov 3, 2025
6ff99f0
keep updating DM
mohanchen Nov 3, 2025
6c0fbe3
refactor some DM in double_xc
mohanchen Nov 3, 2025
ea848fe
now all functions can be compiled
mohanchen Nov 3, 2025
b53865f
fix it
mohanchen Nov 3, 2025
236b8a8
update again
mohanchen Nov 3, 2025
b6bedf5
add and compile setup_dm
mohanchen Nov 3, 2025
2abcc9a
update fix bugs
mohanchen Nov 3, 2025
a9b1104
simplify dm
mohanchen Nov 4, 2025
531b647
one more fix
mohanchen Nov 4, 2025
bbfea9a
now I can compile the code
mohanchen Nov 4, 2025
fc7bc7c
fix some bugs in EXX version
mohanchen Nov 4, 2025
540d845
Merge branch 'develop' of https://github.com/mohanchen/abacus-mc into…
mohanchen Nov 4, 2025
59d1891
solve conflicts
mohanchen Nov 4, 2025
1af42b8
fix FORCE_STRESS
mohanchen Nov 4, 2025
93fd786
fix 2
mohanchen Nov 4, 2025
1b4f8b6
fix 3
mohanchen Nov 4, 2025
600421c
fix 4
mohanchen Nov 4, 2025
8bd559a
fix 5
mohanchen Nov 4, 2025
f3d9986
improve esolver_ks_lcao
mohanchen Nov 4, 2025
e0c7a6b
Merge branch 'develop' into develop
mohanchen Nov 4, 2025
8789c9f
improve again
mohanchen Nov 4, 2025
4d2cf41
comment out psi2rho in init_dm
mohanchen Nov 4, 2025
aef0c12
clean esolver_ks_lcao
mohanchen Nov 4, 2025
4dc6f15
Merge branch 'develop' of https://github.com/mohanchen/abacus-mc into…
mohanchen Nov 4, 2025
0ba139b
update structure_factor
mohanchen Nov 4, 2025
3f77d97
update sf
mohanchen Nov 4, 2025
ed64231
update
mohanchen Nov 5, 2025
1d71aa7
fix sf
mohanchen Nov 5, 2025
8029f27
fix
mohanchen Nov 5, 2025
3fe9aed
fix structure factor
mohanchen Nov 5, 2025
639fc03
Merge branch 'deepmodeling:develop' into develop
mohanchen Nov 5, 2025
e35ae58
update DFTU, remove GlobalC of DFTU
mohanchen Nov 5, 2025
90dcf98
remove some GlobalC
mohanchen Nov 5, 2025
43026d8
remove GlobalC, rename ModuleDFTU::DFTU class to Plus_U
mohanchen Nov 6, 2025
b3f8637
keep updating DFTU
mohanchen Nov 6, 2025
dd1256c
fix +U forces and stress
mohanchen Nov 6, 2025
7d29c43
fix dm bug in PEXSI
mohanchen Nov 6, 2025
7807e61
Merge branch 'develop' into develop
mohanchen Nov 6, 2025
01a83f2
fix PEXSI
mohanchen Nov 7, 2025
901bd50
Merge branch 'develop' of https://github.com/mohanchen/abacus-mc into…
mohanchen Nov 7, 2025
5020b40
Update edm.cpp
ZhouXY-PKU Nov 7, 2025
c4d309d
fix edm
mohanchen Nov 7, 2025
686be13
solve edm conflict
mohanchen Nov 7, 2025
884d47d
Update hsolver_lcao.cpp
ZhouXY-PKU Nov 7, 2025
c010f37
Update hsolver_lcao.cpp
ZhouXY-PKU Nov 7, 2025
0e4a6c2
keep removing dftu
mohanchen Nov 7, 2025
72c79ab
update dftu, remove GlobalC
mohanchen Nov 7, 2025
3b7762c
keep removing GlobalC::DFTU
mohanchen Nov 7, 2025
1dfa127
remove all GlobalC::dftu
mohanchen Nov 7, 2025
c2e19f7
Merge branch 'develop' of https://github.com/mohanchen/abacus-mc into…
mohanchen Nov 7, 2025
9e312fe
Merge branch '2025-11-05' into develop
mohanchen Nov 7, 2025
f91742a
fix gpu +U
mohanchen Nov 8, 2025
6d58515
fix tests related to removal of GlobalC::dftu
mohanchen Nov 8, 2025
2229b44
fix again
mohanchen Nov 8, 2025
aea6568
fix bug that ignoring pass dftu pointer
mohanchen Nov 8, 2025
559c0a4
update +U
mohanchen Nov 8, 2025
1a2cfc0
add output of DFT+U energy term
mohanchen Nov 8, 2025
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
4 changes: 3 additions & 1 deletion source/source_esolver/esolver_double_xc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ void ESolver_DoubleXC<TK, TR>::before_scf(UnitCell& ucell, const int istep)
this->kv,
this->two_center_bundle_,
this->orb_,
this->dmat_base.dm,
this->dmat_base.dm,
&this->dftu,
this->deepks,
istep,
this->exx_nao);
Expand Down Expand Up @@ -396,6 +397,7 @@ void ESolver_DoubleXC<TK, TR>::cal_force(UnitCell& ucell, ModuleBase::matrix& fo
this->kv,
this->pw_rho,
this->solvent,
this->dftu,
this->deepks,
this->exx_nao,
&ucell.symm);
Expand Down
2 changes: 1 addition & 1 deletion source/source_esolver/esolver_gets.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ESolver_GetS : public ESolver_KS<std::complex<double>>

TwoCenterBundle two_center_bundle_;

// temporary introduced during removing GlobalC::ORB
// temporary introduced
LCAO_Orbitals orb_;
};
} // namespace ModuleESolver
Expand Down
13 changes: 12 additions & 1 deletion source/source_esolver/esolver_ks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "source_estate/elecstate_print.h" // print_etot
#include "source_io/print_info.h" // print_parameters
#include "source_psi/setup_psi.h" // mohan add 20251009
#include "source_lcao/module_dftu/dftu.h" // mohan add 2025-11-07

namespace ModuleESolver
{
Expand Down Expand Up @@ -281,9 +282,19 @@ void ESolver_KS<T, Device>::iter_finish(UnitCell& ucell, const int istep, int& i
this->pelec->nelec_spin.data());

// 2.2) charge mixing
// SCF will continue if U is not converged for uramping calculation
bool converged_u = true;
// to avoid unnecessary dependence on dft+u, refactor is needed
#ifdef __LCAO
if (PARAM.inp.dft_plus_u)
{
converged_u = this->dftu.u_converged();
}
#endif

module_charge::chgmixing_ks(iter, ucell, this->pelec, this->chr, this->p_chgmix,
this->pw_rhod->nrxx, this->drho, this->oscillate_esolver, conv_esolver, hsolver_error,
this->scf_thr, this->scf_ene_thr, PARAM.inp);
this->scf_thr, this->scf_ene_thr, converged_u, PARAM.inp);

// 2.3) Update potentials (should be done every SF iter)
elecstate::update_pot(ucell, this->pelec, this->chr, conv_esolver);
Expand Down
4 changes: 4 additions & 0 deletions source/source_esolver/esolver_ks.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "source_estate/module_charge/charge_mixing.h" // use charge mixing
#include "source_psi/psi.h" // use electronic wave functions
#include "source_hamilt/hamilt.h" // use Hamiltonian
#include "source_lcao/module_dftu/dftu.h" // mohan add 20251107

namespace ModuleESolver
{
Expand Down Expand Up @@ -61,6 +62,9 @@ class ESolver_KS : public ESolver_FP
//! Electronic wavefunctions
psi::Psi<T>* psi = nullptr;

//! DFT+U method, mohan add 2025-11-07
Plus_U dftu;

std::string basisname; //! esolver_ks_lcao.cpp
double esolver_KS_ne = 0.0; //! number of electrons
double diag_ethr; //! the threshold for diagonalization
Expand Down
33 changes: 16 additions & 17 deletions source/source_esolver/esolver_ks_lcao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "source_lcao/hs_matrix_k.hpp" // there may be multiple definitions if using hpp
#include "source_estate/module_charge/symmetry_rho.h"
#include "source_lcao/LCAO_domain.h" // need DeePKS_init
#include "source_lcao/module_dftu/dftu.h"
#include "source_lcao/FORCE_STRESS.h"
#include "source_estate/elecstate_lcao.h"
#include "source_lcao/hamilt_lcao.h"
Expand Down Expand Up @@ -99,8 +98,7 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(UnitCell& ucell, const Input_pa
// 9) initialize DFT+U
if (inp.dft_plus_u)
{
auto* dftu = ModuleDFTU::DFTU::get_instance();
dftu->init(ucell, &this->pv, this->kv.get_nks(), &orb_);
this->dftu.init(ucell, &this->pv, this->kv.get_nks(), &orb_);
}

// 10) init local pseudopotentials
Expand Down Expand Up @@ -189,7 +187,7 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(UnitCell& ucell, const int istep)
{
this->p_hamilt = new hamilt::HamiltLCAO<TK, TR>(
ucell, this->gd, &this->pv, this->pelec->pot, this->kv,
two_center_bundle_, orb_, this->dmat.dm, this->deepks, istep, exx_nao);
two_center_bundle_, orb_, this->dmat.dm, &this->dftu, this->deepks, istep, exx_nao);
}

// 9) for each ionic step, the overlap <phi|alpha> must be rebuilt
Expand Down Expand Up @@ -274,7 +272,7 @@ void ESolver_KS_LCAO<TK, TR>::cal_force(UnitCell& ucell, ModuleBase::matrix& for
this->gd, this->pv, this->pelec, this->dmat, this->psi,
two_center_bundle_, orb_, force, this->scs,
this->locpp, this->sf, this->kv,
this->pw_rho, this->solvent, this->deepks,
this->pw_rho, this->solvent, this->dftu, this->deepks,
this->exx_nao, &ucell.symm);

// delete RA after cal_force
Expand Down Expand Up @@ -338,7 +336,8 @@ void ESolver_KS_LCAO<TK, TR>::iter_init(UnitCell& ucell, const int istep, const
// call iter_init() of ESolver_KS
ESolver_KS<TK>::iter_init(ucell, istep, iter);

module_charge::chgmixing_ks_lcao(iter, this->p_chgmix, this->dmat.dm->get_DMR_pointer(1)->get_nnr(), PARAM.inp);
module_charge::chgmixing_ks_lcao(iter, this->p_chgmix, this->dftu,
this->dmat.dm->get_DMR_pointer(1)->get_nnr(), PARAM.inp);

// mohan update 2012-06-05
this->pelec->f_en.deband_harris = this->pelec->cal_delta_eband(ucell);
Expand Down Expand Up @@ -377,10 +376,10 @@ void ESolver_KS_LCAO<TK, TR>::iter_init(UnitCell& ucell, const int istep, const
{
if (istep != 0 || iter != 1)
{
GlobalC::dftu.set_dmr(this->dmat.dm);
this->dftu.set_dmr(this->dmat.dm);
}
// Calculate U and J if Yukawa potential is used
GlobalC::dftu.cal_slater_UJ(ucell, this->chr.rho, this->pw_rho->nrxx);
this->dftu.cal_slater_UJ(ucell, this->chr.rho, this->pw_rho->nrxx);
}

#ifdef __MLALGO
Expand Down Expand Up @@ -489,18 +488,18 @@ void ESolver_KS_LCAO<TK, TR>::iter_finish(UnitCell& ucell, const int istep, int&
// 1) calculate the local occupation number matrix and energy correction in DFT+U
if (PARAM.inp.dft_plus_u)
{
// only old DFT+U method should calculated energy correction in esolver,
// new DFT+U method will calculate energy in calculating Hamiltonian
// old DFT+U method calculates energy correction in esolver,
// new DFT+U method calculates energy in Hamiltonian
if (PARAM.inp.dft_plus_u == 2)
{
if (GlobalC::dftu.omc != 2)
if (this->dftu.omc != 2)
{
ModuleDFTU::dftu_cal_occup_m(iter, ucell, dm_vec, this->kv,
this->p_chgmix->get_mixing_beta(), hamilt_lcao);
dftu_cal_occup_m(iter, ucell, dm_vec, this->kv,
this->p_chgmix->get_mixing_beta(), hamilt_lcao, this->dftu);
}
GlobalC::dftu.cal_energy_correction(ucell, istep);
this->dftu.cal_energy_correction(ucell, istep);
}
GlobalC::dftu.output(ucell);
this->dftu.output(ucell);
}

// 2) for deepks, calculate delta_e, output labels during electronic steps
Expand Down Expand Up @@ -532,7 +531,7 @@ void ESolver_KS_LCAO<TK, TR>::iter_finish(UnitCell& ucell, const int istep, int&
// use the converged occupation matrix for next MD/Relax SCF calculation
if (PARAM.inp.dft_plus_u && conv_esolver)
{
GlobalC::dftu.initialed_locale = true;
this->dftu.initialed_locale = true;
}

// control the output related to the finished iteration
Expand Down Expand Up @@ -566,7 +565,7 @@ void ESolver_KS_LCAO<TK, TR>::after_scf(UnitCell& ucell, const int istep, const
//! 2) output of lcao every few ionic steps
ModuleIO::ctrl_scf_lcao<TK, TR>(ucell,
PARAM.inp, this->kv, this->pelec, this->dmat.dm, this->pv,
this->gd, this->psi, hamilt_lcao, this->two_center_bundle_,
this->gd, this->psi, hamilt_lcao, this->dftu, this->two_center_bundle_,
this->orb_, this->pw_wfc, this->pw_rho, this->pw_big, this->sf,
this->rdmft_solver, this->deepks, this->exx_nao,
this->conv_esolver, this->scf_nmax_flag, istep);
Expand Down
24 changes: 13 additions & 11 deletions source/source_esolver/esolver_ks_lcao.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,32 +69,34 @@ class ESolver_KS_LCAO : public ESolver_KS<TK>
//! GintInfo: used to store some basic infomation about module_gint
std::unique_ptr<ModuleGint::GintInfo> gint_info_;

//! NAO: store related information
LCAO_Orbitals orb_;

//! NAO orbitals: two-center integrations
TwoCenterBundle two_center_bundle_;

//! Add density matrix class, mohan add 2025-10-30
LCAO_domain::Setup_DM<TK> dmat;


// For deepks method, mohan add 2025-10-08
Setup_DeePKS<TK> deepks;

// For exact-exchange energy, mohan add 2025-10-08
Exx_NAO<TK> exx_nao;

//! For RDMFT calculations, added by jghan, 2024-03-16
rdmft::RDMFT<TK, TR> rdmft_solver;

//! NAO: store related information
LCAO_Orbitals orb_;
//! For linear-response TDDFT
friend class LR::ESolver_LR<double, double>;
friend class LR::ESolver_LR<std::complex<double>, double>;

// Temporarily store the stress to unify the interface with PW,
// because it's hard to seperate force and stress calculation in LCAO.
ModuleBase::matrix scs;
bool have_force = false;

// deepks method, mohan add 2025-10-08
Setup_DeePKS<TK> deepks;

// exact-exchange energy, mohan add 2025-10-08
Exx_NAO<TK> exx_nao;

friend class LR::ESolver_LR<double, double>;
friend class LR::ESolver_LR<std::complex<double>, double>;


public:
const Record_adj & get_RA() const { return RA; }
Expand Down
25 changes: 16 additions & 9 deletions source/source_esolver/esolver_ks_pw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ ESolver_KS_PW<T, Device>::~ESolver_KS_PW()
template <typename T, typename Device>
void ESolver_KS_PW<T, Device>::allocate_hamilt(const UnitCell& ucell)
{
this->p_hamilt = new hamilt::HamiltPW<T, Device>(this->pelec->pot, this->pw_wfc, &this->kv, &this->ppcell, &ucell);
this->p_hamilt = new hamilt::HamiltPW<T, Device>(
this->pelec->pot,
this->pw_wfc,
&this->kv,
&this->ppcell,
&this->dftu,
&ucell);
}

template <typename T, typename Device>
Expand Down Expand Up @@ -133,8 +139,10 @@ void ESolver_KS_PW<T, Device>::before_scf(UnitCell& ucell, const int istep)
this->allocate_hamilt(ucell);

//! Setup potentials (local, non-local, sc, +U, DFT-1/2)
// note: init DFT+U is done here for pw basis for every scf iteration, however,
// init DFT+U is done in "before_all_runners" in LCAO basis. This should be refactored, mohan note 2025-11-06
pw::setup_pot(istep, ucell, this->kv, this->sf, this->pelec, this->Pgrid,
this->chr, this->locpp, this->ppcell, this->vsep_cell,
this->chr, this->locpp, this->ppcell, this->dftu, this->vsep_cell,
this->stp.psi_t, this->p_hamilt, this->pw_wfc, this->pw_rhod, PARAM.inp);

// setup psi (electronic wave functions)
Expand Down Expand Up @@ -162,7 +170,7 @@ void ESolver_KS_PW<T, Device>::iter_init(UnitCell& ucell, const int istep, const
ESolver_KS<T, Device>::iter_init(ucell, istep, iter);

// 2) perform charge mixing for KSDFT using pw basis
module_charge::chgmixing_ks_pw(iter, this->p_chgmix, PARAM.inp);
module_charge::chgmixing_ks_pw(iter, this->p_chgmix, this->dftu, PARAM.inp);

// 3) mohan move harris functional here, 2012-06-05
// use 'rho(in)' and 'v_h and v_xc'(in)
Expand All @@ -172,14 +180,13 @@ void ESolver_KS_PW<T, Device>::iter_init(UnitCell& ucell, const int istep, const
// should before lambda loop in DeltaSpin
if (PARAM.inp.dft_plus_u && (iter != 1 || istep != 0))
{
auto* dftu = ModuleDFTU::DFTU::get_instance();
// only old DFT+U method should calculate energy correction in esolver,
// new DFT+U method will calculate energy when evaluating the Hamiltonian
if (dftu->omc != 2)
if (this->dftu.omc != 2)
{
dftu->cal_occ_pw(iter, this->stp.psi_t, this->pelec->wg, ucell, PARAM.inp.mixing_beta);
this->dftu.cal_occ_pw(iter, this->stp.psi_t, this->pelec->wg, ucell, PARAM.inp.mixing_beta);
}
dftu->output(ucell);
this->dftu.output(ucell);
}
}

Expand Down Expand Up @@ -389,7 +396,7 @@ void ESolver_KS_PW<T, Device>::cal_force(UnitCell& ucell, ModuleBase::matrix& fo

// Calculate forces
ff.cal_force(ucell, force, *this->pelec, this->pw_rhod, &ucell.symm,
&this->sf, this->solvent, &this->locpp, &this->ppcell,
&this->sf, this->solvent, &this->dftu, &this->locpp, &this->ppcell,
&this->kv, this->pw_wfc, this->stp.psi_d);
}

Expand All @@ -401,7 +408,7 @@ void ESolver_KS_PW<T, Device>::cal_stress(UnitCell& ucell, ModuleBase::matrix& s
// mohan add 2025-10-12
this->stp.update_psi_d();

ss.cal_stress(stress, ucell, this->locpp, this->ppcell, this->pw_rhod,
ss.cal_stress(stress, ucell, this->dftu, this->locpp, this->ppcell, this->pw_rhod,
&ucell.symm, &this->sf, &this->kv, this->pw_wfc, this->stp.psi_d);

// external stress
Expand Down
5 changes: 4 additions & 1 deletion source/source_esolver/esolver_of.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,10 @@ double ESolver_OF::cal_energy()
void ESolver_OF::cal_force(UnitCell& ucell, ModuleBase::matrix& force)
{
Forces<double> ff(ucell.nat);
ff.cal_force(ucell, force, *pelec, this->pw_rho, &ucell.symm, &sf, this->solvent, &this->locpp);

// here nullptr is for DFT+U, which may cause bugs, mohan note 2025-11-07
// solvent can be used? mohan ask 2025-11-07
ff.cal_force(ucell, force, *pelec, this->pw_rho, &ucell.symm, &sf, this->solvent, nullptr, &this->locpp);
}

/**
Expand Down
1 change: 1 addition & 0 deletions source/source_esolver/lcao_others.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ void ESolver_KS_LCAO<TK, TR>::others(UnitCell& ucell, const int istep)
two_center_bundle_,
orb_,
this->dmat.dm,
&this->dftu,
this->deepks,
istep,
this->exx_nao);
Expand Down
6 changes: 3 additions & 3 deletions source/source_estate/elecstate_energy_terms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "source_estate/module_pot/gatefield.h"
#include "source_lcao/module_deepks/LCAO_deepks.h"
#include "source_lcao/module_deltaspin/spin_constrain.h"
#include "source_lcao/module_dftu/dftu.h"
#include "source_lcao/module_dftu/dftu.h" // mohan add 2025-11-06

namespace elecstate
{
Expand Down Expand Up @@ -36,7 +36,7 @@ double ElecState::get_solvent_model_Acav()

double ElecState::get_dftu_energy()
{
return GlobalC::dftu.get_energy();
return Plus_U::get_energy();
}

double ElecState::get_local_pp_energy()
Expand All @@ -52,4 +52,4 @@ double ElecState::get_local_pp_energy()
return local_pseudopot_energy;
}

} // namespace elecstate
} // namespace elecstate
Loading
Loading