Skip to content
Merged
Show file tree
Hide file tree
Changes from 77 commits
Commits
Show all changes
91 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
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
1 change: 1 addition & 0 deletions source/Makefile.Objects
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ OBJS_LCAO=evolve_elec.o\
LCAO_init_basis.o\
setup_exx.o\
setup_deepks.o\
setup_dm.o\
rho_tau_lcao.o\
center2_orb.o\
center2_orb-orb11.o\
Expand Down
14 changes: 3 additions & 11 deletions source/source_esolver/esolver_dm2rho.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,30 +46,22 @@ void ESolver_DM2rho<TK, TR>::runner(UnitCell& ucell, const int istep)

ESolver_KS_LCAO<TK, TR>::before_scf(ucell, istep);

auto* estate = dynamic_cast<elecstate::ElecStateLCAO<TK>*>(this->pelec);

if(!estate)
{
ModuleBase::WARNING_QUIT("ESolver_DM2rho::after_scf","pelec does not exist");
}

// file name of DM
std::string zipname = "output_DM0.npz";
elecstate::DensityMatrix<TK, double>* dm = estate->get_DM();

// read DM from file
ModuleIO::read_mat_npz(&(this->pv), ucell, zipname, *(dm->get_DMR_pointer(1)));
ModuleIO::read_mat_npz(&(this->pv), ucell, zipname, *(this->dmat.dm->get_DMR_pointer(1)));

// if nspin=2, need extra reading
if (PARAM.inp.nspin == 2)
{
zipname = "output_DM1.npz";
ModuleIO::read_mat_npz(&(this->pv), ucell, zipname, *(dm->get_DMR_pointer(2)));
ModuleIO::read_mat_npz(&(this->pv), ucell, zipname, *(this->dmat.dm->get_DMR_pointer(2)));
}

// it's dangerous to design psiToRho function like this, mohan note 20251024
// this->pelec->psiToRho(*this->psi);
LCAO_domain::dm2rho(estate->DM->get_DMR_vector(), PARAM.inp.nspin, &this->chr);
LCAO_domain::dm2rho(this->dmat.dm->get_DMR_vector(), PARAM.inp.nspin, &this->chr);

int nspin0 = PARAM.inp.nspin == 2 ? 2 : 1;

Expand Down
54 changes: 27 additions & 27 deletions source/source_esolver/esolver_double_xc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void ESolver_DoubleXC<TK, TR>::before_all_runners(UnitCell& ucell, const Input_p
}

// 6) initialize the density matrix
dynamic_cast<elecstate::ElecStateLCAO<TK>*>(this->pelec_base)->init_DM(&this->kv, &(this->pv), PARAM.inp.nspin);
this->dmat_base.allocate_dm(&this->kv, &this->pv, PARAM.inp.nspin);

// 10) inititlize the charge density
this->chr_base.allocate(PARAM.inp.nspin);
Expand Down Expand Up @@ -138,8 +138,6 @@ void ESolver_DoubleXC<TK, TR>::before_scf(UnitCell& ucell, const int istep)
}
if (this->p_hamilt_base == nullptr)
{
elecstate::DensityMatrix<TK, double>* DM = dynamic_cast<elecstate::ElecStateLCAO<TK>*>(this->pelec_base)->get_DM();

this->p_hamilt_base = new hamilt::HamiltLCAO<TK, TR>(
ucell,
this->gd,
Expand All @@ -148,7 +146,7 @@ void ESolver_DoubleXC<TK, TR>::before_scf(UnitCell& ucell, const int istep)
this->kv,
this->two_center_bundle_,
this->orb_,
DM,
this->dmat_base.dm,
this->deepks,
istep,
this->exx_nao);
Expand All @@ -159,13 +157,11 @@ void ESolver_DoubleXC<TK, TR>::before_scf(UnitCell& ucell, const int istep)
XC_Functional::set_xc_type(ucell.atoms[0].ncpp.xc_func);

// DMR should be same size with Hamiltonian(R)
dynamic_cast<elecstate::ElecStateLCAO<TK>*>(this->pelec_base)
->get_DM()
->init_DMR(*(dynamic_cast<hamilt::HamiltLCAO<TK, TR>*>(this->p_hamilt_base)->getHR()));
this->dmat_base.dm->init_DMR(*(dynamic_cast<hamilt::HamiltLCAO<TK, TR>*>(this->p_hamilt_base)->getHR()));

if (istep > 0)
{
dynamic_cast<elecstate::ElecStateLCAO<TK>*>(this->pelec_base)->get_DM()->cal_DMR();
this->dmat_base.dm->cal_DMR();
}

ModuleBase::timer::tick("ESolver_DoubleXC", "before_scf");
Expand Down Expand Up @@ -226,23 +222,23 @@ void ESolver_DoubleXC<TK, TR>::iter_finish(UnitCell& ucell, const int istep, int
std::shared_ptr<LCAO_Deepks<TK>> ld_shared_ptr(&this->deepks.ld, [](LCAO_Deepks<TK>*) {});
LCAO_Deepks_Interface<TK, TR> deepks_interface(ld_shared_ptr);

deepks_interface.out_deepks_labels(this->pelec->f_en.etot,
this->kv.get_nks(),
ucell.nat,
PARAM.globalv.nlocal,
this->pelec->ekb,
this->kv.kvec_d,
ucell,
this->orb_,
this->gd,
&(this->pv),
*(this->psi),
dynamic_cast<const elecstate::ElecStateLCAO<TK>*>(this->pelec)->get_DM(),
p_ham_deepks,
iter,
conv_esolver,
GlobalV::MY_RANK,
GlobalV::ofs_running);
deepks_interface.out_deepks_labels(this->pelec->f_en.etot,
this->kv.get_nks(),
ucell.nat,
PARAM.globalv.nlocal,
this->pelec->ekb,
this->kv.kvec_d,
ucell,
this->orb_,
this->gd,
&(this->pv),
*(this->psi),
this->dmat_base.dm,
p_ham_deepks,
iter,
conv_esolver,
GlobalV::MY_RANK,
GlobalV::ofs_running);
#endif

// restore to density after charge mixing
Expand Down Expand Up @@ -352,9 +348,12 @@ void ESolver_DoubleXC<TK, TR>::iter_finish(UnitCell& ucell, const int istep, int
auto _pes_lcao = dynamic_cast<elecstate::ElecStateLCAO<TK>*>(this->pelec);
for (int ik = 0; ik < nks; ik++)
{
_pes_lcao_base->get_DM()->set_DMK_pointer(ik, _pes_lcao->get_DM()->get_DMK_pointer(ik));
// mohan update 2025-11-03
this->dmat_base.dm->set_DMK_pointer(ik, this->dmat.dm->get_DMK_pointer(ik));
// _pes_lcao_base->get_DM()->set_DMK_pointer(ik, _pes_lcao->get_DM()->get_DMK_pointer(ik));
}
_pes_lcao_base->get_DM()->cal_DMR();
this->dmat_base.dm->cal_DMR();
// _pes_lcao_base->get_DM()->cal_DMR();
_pes_lcao_base->ekb = _pes_lcao->ekb;
_pes_lcao_base->wg = _pes_lcao->wg;
}
Expand Down Expand Up @@ -386,6 +385,7 @@ void ESolver_DoubleXC<TK, TR>::cal_force(UnitCell& ucell, ModuleBase::matrix& fo
this->gd,
this->pv,
this->pelec_base,
this->dmat_base, // mohan add 2025-11-03
this->psi,
this->two_center_bundle_,
this->orb_,
Expand Down
3 changes: 3 additions & 0 deletions source/source_esolver/esolver_double_xc.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class ESolver_DoubleXC : public ESolver_KS_LCAO<TK, TR>
//! Electronic states
elecstate::ElecState* pelec_base = nullptr;

//! Density Matrix, mohan add 2025-11-03
LCAO_domain::Setup_DM<TK> dmat_base;

//! Electorn charge density
Charge chr_base;
};
Expand Down
53 changes: 23 additions & 30 deletions source/source_esolver/esolver_ks_lcao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(UnitCell& ucell, const Input_pa


// 7) init DMK, but DMR is constructed in before_scf()
dynamic_cast<elecstate::ElecStateLCAO<TK>*>(this->pelec)->init_DM(&this->kv, &(this->pv), inp.nspin);
this->dmat.allocate_dm(&this->kv, &this->pv, inp.nspin);

// 8) init exact exchange calculations
this->exx_nao.before_runner(ucell, this->kv, this->orb_, this->pv, inp);
Expand Down Expand Up @@ -153,12 +153,6 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(UnitCell& ucell, const int istep)
//! 1) call before_scf() of ESolver_KS.
ESolver_KS<TK>::before_scf(ucell, istep);

auto* estate = dynamic_cast<elecstate::ElecStateLCAO<TK>*>(this->pelec);
if(!estate)
{
ModuleBase::WARNING_QUIT("ESolver_KS_LCAO::before_scf","pelec does not exist");
}

//! 2) find search radius
double search_radius = atom_arrange::set_sr_NL(GlobalV::ofs_running,
PARAM.inp.out_level, orb_.get_rcutmax_Phi(), ucell.infoNL.get_rcutmax_Beta(),
Expand Down Expand Up @@ -193,11 +187,9 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(UnitCell& ucell, const int istep)
}
if (this->p_hamilt == nullptr)
{
elecstate::DensityMatrix<TK, double>* DM = estate->get_DM();

this->p_hamilt = new hamilt::HamiltLCAO<TK, TR>(
ucell, this->gd, &this->pv, this->pelec->pot, this->kv,
two_center_bundle_, orb_, DM, this->deepks, istep, exx_nao);
two_center_bundle_, orb_, this->dmat.dm, this->deepks, istep, exx_nao);
}

// 9) for each ionic step, the overlap <phi|alpha> must be rebuilt
Expand All @@ -210,7 +202,7 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(UnitCell& ucell, const int istep)
spinconstrain::SpinConstrain<TK>& sc = spinconstrain::SpinConstrain<TK>::getScInstance();
sc.init_sc(PARAM.inp.sc_thr, PARAM.inp.nsc, PARAM.inp.nsc_min, PARAM.inp.alpha_trial,
PARAM.inp.sccut, PARAM.inp.sc_drop_thr, ucell, &(this->pv),
PARAM.inp.nspin, this->kv, this->p_hamilt, this->psi, this->pelec);
PARAM.inp.nspin, this->kv, this->p_hamilt, this->psi, this->dmat.dm, this->pelec);
}

// 11) set xc type before the first cal of xc in pelec->init_scf, Peize Lin add 2016-12-03
Expand All @@ -226,7 +218,7 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(UnitCell& ucell, const int istep)
{
ModuleBase::WARNING_QUIT("ESolver_KS_LCAO::before_scf","p_hamilt does not exist");
}
estate->get_DM()->init_DMR(*hamilt_lcao->getHR());
this->dmat.dm->init_DMR(*hamilt_lcao->getHR());

#ifdef __MLALGO
// 14) initialize DMR of DeePKS
Expand All @@ -238,7 +230,7 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(UnitCell& ucell, const int istep)
// 2. DMK in DensityMatrix is empty (istep == 0), then DMR is initialized by zeros
if (istep > 0)
{
estate->get_DM()->cal_DMR();
this->dmat.dm->cal_DMR();
}

// 16) the electron charge density should be symmetrized,
Expand Down Expand Up @@ -282,7 +274,7 @@ void ESolver_KS_LCAO<TK, TR>::cal_force(UnitCell& ucell, ModuleBase::matrix& for

fsl.getForceStress(ucell, PARAM.inp.cal_force, PARAM.inp.cal_stress,
PARAM.inp.test_force, PARAM.inp.test_stress,
this->gd, this->pv, this->pelec, this->psi,
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,
Expand Down Expand Up @@ -341,7 +333,7 @@ void ESolver_KS_LCAO<TK, TR>::after_all_runners(UnitCell& ucell)
}

ModuleIO::ctrl_runner_lcao<TK, TR>(ucell,
PARAM.inp, this->kv, estate, this->pv, this->Pgrid,
PARAM.inp, this->kv, estate, this->dmat, this->pv, this->Pgrid,
this->gd, this->psi, this->chr, hamilt_lcao,
this->two_center_bundle_,
this->orb_, this->pw_rho, this->pw_rhod,
Expand All @@ -365,9 +357,7 @@ void ESolver_KS_LCAO<TK, TR>::iter_init(UnitCell& ucell, const int istep, const
ModuleBase::WARNING_QUIT("ESolver_KS_LCAO::iter_init","pelec does not exist");
}

elecstate::DensityMatrix<TK, double>* dm = estate->get_DM();

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

// mohan update 2012-06-05
estate->f_en.deband_harris = estate->cal_delta_eband(ucell);
Expand All @@ -384,7 +374,7 @@ void ESolver_KS_LCAO<TK, TR>::iter_init(UnitCell& ucell, const int istep, const
this->exx_nao.exd->two_level_step : this->exx_nao.exc->two_level_step;
}
#endif
elecstate::init_dm<TK>(ucell, estate, this->psi, this->chr, iter, exx_two_level_step);
elecstate::init_dm<TK>(ucell, estate, this->dmat, this->psi, this->chr, iter, exx_two_level_step);
}

#ifdef __EXX
Expand All @@ -393,11 +383,11 @@ void ESolver_KS_LCAO<TK, TR>::iter_init(UnitCell& ucell, const int istep, const
{
if (GlobalC::exx_info.info_ri.real_number)
{
this->exx_nao.exd->exx_eachiterinit(istep, ucell, *dm, this->kv, iter);
this->exx_nao.exd->exx_eachiterinit(istep, ucell, *this->dmat.dm, this->kv, iter);
}
else
{
this->exx_nao.exc->exx_eachiterinit(istep, ucell, *dm, this->kv, iter);
this->exx_nao.exc->exx_eachiterinit(istep, ucell, *this->dmat.dm, this->kv, iter);
}
}
#endif
Expand All @@ -406,7 +396,7 @@ void ESolver_KS_LCAO<TK, TR>::iter_init(UnitCell& ucell, const int istep, const
{
if (istep != 0 || iter != 1)
{
GlobalC::dftu.set_dmr(dm);
GlobalC::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);
Expand All @@ -432,7 +422,7 @@ void ESolver_KS_LCAO<TK, TR>::iter_init(UnitCell& ucell, const int istep, const
// save density matrix DMR for mixing
if (PARAM.inp.mixing_restart > 0 && PARAM.inp.mixing_dmr && this->p_chgmix->mixing_restart_count > 0)
{
dm->save_DMR();
this->dmat.dm->save_DMR();
}
}

Expand Down Expand Up @@ -470,7 +460,8 @@ void ESolver_KS_LCAO<TK, TR>::hamilt2rho_single(UnitCell& ucell, int istep, int
if (!skip_solve)
{
hsolver::HSolverLCAO<TK> hsolver_lcao_obj(&(this->pv), PARAM.inp.ks_solver);
hsolver_lcao_obj.solve(this->p_hamilt, this->psi[0], this->pelec, this->chr, PARAM.inp.nspin, skip_charge);
hsolver_lcao_obj.solve(this->p_hamilt, this->psi[0], this->pelec, *this->dmat.dm,
this->chr, PARAM.inp.nspin, skip_charge);
}

// 4) EXX
Expand Down Expand Up @@ -518,7 +509,7 @@ void ESolver_KS_LCAO<TK, TR>::iter_finish(UnitCell& ucell, const int istep, int&
ModuleBase::WARNING_QUIT("ESolver_KS_LCAO::iter_finish","p_hamilt does not exist");
}

const std::vector<std::vector<TK>>& dm_vec = estate->get_DM()->get_DMK_vector();
const std::vector<std::vector<TK>>& dm_vec = this->dmat.dm->get_DMK_vector();

// 1) calculate the local occupation number matrix and energy correction in DFT+U
if (PARAM.inp.dft_plus_u)
Expand Down Expand Up @@ -559,8 +550,7 @@ void ESolver_KS_LCAO<TK, TR>::iter_finish(UnitCell& ucell, const int istep, int&
{
if (PARAM.inp.mixing_restart > 0 && this->p_chgmix->mixing_restart_count > 0 && PARAM.inp.mixing_dmr)
{
elecstate::DensityMatrix<TK, double>* dm = estate->get_DM();
this->p_chgmix->mix_dmr(dm);
this->p_chgmix->mix_dmr(this->dmat.dm);
}
}

Expand All @@ -571,7 +561,7 @@ void ESolver_KS_LCAO<TK, TR>::iter_finish(UnitCell& ucell, const int istep, int&
}

// control the output related to the finished iteration
ModuleIO::ctrl_iter_lcao<TK, TR>(ucell, PARAM.inp, this->kv, estate,
ModuleIO::ctrl_iter_lcao<TK, TR>(ucell, PARAM.inp, this->kv, estate, *this->dmat.dm,
this->pv, this->gd, this->psi, this->chr, this->p_chgmix,
hamilt_lcao, this->orb_, this->deepks,
this->exx_nao, iter, istep, conv_esolver, this->scf_ene_thr);
Expand Down Expand Up @@ -599,16 +589,19 @@ void ESolver_KS_LCAO<TK, TR>::after_scf(UnitCell& ucell, const int istep, const

if (PARAM.inp.out_elf[0] > 0)
{
LCAO_domain::dm2tau(estate->DM->get_DMR_vector(), PARAM.inp.nspin, estate->charge);
LCAO_domain::dm2tau(this->dmat.dm->get_DMR_vector(), PARAM.inp.nspin, this->pelec->charge);
}

//! 1) call after_scf() of ESolver_KS
ESolver_KS<TK>::after_scf(ucell, istep, conv_esolver);


//! 2) output of lcao every few ionic steps



ModuleIO::ctrl_scf_lcao<TK, TR>(ucell,
PARAM.inp, this->kv, estate, this->pv,
PARAM.inp, this->kv, estate, this->dmat.dm, this->pv,
this->gd, this->psi, hamilt_lcao,
this->two_center_bundle_,
this->orb_, this->pw_wfc, this->pw_rho,
Expand Down
4 changes: 4 additions & 0 deletions source/source_esolver/esolver_ks_lcao.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "source_lcao/setup_deepks.h" // for deepks, mohan add 20251008
#include "source_lcao/setup_exx.h" // for exx, mohan add 20251008
#include "source_lcao/module_rdmft/rdmft.h" // rdmft
#include "source_lcao/setup_dm.h" // mohan add 2025-10-30

#include <memory>

Expand Down Expand Up @@ -71,6 +72,9 @@ class ESolver_KS_LCAO : public ESolver_KS<TK>
//! 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 RDMFT calculations, added by jghan, 2024-03-16
rdmft::RDMFT<TK, TR> rdmft_solver;

Expand Down
Loading
Loading