From accd6daa862fe69ac029b719dd541d3930904fcf Mon Sep 17 00:00:00 2001 From: mohanchen Date: Mon, 10 Nov 2025 22:07:35 +0800 Subject: [PATCH 01/36] remove some codes in esolver_ks_lcao and add LCAO_set.cpp --- source/source_esolver/esolver_ks_lcao.cpp | 58 ++----------------- source/source_lcao/LCAO_set.cpp | 69 +++++++++++++++++++++++ 2 files changed, 73 insertions(+), 54 deletions(-) create mode 100644 source/source_lcao/LCAO_set.cpp diff --git a/source/source_esolver/esolver_ks_lcao.cpp b/source/source_esolver/esolver_ks_lcao.cpp index d92bf2ab3b..0490a2e415 100644 --- a/source/source_esolver/esolver_ks_lcao.cpp +++ b/source/source_esolver/esolver_ks_lcao.cpp @@ -74,62 +74,14 @@ void ESolver_KS_LCAO::before_all_runners(UnitCell& ucell, const Input_pa return; } - // 5) init electronic wave function psi - Setup_Psi::allocate_psi(this->psi, this->kv, this->pv, inp); + LCAO_domain::set_psi_occ_dm_chg(); - //! read psi from file - if (inp.init_wfc == "file" && inp.esolver_type != "tddft") - { - if (!ModuleIO::read_wfc_nao(PARAM.globalv.global_readin_dir, - this->pv, *this->psi, this->pelec->ekb, this->pelec->wg, this->kv.ik2iktot, - this->kv.get_nkstot(), inp.nspin)) - { - ModuleBase::WARNING_QUIT("ESolver_KS_LCAO", "read electronic wave functions failed"); - } - } - - - // 7) init DMK, but DMR is constructed in before_scf() - 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); - - // 9) initialize DFT+U - if (inp.dft_plus_u) - { - this->dftu.init(ucell, &this->pv, this->kv.get_nks(), &orb_); - } + LCAO_domain::set_pot(); - // 10) init local pseudopotentials - this->locpp.init_vloc(ucell, this->pw_rho); - ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "LOCAL POTENTIAL"); - - // 11) init charge density - this->chr.allocate(inp.nspin); - - // 12) init potentials - if (this->pelec->pot == nullptr) - { - this->pelec->pot = new elecstate::Potential(this->pw_rhod, this->pw_rho, - &ucell, &(this->locpp.vloc), &(this->sf), &(this->solvent), - &(this->pelec->f_en.etxc), &(this->pelec->f_en.vtxc)); - } - - // 13) init deepks - this->deepks.before_runner(ucell, this->kv.get_nks(), this->orb_, this->pv, inp); - - // 14) set occupations, tddft does not need to set occupations in the first scf - if (inp.ocp && inp.esolver_type != "tddft") - { - elecstate::fixed_weights(inp.ocp_kb, inp.nbands, inp.nelec, - this->pelec->klist, this->pelec->wg, this->pelec->skip_weights); - } - - // 15) if kpar is not divisible by nks, print a warning + //! if kpar is not divisible by nks, print a warning ModuleIO::print_kpar(this->kv.get_nks(), PARAM.globalv.kpar_lcao); - // 16) init rdmft, added by jghan + //! init rdmft, added by jghan if (inp.rdmft == true) { rdmft_solver.init(this->pv, ucell, @@ -310,8 +262,6 @@ void ESolver_KS_LCAO::after_all_runners(UnitCell& ucell) ESolver_KS::after_all_runners(ucell); - const int nspin0 = (PARAM.inp.nspin == 2) ? 2 : 1; - auto* hamilt_lcao = dynamic_cast*>(this->p_hamilt); if(!hamilt_lcao) { diff --git a/source/source_lcao/LCAO_set.cpp b/source/source_lcao/LCAO_set.cpp new file mode 100644 index 0000000000..aabd399c46 --- /dev/null +++ b/source/source_lcao/LCAO_set.cpp @@ -0,0 +1,69 @@ +#include "source_lcao/LCAO_set_pot.h" +#include "source_io/module_parameter/parameter.h" + +namespace LCAO_domain +{ + +void set_psi_occ_dm_chg(psi, kv, pv, inp, pelec, dmat, chr) +{ + //! 1) init electronic wave function psi + Setup_Psi::allocate_psi(psi, kv, pv, inp); + + //! 2) read psi from file + if (inp.init_wfc == "file" && inp.esolver_type != "tddft") + { + if (!ModuleIO::read_wfc_nao(PARAM.globalv.global_readin_dir, + pv, *psi, pelec->ekb, pelec->wg, kv.ik2iktot, + kv.get_nkstot(), inp.nspin)) + { + ModuleBase::WARNING_QUIT("ESolver_KS_LCAO", "read electronic wave functions failed"); + } + } + + // 3) set occupations, tddft does not need to set occupations in the first scf + if (inp.ocp && inp.esolver_type != "tddft") + { + elecstate::fixed_weights(inp.ocp_kb, inp.nbands, inp.nelec, + pelec->klist, pelec->wg, pelec->skip_weights); + } + + // 4) init DMK, but DMR is constructed in before_scf() + dmat.allocate_dm(&kv, &pv, inp.nspin); + + // 5) init charge density + chr.allocate(inp.nspin); +} + + +void set_pot(pelec, locpp, pw_rho, pw_rhod, sf, solvent, dftu, pv, kv, orb_, exx_nao, deepks) +{ + // 1) init local pseudopotentials + locpp.init_vloc(ucell, pw_rho); + ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "LOCAL POTENTIAL"); + + // 2) init potentials + if (pelec->pot == nullptr) + { + // where is the pot deleted? + pelec->pot = new elecstate::Potential(pw_rhod, pw_rho, + &ucell, &(locpp.vloc), &(sf), &(solvent), + &(pelec->f_en.etxc), &(pelec->f_en.vtxc)); + } + + // 3) initialize DFT+U + if (inp.dft_plus_u) + { + dftu.init(ucell, &pv, kv.get_nks(), &orb_); + } + + // 4) init exact exchange calculations + exx_nao.before_runner(ucell, kv, orb_, pv, inp); + + // 5) init deepks + deepks.before_runner(ucell, kv.get_nks(), orb_, pv, inp); + + return; +} + + +} From 98240e6773ddeac230c7eedcfc0d70638e1e8f8e Mon Sep 17 00:00:00 2001 From: mohanchen Date: Tue, 11 Nov 2025 08:32:33 +0800 Subject: [PATCH 02/36] add LCAO_set.h and LCAO_set.cpp --- source/Makefile.Objects | 1 + source/source_lcao/CMakeLists.txt | 1 + source/source_lcao/LCAO_set.cpp | 60 ++++++++++++++++++++----------- source/source_lcao/LCAO_set.h | 52 +++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 20 deletions(-) create mode 100644 source/source_lcao/LCAO_set.h diff --git a/source/Makefile.Objects b/source/Makefile.Objects index 1aea12100a..91e4f34bea 100644 --- a/source/Makefile.Objects +++ b/source/Makefile.Objects @@ -634,6 +634,7 @@ OBJS_LCAO=evolve_elec.o\ spar_hsr.o\ spar_st.o\ spar_u.o\ + LCAO_set.o\ LCAO_set_fs.o\ LCAO_set_st.o\ LCAO_nl_mu.o\ diff --git a/source/source_lcao/CMakeLists.txt b/source/source_lcao/CMakeLists.txt index 5199625c41..7b090ab275 100644 --- a/source/source_lcao/CMakeLists.txt +++ b/source/source_lcao/CMakeLists.txt @@ -33,6 +33,7 @@ if(ENABLE_LCAO) spar_hsr.cpp spar_st.cpp spar_u.cpp + LCAO_set.cpp LCAO_set_fs.cpp LCAO_set_st.cpp LCAO_nl_mu.cpp diff --git a/source/source_lcao/LCAO_set.cpp b/source/source_lcao/LCAO_set.cpp index aabd399c46..c1390e5c8e 100644 --- a/source/source_lcao/LCAO_set.cpp +++ b/source/source_lcao/LCAO_set.cpp @@ -1,10 +1,15 @@ #include "source_lcao/LCAO_set_pot.h" #include "source_io/module_parameter/parameter.h" -namespace LCAO_domain -{ - -void set_psi_occ_dm_chg(psi, kv, pv, inp, pelec, dmat, chr) +template +void LCAO_domain::set_psi_occ_dm_chg( + const K_Vectors &kv, // k-points + psi::Psi* psi, // coefficients of NAO basis + const Parallel_Orbitals &pv, // parallel scheme of NAO basis + elecstate::ElecState* pelec, // eigen values and weights + LCAO_domain::Setup_DM &dmat, // density matrix + Charge &chr, // charge density + const Input_para &inp) // input parameters { //! 1) init electronic wave function psi Setup_Psi::allocate_psi(psi, kv, pv, inp); @@ -16,54 +21,69 @@ void set_psi_occ_dm_chg(psi, kv, pv, inp, pelec, dmat, chr) pv, *psi, pelec->ekb, pelec->wg, kv.ik2iktot, kv.get_nkstot(), inp.nspin)) { - ModuleBase::WARNING_QUIT("ESolver_KS_LCAO", "read electronic wave functions failed"); + ModuleBase::WARNING_QUIT("set_psi_occ_dm_chg", "read electronic wave functions failed"); } } - // 3) set occupations, tddft does not need to set occupations in the first scf + //! 3) set occupations, tddft does not need to set occupations in the first scf if (inp.ocp && inp.esolver_type != "tddft") { elecstate::fixed_weights(inp.ocp_kb, inp.nbands, inp.nelec, - pelec->klist, pelec->wg, pelec->skip_weights); + kv, pelec->wg, pelec->skip_weights); } - // 4) init DMK, but DMR is constructed in before_scf() + //! 4) init DMK, but DMR is constructed in before_scf() dmat.allocate_dm(&kv, &pv, inp.nspin); - // 5) init charge density + //! 5) init charge density chr.allocate(inp.nspin); + + return; } -void set_pot(pelec, locpp, pw_rho, pw_rhod, sf, solvent, dftu, pv, kv, orb_, exx_nao, deepks) + +void LCAO_domain::set_pot( + const K_Vectors &kv, + const Structure_Factor& sf, + const ModulePW::PW_Basis &pw_rho, + const ModulePW::PW_Basis &pw_rhod, + elecstate::ElecState* pelec, + const LCAO_Orbitals& orb, + const Parallel_Orbitals &pv, + pseudopot_cell_vl &locpp, + Plus_U &dftu, + surchem& solvent, + Exx_NAO &exx_nao, + Setup_DeePKS &deepks, + const Input_para &inp) { - // 1) init local pseudopotentials + //! 1) init local pseudopotentials locpp.init_vloc(ucell, pw_rho); ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "LOCAL POTENTIAL"); - // 2) init potentials + //! 2) init potentials if (pelec->pot == nullptr) { // where is the pot deleted? - pelec->pot = new elecstate::Potential(pw_rhod, pw_rho, + pelec->pot = new elecstate::Potential(&pw_rhod, &pw_rho, &ucell, &(locpp.vloc), &(sf), &(solvent), &(pelec->f_en.etxc), &(pelec->f_en.vtxc)); } - // 3) initialize DFT+U + //! 3) initialize DFT+U if (inp.dft_plus_u) { - dftu.init(ucell, &pv, kv.get_nks(), &orb_); + dftu.init(ucell, &pv, kv.get_nks(), &orb); } - // 4) init exact exchange calculations - exx_nao.before_runner(ucell, kv, orb_, pv, inp); + //! 4) init exact exchange calculations + exx_nao.before_runner(ucell, kv, orb, pv, inp); - // 5) init deepks - deepks.before_runner(ucell, kv.get_nks(), orb_, pv, inp); + //! 5) init deepks + deepks.before_runner(ucell, kv.get_nks(), orb, pv, inp); return; } -} diff --git a/source/source_lcao/LCAO_set.h b/source/source_lcao/LCAO_set.h new file mode 100644 index 0000000000..1b5efa52ba --- /dev/null +++ b/source/source_lcao/LCAO_set.h @@ -0,0 +1,52 @@ +#ifndef LCAO_SET_H +#define LCAO_SET_H + +#include "source_cell/klist.h" +#include "source_psi/psi.h" +#include "source_estate/elecstate.h" +#include "source_lcao/setup_dm.h" +#include "source_pw/module_pwdft/structure_factor.h" +#include "source_basis/module_pw/pw_basis.h" +#include "source_hamilt/module_surchem/surchem.h" +#include "source_pw/module_pwdft/VL_in_pw.h" +#include "source_lcao/module_deepks/LCAO_deepks.h" +#include "source_lcao/module_dftu/dftu.h" +#include "source_lcao/setup_exx.h" +#include "source_lcao/setup_deepks.h" + +/** + * @brief set up wave functions, occupation numbers, + * density matrix and charge density + */ +template +void LCAO_domain::set_psi_occ_dm_chg( + const K_Vectors &kv, // k-points + psi::Psi* psi, // coefficients of NAO basis + const Parallel_Orbitals &pv, // parallel scheme of NAO basis + elecstate::ElecState* pelec, // eigen values and weights + LCAO_domain::Setup_DM &dmat, // density matrix + Charge &chr, // charge density + const Input_para& inp) // input parameters + +/** + * @brief set up potentials, including local pseudopotentials, + * +U potential, solvent potential, exx potential and deepks potential + */ +template +void LCAO_domain::set_pot( + const K_Vectors &kv, + const Structure_Factor& sf, + const ModulePW::PW_Basis &pw_rho, + const ModulePW::PW_Basis &pw_rhod, + elecstate::ElecState* pelec, + const LCAO_Orbitals& orb, + const Parallel_Orbitals &pv, + pseudopot_cell_vl &locpp, + Plus_U &dftu, + surchem& solvent, + Exx_NAO &exx_nao, + Setup_DeePKS &deepks, + const Input_para &inp); + + +#endif From f438e2e6c4f9efcf5cfad220ae3e90fe09a01a36 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Tue, 11 Nov 2025 10:27:44 +0800 Subject: [PATCH 03/36] finish updating esolver --- source/source_esolver/esolver_ks_lcao.cpp | 10 +-- source/source_lcao/LCAO_set.cpp | 75 ++++++++++++++++++++--- source/source_lcao/LCAO_set.h | 22 ++++--- 3 files changed, 85 insertions(+), 22 deletions(-) diff --git a/source/source_esolver/esolver_ks_lcao.cpp b/source/source_esolver/esolver_ks_lcao.cpp index 0490a2e415..0d2ef6cb11 100644 --- a/source/source_esolver/esolver_ks_lcao.cpp +++ b/source/source_esolver/esolver_ks_lcao.cpp @@ -17,10 +17,9 @@ #include "source_io/ctrl_runner_lcao.h" // use ctrl_runner_lcao() #include "source_io/ctrl_iter_lcao.h" // use ctrl_iter_lcao() #include "source_io/ctrl_scf_lcao.h" // use ctrl_scf_lcao() -#include "source_psi/setup_psi.h" // mohan add 20251019 -#include "source_io/read_wfc_nao.h" #include "source_io/print_info.h" #include "source_lcao/rho_tau_lcao.h" // mohan add 20251024 +#include "source_lcao/LCAO_set.h" // mohan add 20251111 namespace ModuleESolver { @@ -74,9 +73,12 @@ void ESolver_KS_LCAO::before_all_runners(UnitCell& ucell, const Input_pa return; } - LCAO_domain::set_psi_occ_dm_chg(); + LCAO_domain::set_psi_occ_dm_chg(this->kv, this->psi, this->pv, this->pelec, + this->dmat, this->chr, inp); - LCAO_domain::set_pot(); + LCAO_domain::set_pot(ucell, this->kv, this->sf, *this->pw_rho, *this->pw_rhod, + this->pelec, this->orb_, this->pv, this->locpp, this->dftu, + this->solvent, this->exx_nao, this->deepks, inp); //! if kpar is not divisible by nks, print a warning ModuleIO::print_kpar(this->kv.get_nks(), PARAM.globalv.kpar_lcao); diff --git a/source/source_lcao/LCAO_set.cpp b/source/source_lcao/LCAO_set.cpp index c1390e5c8e..2b4a42fcc3 100644 --- a/source/source_lcao/LCAO_set.cpp +++ b/source/source_lcao/LCAO_set.cpp @@ -1,5 +1,8 @@ -#include "source_lcao/LCAO_set_pot.h" +#include "source_lcao/LCAO_set.h" #include "source_io/module_parameter/parameter.h" +#include "source_psi/setup_psi.h" // use Setup_Psi +#include "source_io/read_wfc_nao.h" // use read_wfc_nao +#include "source_estate/elecstate_tools.h" // use fixed_weights template void LCAO_domain::set_psi_occ_dm_chg( @@ -11,6 +14,7 @@ void LCAO_domain::set_psi_occ_dm_chg( Charge &chr, // charge density const Input_para &inp) // input parameters { + //! 1) init electronic wave function psi Setup_Psi::allocate_psi(psi, kv, pv, inp); @@ -29,7 +33,7 @@ void LCAO_domain::set_psi_occ_dm_chg( if (inp.ocp && inp.esolver_type != "tddft") { elecstate::fixed_weights(inp.ocp_kb, inp.nbands, inp.nelec, - kv, pelec->wg, pelec->skip_weights); + &kv, pelec->wg, pelec->skip_weights); } //! 4) init DMK, but DMR is constructed in before_scf() @@ -42,24 +46,25 @@ void LCAO_domain::set_psi_occ_dm_chg( } - +template void LCAO_domain::set_pot( - const K_Vectors &kv, - const Structure_Factor& sf, + UnitCell &ucell, // not const because of dftu + K_Vectors &kv, // not const due to exx + Structure_Factor& sf, // will be modified in potential const ModulePW::PW_Basis &pw_rho, const ModulePW::PW_Basis &pw_rhod, elecstate::ElecState* pelec, const LCAO_Orbitals& orb, - const Parallel_Orbitals &pv, + Parallel_Orbitals &pv, // not const due to deepks pseudopot_cell_vl &locpp, Plus_U &dftu, surchem& solvent, - Exx_NAO &exx_nao, - Setup_DeePKS &deepks, + Exx_NAO &exx_nao, + Setup_DeePKS &deepks, const Input_para &inp) { //! 1) init local pseudopotentials - locpp.init_vloc(ucell, pw_rho); + locpp.init_vloc(ucell, &pw_rho); ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "LOCAL POTENTIAL"); //! 2) init potentials @@ -67,7 +72,7 @@ void LCAO_domain::set_pot( { // where is the pot deleted? pelec->pot = new elecstate::Potential(&pw_rhod, &pw_rho, - &ucell, &(locpp.vloc), &(sf), &(solvent), + &ucell, &locpp.vloc, &sf, &solvent, &(pelec->f_en.etxc), &(pelec->f_en.vtxc)); } @@ -87,3 +92,53 @@ void LCAO_domain::set_pot( } + +template void LCAO_domain::set_psi_occ_dm_chg( + const K_Vectors &kv, // k-points + psi::Psi* psi, // coefficients of NAO basis + const Parallel_Orbitals &pv, // parallel scheme of NAO basis + elecstate::ElecState* pelec, // eigen values and weights + LCAO_domain::Setup_DM &dmat, // density matrix + Charge &chr, // charge density + const Input_para &inp); + +template void LCAO_domain::set_psi_occ_dm_chg>( + const K_Vectors &kv, // k-points + psi::Psi>* psi, // coefficients of NAO basis + const Parallel_Orbitals &pv, // parallel scheme of NAO basis + elecstate::ElecState* pelec, // eigen values and weights + LCAO_domain::Setup_DM> &dmat, // density matrix + Charge &chr, // charge density + const Input_para &inp); + +template void LCAO_domain::set_pot( + UnitCell &ucell, + K_Vectors &kv, + Structure_Factor& sf, + const ModulePW::PW_Basis &pw_rho, + const ModulePW::PW_Basis &pw_rhod, + elecstate::ElecState* pelec, + const LCAO_Orbitals& orb, + Parallel_Orbitals &pv, + pseudopot_cell_vl &locpp, + Plus_U &dftu, + surchem& solvent, + Exx_NAO &exx_nao, + Setup_DeePKS &deepks, + const Input_para &inp); + +template void LCAO_domain::set_pot>( + UnitCell &ucell, + K_Vectors &kv, + Structure_Factor& sf, + const ModulePW::PW_Basis &pw_rho, + const ModulePW::PW_Basis &pw_rhod, + elecstate::ElecState* pelec, + const LCAO_Orbitals& orb, + Parallel_Orbitals &pv, + pseudopot_cell_vl &locpp, + Plus_U &dftu, + surchem& solvent, + Exx_NAO> &exx_nao, + Setup_DeePKS> &deepks, + const Input_para &inp); diff --git a/source/source_lcao/LCAO_set.h b/source/source_lcao/LCAO_set.h index 1b5efa52ba..cede266522 100644 --- a/source/source_lcao/LCAO_set.h +++ b/source/source_lcao/LCAO_set.h @@ -1,6 +1,7 @@ #ifndef LCAO_SET_H #define LCAO_SET_H +#include "source_cell/unitcell.h" #include "source_cell/klist.h" #include "source_psi/psi.h" #include "source_estate/elecstate.h" @@ -14,39 +15,44 @@ #include "source_lcao/setup_exx.h" #include "source_lcao/setup_deepks.h" +namespace LCAO_domain +{ + /** * @brief set up wave functions, occupation numbers, * density matrix and charge density */ template -void LCAO_domain::set_psi_occ_dm_chg( +void set_psi_occ_dm_chg( const K_Vectors &kv, // k-points psi::Psi* psi, // coefficients of NAO basis const Parallel_Orbitals &pv, // parallel scheme of NAO basis elecstate::ElecState* pelec, // eigen values and weights LCAO_domain::Setup_DM &dmat, // density matrix Charge &chr, // charge density - const Input_para& inp) // input parameters + const Input_para& inp); // input parameters /** * @brief set up potentials, including local pseudopotentials, * +U potential, solvent potential, exx potential and deepks potential */ template -void LCAO_domain::set_pot( - const K_Vectors &kv, - const Structure_Factor& sf, +void set_pot( + UnitCell &ucell, + K_Vectors &kv, + Structure_Factor& sf, const ModulePW::PW_Basis &pw_rho, const ModulePW::PW_Basis &pw_rhod, elecstate::ElecState* pelec, const LCAO_Orbitals& orb, - const Parallel_Orbitals &pv, + Parallel_Orbitals &pv, pseudopot_cell_vl &locpp, Plus_U &dftu, surchem& solvent, - Exx_NAO &exx_nao, - Setup_DeePKS &deepks, + Exx_NAO &exx_nao, + Setup_DeePKS &deepks, const Input_para &inp); +} // end namespace #endif From 0eb5a8b8f59a68f9a3bfc21ae02e6d9ac9a4007c Mon Sep 17 00:00:00 2001 From: mohanchen Date: Tue, 11 Nov 2025 12:25:50 +0800 Subject: [PATCH 04/36] update LCAO_set, fix ref of pointer of psi --- source/source_esolver/esolver_ks_lcao.cpp | 64 ++++++++++++++++++++++- source/source_lcao/LCAO_set.cpp | 11 ++-- source/source_lcao/LCAO_set.h | 2 +- 3 files changed, 70 insertions(+), 7 deletions(-) diff --git a/source/source_esolver/esolver_ks_lcao.cpp b/source/source_esolver/esolver_ks_lcao.cpp index 0d2ef6cb11..032cde56af 100644 --- a/source/source_esolver/esolver_ks_lcao.cpp +++ b/source/source_esolver/esolver_ks_lcao.cpp @@ -21,6 +21,13 @@ #include "source_lcao/rho_tau_lcao.h" // mohan add 20251024 #include "source_lcao/LCAO_set.h" // mohan add 20251111 + +// tmp +#include "source_psi/setup_psi.h" // use Setup_Psi +#include "source_io/read_wfc_nao.h" // use read_wfc_nao +#include "source_estate/elecstate_tools.h" // use fixed_weights + + namespace ModuleESolver { @@ -73,13 +80,66 @@ void ESolver_KS_LCAO::before_all_runners(UnitCell& ucell, const Input_pa return; } - LCAO_domain::set_psi_occ_dm_chg(this->kv, this->psi, this->pv, this->pelec, + LCAO_domain::set_psi_occ_dm_chg(this->kv, this->psi, this->pv, this->pelec, this->dmat, this->chr, inp); - LCAO_domain::set_pot(ucell, this->kv, this->sf, *this->pw_rho, *this->pw_rhod, + LCAO_domain::set_pot(ucell, this->kv, this->sf, *this->pw_rho, *this->pw_rhod, this->pelec, this->orb_, this->pv, this->locpp, this->dftu, this->solvent, this->exx_nao, this->deepks, inp); +/* + // 5) init electronic wave function psi + Setup_Psi::allocate_psi(this->psi, this->kv, this->pv, inp); + + //! read psi from file + if (inp.init_wfc == "file" && inp.esolver_type != "tddft") + { + if (!ModuleIO::read_wfc_nao(PARAM.globalv.global_readin_dir, + this->pv, *this->psi, this->pelec->ekb, this->pelec->wg, this->kv.ik2iktot, + this->kv.get_nkstot(), inp.nspin)) + { + ModuleBase::WARNING_QUIT("ESolver_KS_LCAO", "read electronic wave functions failed"); + } + } + + // 7) init DMK, but DMR is constructed in before_scf() + 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); + + // 9) initialize DFT+U + if (inp.dft_plus_u) + { + this->dftu.init(ucell, &this->pv, this->kv.get_nks(), &orb_); + } + + // 10) init local pseudopotentials + this->locpp.init_vloc(ucell, this->pw_rho); + ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "LOCAL POTENTIAL"); + + // 11) init charge density + this->chr.allocate(inp.nspin); + + // 12) init potentials + if (this->pelec->pot == nullptr) + { + this->pelec->pot = new elecstate::Potential(this->pw_rhod, this->pw_rho, + &ucell, &(this->locpp.vloc), &(this->sf), &(this->solvent), + &(this->pelec->f_en.etxc), &(this->pelec->f_en.vtxc)); + } + + // 13) init deepks + this->deepks.before_runner(ucell, this->kv.get_nks(), this->orb_, this->pv, inp); + + // 14) set occupations, tddft does not need to set occupations in the first scf + if (inp.ocp && inp.esolver_type != "tddft") + { + elecstate::fixed_weights(inp.ocp_kb, inp.nbands, inp.nelec, + this->pelec->klist, this->pelec->wg, this->pelec->skip_weights); + } +*/ + //! if kpar is not divisible by nks, print a warning ModuleIO::print_kpar(this->kv.get_nks(), PARAM.globalv.kpar_lcao); diff --git a/source/source_lcao/LCAO_set.cpp b/source/source_lcao/LCAO_set.cpp index 2b4a42fcc3..2c87852fde 100644 --- a/source/source_lcao/LCAO_set.cpp +++ b/source/source_lcao/LCAO_set.cpp @@ -7,7 +7,7 @@ template void LCAO_domain::set_psi_occ_dm_chg( const K_Vectors &kv, // k-points - psi::Psi* psi, // coefficients of NAO basis + psi::Psi* &psi, // coefficients of NAO basis const Parallel_Orbitals &pv, // parallel scheme of NAO basis elecstate::ElecState* pelec, // eigen values and weights LCAO_domain::Setup_DM &dmat, // density matrix @@ -42,6 +42,8 @@ void LCAO_domain::set_psi_occ_dm_chg( //! 5) init charge density chr.allocate(inp.nspin); + ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "CHARGE"); + return; } @@ -65,7 +67,6 @@ void LCAO_domain::set_pot( { //! 1) init local pseudopotentials locpp.init_vloc(ucell, &pw_rho); - ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "LOCAL POTENTIAL"); //! 2) init potentials if (pelec->pot == nullptr) @@ -88,6 +89,8 @@ void LCAO_domain::set_pot( //! 5) init deepks deepks.before_runner(ucell, kv.get_nks(), orb, pv, inp); + ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "POTENTIALS"); + return; } @@ -95,7 +98,7 @@ void LCAO_domain::set_pot( template void LCAO_domain::set_psi_occ_dm_chg( const K_Vectors &kv, // k-points - psi::Psi* psi, // coefficients of NAO basis + psi::Psi* &psi, // coefficients of NAO basis const Parallel_Orbitals &pv, // parallel scheme of NAO basis elecstate::ElecState* pelec, // eigen values and weights LCAO_domain::Setup_DM &dmat, // density matrix @@ -104,7 +107,7 @@ template void LCAO_domain::set_psi_occ_dm_chg( template void LCAO_domain::set_psi_occ_dm_chg>( const K_Vectors &kv, // k-points - psi::Psi>* psi, // coefficients of NAO basis + psi::Psi>* &psi, // coefficients of NAO basis const Parallel_Orbitals &pv, // parallel scheme of NAO basis elecstate::ElecState* pelec, // eigen values and weights LCAO_domain::Setup_DM> &dmat, // density matrix diff --git a/source/source_lcao/LCAO_set.h b/source/source_lcao/LCAO_set.h index cede266522..f5df2df054 100644 --- a/source/source_lcao/LCAO_set.h +++ b/source/source_lcao/LCAO_set.h @@ -25,7 +25,7 @@ namespace LCAO_domain template void set_psi_occ_dm_chg( const K_Vectors &kv, // k-points - psi::Psi* psi, // coefficients of NAO basis + psi::Psi* &psi, // coefficients of NAO basis const Parallel_Orbitals &pv, // parallel scheme of NAO basis elecstate::ElecState* pelec, // eigen values and weights LCAO_domain::Setup_DM &dmat, // density matrix From 653089adff24fc7e75b2ab88c9478af2ad9cca29 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Tue, 11 Nov 2025 16:33:18 +0800 Subject: [PATCH 05/36] update esolver --- source/source_esolver/esolver_ks_lcao.cpp | 53 ----------------------- 1 file changed, 53 deletions(-) diff --git a/source/source_esolver/esolver_ks_lcao.cpp b/source/source_esolver/esolver_ks_lcao.cpp index 032cde56af..62f00adcb6 100644 --- a/source/source_esolver/esolver_ks_lcao.cpp +++ b/source/source_esolver/esolver_ks_lcao.cpp @@ -87,59 +87,6 @@ void ESolver_KS_LCAO::before_all_runners(UnitCell& ucell, const Input_pa this->pelec, this->orb_, this->pv, this->locpp, this->dftu, this->solvent, this->exx_nao, this->deepks, inp); -/* - // 5) init electronic wave function psi - Setup_Psi::allocate_psi(this->psi, this->kv, this->pv, inp); - - //! read psi from file - if (inp.init_wfc == "file" && inp.esolver_type != "tddft") - { - if (!ModuleIO::read_wfc_nao(PARAM.globalv.global_readin_dir, - this->pv, *this->psi, this->pelec->ekb, this->pelec->wg, this->kv.ik2iktot, - this->kv.get_nkstot(), inp.nspin)) - { - ModuleBase::WARNING_QUIT("ESolver_KS_LCAO", "read electronic wave functions failed"); - } - } - - // 7) init DMK, but DMR is constructed in before_scf() - 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); - - // 9) initialize DFT+U - if (inp.dft_plus_u) - { - this->dftu.init(ucell, &this->pv, this->kv.get_nks(), &orb_); - } - - // 10) init local pseudopotentials - this->locpp.init_vloc(ucell, this->pw_rho); - ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "LOCAL POTENTIAL"); - - // 11) init charge density - this->chr.allocate(inp.nspin); - - // 12) init potentials - if (this->pelec->pot == nullptr) - { - this->pelec->pot = new elecstate::Potential(this->pw_rhod, this->pw_rho, - &ucell, &(this->locpp.vloc), &(this->sf), &(this->solvent), - &(this->pelec->f_en.etxc), &(this->pelec->f_en.vtxc)); - } - - // 13) init deepks - this->deepks.before_runner(ucell, this->kv.get_nks(), this->orb_, this->pv, inp); - - // 14) set occupations, tddft does not need to set occupations in the first scf - if (inp.ocp && inp.esolver_type != "tddft") - { - elecstate::fixed_weights(inp.ocp_kb, inp.nbands, inp.nelec, - this->pelec->klist, this->pelec->wg, this->pelec->skip_weights); - } -*/ - //! if kpar is not divisible by nks, print a warning ModuleIO::print_kpar(this->kv.get_nks(), PARAM.globalv.kpar_lcao); From d642fd478c5a82aec98ad60a778a1aee820c2728 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Tue, 11 Nov 2025 16:49:19 +0800 Subject: [PATCH 06/36] delete useless head files --- source/source_esolver/esolver_ks_lcao.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/source/source_esolver/esolver_ks_lcao.cpp b/source/source_esolver/esolver_ks_lcao.cpp index 62f00adcb6..0e1fab3e7e 100644 --- a/source/source_esolver/esolver_ks_lcao.cpp +++ b/source/source_esolver/esolver_ks_lcao.cpp @@ -21,13 +21,6 @@ #include "source_lcao/rho_tau_lcao.h" // mohan add 20251024 #include "source_lcao/LCAO_set.h" // mohan add 20251111 - -// tmp -#include "source_psi/setup_psi.h" // use Setup_Psi -#include "source_io/read_wfc_nao.h" // use read_wfc_nao -#include "source_estate/elecstate_tools.h" // use fixed_weights - - namespace ModuleESolver { From a4cc36515b4e13a52cb42d4fb64f556a6940420a Mon Sep 17 00:00:00 2001 From: mohanchen Date: Tue, 11 Nov 2025 16:56:05 +0800 Subject: [PATCH 07/36] update esolver --- source/source_esolver/esolver_ks_lcao.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/source/source_esolver/esolver_ks_lcao.cpp b/source/source_esolver/esolver_ks_lcao.cpp index 0e1fab3e7e..d15664dd6e 100644 --- a/source/source_esolver/esolver_ks_lcao.cpp +++ b/source/source_esolver/esolver_ks_lcao.cpp @@ -451,8 +451,13 @@ void ESolver_KS_LCAO::iter_finish(UnitCell& ucell, const int istep, int& } this->dftu.cal_energy_correction(ucell, istep); } - this->dftu.output(ucell); - } + this->dftu.output(ucell); + // use the converged occupation matrix for next MD/Relax SCF calculation + if (conv_esolver) + { + this->dftu.initialed_locale = true; + } + } // 2) for deepks, calculate delta_e, output labels during electronic steps this->deepks.delta_e(ucell, this->kv, this->orb_, this->pv, this->gd, dm_vec, this->pelec->f_en, PARAM.inp); @@ -480,12 +485,6 @@ void ESolver_KS_LCAO::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) - { - this->dftu.initialed_locale = true; - } - // control the output related to the finished iteration ModuleIO::ctrl_iter_lcao(ucell, PARAM.inp, this->kv, this->pelec, *this->dmat.dm, this->pv, this->gd, this->psi, this->chr, this->p_chgmix, From 0472d9f374500b6f3d776d5797b54730e92f8952 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Wed, 12 Nov 2025 09:18:25 +0800 Subject: [PATCH 08/36] change effective to eff for short --- source/Makefile.Objects | 1 - source/source_esolver/esolver_ks_pw.cpp | 2 +- source/source_esolver/esolver_of.cpp | 10 +-- source/source_esolver/esolver_of_tool.cpp | 4 +- source/source_estate/CMakeLists.txt | 1 - source/source_estate/elecstate_energy.cpp | 44 ++++++------ .../module_pot/pot_local_paw.cpp | 25 ------- .../source_estate/module_pot/pot_local_paw.h | 24 ------- .../module_pot/potential_new.cpp | 38 +++++------ .../source_estate/module_pot/potential_new.h | 68 ++++++++++--------- .../module_pot/potential_types.cpp | 5 +- source/source_io/ctrl_output_fp.cpp | 2 +- source/source_io/ctrl_scf_lcao.cpp | 2 +- source/source_io/write_init.cpp | 2 +- .../module_operator_lcao/veff_lcao.cpp | 17 ++--- source/source_lcao/pulay_fs_gint.hpp | 6 +- .../source_pw/module_ofdft/evolve_ofdft.cpp | 19 ++++-- source/source_pw/module_pwdft/forces_us.cpp | 4 +- source/source_pw/module_pwdft/setup_pot.cpp | 2 +- .../source_pw/module_pwdft/stress_func_us.cpp | 2 +- source/source_pw/module_pwdft/stress_pw.cpp | 2 +- 21 files changed, 121 insertions(+), 159 deletions(-) delete mode 100644 source/source_estate/module_pot/pot_local_paw.cpp delete mode 100644 source/source_estate/module_pot/pot_local_paw.h diff --git a/source/Makefile.Objects b/source/Makefile.Objects index 91e4f34bea..75ea579cdd 100644 --- a/source/Makefile.Objects +++ b/source/Makefile.Objects @@ -239,7 +239,6 @@ OBJS_ELECSTAT=elecstate.o\ potential_types.o\ pot_sep.o\ pot_local.o\ - pot_local_paw.o\ H_Hartree_pw.o\ H_TDDFT_pw.o\ pot_xc.o\ diff --git a/source/source_esolver/esolver_ks_pw.cpp b/source/source_esolver/esolver_ks_pw.cpp index 6c19a6c5a1..9d03059b41 100644 --- a/source/source_esolver/esolver_ks_pw.cpp +++ b/source/source_esolver/esolver_ks_pw.cpp @@ -286,7 +286,7 @@ void ESolver_KS_PW::iter_finish(UnitCell& ucell, const int istep, int // pp projectors, liuyu 2023-10-24 if (PARAM.globalv.use_uspp) { - ModuleBase::matrix veff = this->pelec->pot->get_effective_v(); + ModuleBase::matrix veff = this->pelec->pot->get_eff_v(); this->ppcell.cal_effective_D(veff, this->pw_rhod, ucell); } diff --git a/source/source_esolver/esolver_of.cpp b/source/source_esolver/esolver_of.cpp index f609b3e2c1..0d31938f8c 100644 --- a/source/source_esolver/esolver_of.cpp +++ b/source/source_esolver/esolver_of.cpp @@ -122,7 +122,7 @@ void ESolver_OF::before_all_runners(UnitCell& ucell, const Input_para& inp) // liuyu move here 2023-10-09 // D in uspp need vloc, thus behind init_scf() // calculate the effective coefficient matrix for non-local pseudopotential projectors - ModuleBase::matrix veff = this->pelec->pot->get_effective_v(); + ModuleBase::matrix veff = this->pelec->pot->get_eff_v(); ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "INIT POTENTIAL"); @@ -317,10 +317,10 @@ void ESolver_OF::update_potential(UnitCell& ucell) this->kedf_manager_->get_potential(this->chr.rho, this->pphi_, this->pw_rho, - this->pelec->pot->get_effective_v()); // KEDF potential + this->pelec->pot->get_eff_v()); // KEDF potential for (int is = 0; is < PARAM.inp.nspin; ++is) { - const double* vr_eff = this->pelec->pot->get_effective_v(is); + const double* vr_eff = this->pelec->pot->get_eff_v(is); for (int ir = 0; ir < this->pw_rho->nrxx; ++ir) { this->pdEdphi_[is][ir] = vr_eff[ir]; @@ -516,9 +516,9 @@ void ESolver_OF::after_opt(const int istep, UnitCell& ucell, const bool conv_eso this->kedf_manager_->get_potential(this->chr.rho, this->pphi_, this->pw_rho, - this->pelec->pot->get_effective_v()); // KEDF potential + this->pelec->pot->get_eff_v()); // KEDF potential - const double* vr_eff = this->pelec->pot->get_effective_v(0); + const double* vr_eff = this->pelec->pot->get_eff_v(0); for (int ir = 0; ir < this->pw_rho->nrxx; ++ir) { this->pdEdphi_[0][ir] = vr_eff[ir]; diff --git a/source/source_esolver/esolver_of_tool.cpp b/source/source_esolver/esolver_of_tool.cpp index 6e7ebbd7fb..c7f8a17135 100644 --- a/source/source_esolver/esolver_of_tool.cpp +++ b/source/source_esolver/esolver_of_tool.cpp @@ -139,7 +139,7 @@ void ESolver_OF::cal_potential(double* ptemp_phi, double* rdLdphi, UnitCell& uce elecstate::cal_ux(ucell); this->pelec->pot->update_from_charge(this->ptemp_rho_, &ucell); - ModuleBase::matrix& vr_eff = this->pelec->pot->get_effective_v(); + ModuleBase::matrix& vr_eff = this->pelec->pot->get_eff_v(); this->kedf_manager_->get_potential(this->ptemp_rho_->rho, temp_phi, @@ -179,7 +179,7 @@ void ESolver_OF::cal_dEdtheta(double** ptemp_phi, Charge* temp_rho, UnitCell& uc elecstate::cal_ux(ucell); this->pelec->pot->update_from_charge(temp_rho, &ucell); - ModuleBase::matrix& vr_eff = this->pelec->pot->get_effective_v(); + ModuleBase::matrix& vr_eff = this->pelec->pot->get_eff_v(); this->kedf_manager_->get_potential(temp_rho->rho, ptemp_phi, diff --git a/source/source_estate/CMakeLists.txt b/source/source_estate/CMakeLists.txt index bd7be0e782..9789df523c 100644 --- a/source/source_estate/CMakeLists.txt +++ b/source/source_estate/CMakeLists.txt @@ -13,7 +13,6 @@ list(APPEND objects module_pot/H_Hartree_pw.cpp module_pot/pot_xc.cpp module_pot/pot_local.cpp - module_pot/pot_local_paw.cpp module_pot/potential_new.cpp module_pot/potential_types.cpp module_pot/pot_sep.cpp diff --git a/source/source_estate/elecstate_energy.cpp b/source/source_estate/elecstate_energy.cpp index b6079df0aa..d249ec9272 100644 --- a/source/source_estate/elecstate_energy.cpp +++ b/source/source_estate/elecstate_energy.cpp @@ -105,15 +105,15 @@ void ElecState::cal_bandgap_updw() /// @brief calculate deband double ElecState::cal_delta_eband(const UnitCell& ucell) const { - // out potentials from potential mixing - // total energy and band energy corrections + ModuleBase::timer::tick("ElecState", "cal_delta_eband"); + // out potentials from potential mixing + // total energy and band energy corrections double deband0 = 0.0; - double deband_aux = 0.0; // only potential related with charge is used here for energy correction - // on the fly calculate it here by v_effective - v_fixed - const double* v_eff = this->pot->get_effective_v(0); + // on the fly calculate it here by v_eff - v_fixed + const double* v_eff = this->pot->get_eff_v(0); const double* v_fixed = this->pot->get_fixed_v(); const double* v_ofk = nullptr; const bool v_ofk_flag = (XC_Functional::get_ked_flag()); @@ -122,10 +122,11 @@ double ElecState::cal_delta_eband(const UnitCell& ucell) const { deband_aux -= this->charge->rho[0][ir] * (v_eff[ir] - v_fixed[ir]); } + if (v_ofk_flag) { - v_ofk = this->pot->get_effective_vofk(0); - // cause in the get_effective_vofk, the func will return nullptr + v_ofk = this->pot->get_eff_vofk(0); + // cause in the get_eff_vofk, the func will return nullptr if (v_ofk == nullptr && this->charge->rhopw->nrxx > 0) { ModuleBase::WARNING_QUIT("ElecState::cal_delta_eband", "v_ofk is nullptr"); @@ -138,14 +139,14 @@ double ElecState::cal_delta_eband(const UnitCell& ucell) const if (PARAM.inp.nspin == 2) { - v_eff = this->pot->get_effective_v(1); + v_eff = this->pot->get_eff_v(1); for (int ir = 0; ir < this->charge->rhopw->nrxx; ir++) { deband_aux -= this->charge->rho[1][ir] * (v_eff[ir] - v_fixed[ir]); } if (v_ofk_flag) { - v_ofk = this->pot->get_effective_vofk(1); + v_ofk = this->pot->get_eff_vofk(1); if (v_ofk == nullptr && this->charge->rhopw->nrxx > 0) { ModuleBase::WARNING_QUIT("ElecState::cal_delta_eband", "v_ofk is nullptr"); @@ -160,7 +161,7 @@ double ElecState::cal_delta_eband(const UnitCell& ucell) const { for (int is = 1; is < 4; is++) { - v_eff = this->pot->get_effective_v(is); + v_eff = this->pot->get_eff_v(is); for (int ir = 0; ir < this->charge->rhopw->nrxx; ir++) { deband_aux -= this->charge->rho[is][ir] * v_eff[ir]; @@ -178,13 +179,16 @@ double ElecState::cal_delta_eband(const UnitCell& ucell) const // \int rho(r) v_{exx}(r) dr = 2 E_{exx}[rho] deband0 -= 2 * this->f_en.exx; // Peize Lin add 2017-10-16 + + ModuleBase::timer::tick("ElecState", "cal_delta_eband"); return deband0; } /// @brief calculate descf double ElecState::cal_delta_escf() const { - ModuleBase::TITLE("energy", "delta_escf"); + ModuleBase::TITLE("ElecState", "cal_delta_escf"); + ModuleBase::timer::tick("ElecState", "cal_delta_escf"); double descf = 0.0; // now rho1 is "mixed" charge density @@ -192,21 +196,21 @@ double ElecState::cal_delta_escf() const // because in "deband" the energy is calculated from "output" charge density, // so here is the correction. // only potential related with charge is used here for energy correction - // on the fly calculate it here by v_effective - v_fixed - const double* v_eff = this->pot->get_effective_v(0); + // on the fly calculate it here by v_eff - v_fixed + const double* v_eff = this->pot->get_eff_v(0); const double* v_fixed = this->pot->get_fixed_v(); const double* v_ofk = nullptr; if (XC_Functional::get_ked_flag()) { - v_ofk = this->pot->get_effective_vofk(0); + v_ofk = this->pot->get_eff_vofk(0); } for (int ir = 0; ir < this->charge->rhopw->nrxx; ir++) { descf -= (this->charge->rho[0][ir] - this->charge->rho_save[0][ir]) * (v_eff[ir] - v_fixed[ir]); if (XC_Functional::get_ked_flag()) { - // cause in the get_effective_vofk, the func will return nullptr + // cause in the get_eff_vofk, the func will return nullptr assert(v_ofk != nullptr); descf -= (this->charge->kin_r[0][ir] - this->charge->kin_r_save[0][ir]) * v_ofk[ir]; } @@ -214,10 +218,10 @@ double ElecState::cal_delta_escf() const if (PARAM.inp.nspin == 2) { - v_eff = this->pot->get_effective_v(1); + v_eff = this->pot->get_eff_v(1); if (XC_Functional::get_ked_flag()) { - v_ofk = this->pot->get_effective_vofk(1); + v_ofk = this->pot->get_eff_vofk(1); } for (int ir = 0; ir < this->charge->rhopw->nrxx; ir++) { @@ -232,7 +236,7 @@ double ElecState::cal_delta_escf() const { for (int is = 1; is < 4; is++) { - v_eff = this->pot->get_effective_v(is); + v_eff = this->pot->get_eff_v(is); for (int ir = 0; ir < this->charge->rhopw->nrxx; ir++) { descf -= (this->charge->rho[is][ir] - this->charge->rho_save[is][ir]) * v_eff[ir]; @@ -247,6 +251,8 @@ double ElecState::cal_delta_escf() const assert(this->charge->rhopw->nxyz > 0); descf *= this->charge->rhopw->omega / this->charge->rhopw->nxyz; + + ModuleBase::timer::tick("ElecState", "cal_delta_escf"); return descf; } @@ -311,7 +317,7 @@ void ElecState::cal_energies(const int type) } else { - ModuleBase::WARNING_QUIT("cal_energies", "The form of total energy functional is unknown!"); + ModuleBase::WARNING_QUIT("ElecState::cal_energies", "The form of total energy functional is unknown!"); } } diff --git a/source/source_estate/module_pot/pot_local_paw.cpp b/source/source_estate/module_pot/pot_local_paw.cpp deleted file mode 100644 index 03dab7d59e..0000000000 --- a/source/source_estate/module_pot/pot_local_paw.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "pot_local_paw.h" - -#include "source_base/timer.h" -#include "source_base/tool_title.h" - -#include - -namespace elecstate -{ - -//========================================================== -// This routine computes the local potential in real space -//========================================================== -void PotLocal_PAW::cal_fixed_v(double *vl_pseudo // store the local pseudopotential -) -{ - ModuleBase::TITLE("PotLocal_PAW", "cal_fixed_v"); - ModuleBase::timer::tick("PotLocal_PAW", "cal_fixed_v"); - - // GlobalV::ofs_running <<" set local pseudopotential done." << std::endl; - ModuleBase::timer::tick("PotLocal_PAW", "cal_fixed_v"); - return; -} - -} // namespace elecstate \ No newline at end of file diff --git a/source/source_estate/module_pot/pot_local_paw.h b/source/source_estate/module_pot/pot_local_paw.h deleted file mode 100644 index 7399827c33..0000000000 --- a/source/source_estate/module_pot/pot_local_paw.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef POTLOCALPAW_H -#define POTLOCALPAW_H - -#include "source_base/matrix.h" -#include "pot_base.h" - -namespace elecstate -{ - -class PotLocal_PAW : public PotBase -{ - public: - PotLocal_PAW() - { - this->fixed_mode = true; - this->dynamic_mode = false; - } - - void cal_fixed_v(double* vl_pseudo) override; -}; - -} // namespace elecstate - -#endif \ No newline at end of file diff --git a/source/source_estate/module_pot/potential_new.cpp b/source/source_estate/module_pot/potential_new.cpp index b1968339aa..ba59b5e8ed 100644 --- a/source/source_estate/module_pot/potential_new.cpp +++ b/source/source_estate/module_pot/potential_new.cpp @@ -109,10 +109,10 @@ void Potential::allocate() return; } - this->v_effective_fixed.resize(nrxx); + this->v_eff_fixed.resize(nrxx); ModuleBase::Memory::record("Pot::veff_fix", sizeof(double) * nrxx); - this->v_effective.create(nspin, nrxx); + this->v_eff.create(nspin, nrxx); ModuleBase::Memory::record("Pot::veff", sizeof(double) * nspin * nrxx); this->veff_smooth.create(nspin, nrxx_smooth); @@ -120,7 +120,7 @@ void Potential::allocate() if (XC_Functional::get_ked_flag()) { - this->vofk_effective.create(nspin, nrxx); + this->vofk_eff.create(nspin, nrxx); ModuleBase::Memory::record("Pot::vofk", sizeof(double) * nspin * nrxx); this->vofk_smooth.create(nspin, nrxx_smooth); @@ -162,11 +162,11 @@ void Potential::update_from_charge(const Charge*const chg, const UnitCell*const if (!this->fixed_done) { - this->cal_fixed_v(this->v_effective_fixed.data()); + this->cal_fixed_v(this->v_eff_fixed.data()); this->fixed_done = true; } - this->cal_v_eff(chg, ucell, this->v_effective); + this->cal_v_eff(chg, ucell, this->v_eff); // interpolate potential on the smooth mesh if necessary this->interpolate_vrs(); @@ -202,7 +202,7 @@ void Potential::cal_fixed_v(double* vl_pseudo) ModuleBase::TITLE("Potential", "cal_fixed_v"); ModuleBase::timer::tick("Potential", "cal_fixed_v"); - this->v_effective_fixed.assign(this->v_effective_fixed.size(), 0.0); + this->v_eff_fixed.assign(this->v_eff_fixed.size(), 0.0); for (size_t i = 0; i < this->components.size(); i++) { if (this->components[i]->fixed_mode) @@ -219,10 +219,10 @@ void Potential::cal_v_eff(const Charge*const chg, const UnitCell*const ucell, Mo ModuleBase::TITLE("Potential", "cal_veff"); ModuleBase::timer::tick("Potential", "cal_veff"); - const int nspin_current = this->v_effective.nr; - const int nrxx = this->v_effective.nc; - // first of all, set v_effective to zero. - this->v_effective.zero_out(); + const int nspin_current = this->v_eff.nr; + const int nrxx = this->v_eff.nc; + // first of all, set v_eff to zero. + this->v_eff.zero_out(); // add fixed potential components // nspin = 2, add fixed components for all @@ -231,11 +231,11 @@ void Potential::cal_v_eff(const Charge*const chg, const UnitCell*const ucell, Mo { if (i == 0 || nspin_current == 2) { - ModuleBase::GlobalFunc::COPYARRAY(this->v_effective_fixed.data(), this->get_effective_v(i), nrxx); + ModuleBase::GlobalFunc::COPYARRAY(this->v_eff_fixed.data(), this->get_eff_v(i), nrxx); } } - // cal effective by every components + // cal eff by every components for (size_t i = 0; i < this->components.size(); i++) { if (this->components[i]->dynamic_mode) @@ -265,14 +265,14 @@ void Potential::init_pot(int istep, const Charge*const chg) void Potential::get_vnew(const Charge* chg, ModuleBase::matrix& vnew) { ModuleBase::TITLE("Potential", "get_vnew"); - vnew.create(this->v_effective.nr, this->v_effective.nc); - vnew = this->v_effective; + vnew.create(this->v_eff.nr, this->v_eff.nc); + vnew = this->v_eff; this->update_from_charge(chg, this->ucell_); //(used later for scf correction to the forces ) for (int iter = 0; iter < vnew.nr * vnew.nc; ++iter) { - vnew.c[iter] = this->v_effective.c[iter] - vnew.c[iter]; + vnew.c[iter] = this->v_eff.c[iter] - vnew.c[iter]; } return; @@ -296,7 +296,7 @@ void Potential::interpolate_vrs(void) ModuleBase::ComplexMatrix vrs(nspin, rho_basis_->npw); for (int is = 0; is < nspin; is++) { - rho_basis_->real2recip(&v_effective(is, 0), &vrs(is, 0)); + rho_basis_->real2recip(&v_eff(is, 0), &vrs(is, 0)); rho_basis_smooth_->recip2real(&vrs(is, 0), &veff_smooth(is, 0)); } @@ -305,15 +305,15 @@ void Potential::interpolate_vrs(void) ModuleBase::ComplexMatrix vrs_ofk(nspin, rho_basis_->npw); for (int is = 0; is < nspin; is++) { - rho_basis_->real2recip(&vofk_effective(is, 0), &vrs_ofk(is, 0)); + rho_basis_->real2recip(&vofk_eff(is, 0), &vrs_ofk(is, 0)); rho_basis_smooth_->recip2real(&vrs_ofk(is, 0), &vofk_smooth(is, 0)); } } } else { - this->veff_smooth = this->v_effective; - this->vofk_smooth = this->vofk_effective; + this->veff_smooth = this->v_eff; + this->vofk_smooth = this->vofk_eff; } ModuleBase::timer::tick("Potential", "interpolate_vrs"); diff --git a/source/source_estate/module_pot/potential_new.h b/source/source_estate/module_pot/potential_new.h index ec2688ed9b..6ed7bdc93d 100644 --- a/source/source_estate/module_pot/potential_new.h +++ b/source/source_estate/module_pot/potential_new.h @@ -18,7 +18,7 @@ namespace elecstate * 2. Func init_pot() * a. need istep for update_for_tddft(); * b. need Charge for update_from_charge(); - * c. it will reset fixed_done to false, v_effective_fixed will be calculated; + * c. it will reset fixed_done to false, v_eff_fixed will be calculated; * d. it should be called after Charge is initialized; * e. it can only be called once in one SCF loop * 3. Func pot_register() and components @@ -30,8 +30,8 @@ namespace elecstate * f. "efield", PotEfield introduces electronic field including dipole correction part of potentials; * g. "gatefield", PotGate introduces gate field part of potentials; * 4. Func update_from_charge() - * a. regenerate v_effective - * b. if Meta-GGA is choosed, it will regenerate vofk_effective + * a. regenerate v_eff + * b. if Meta-GGA is choosed, it will regenerate vofk_eff * 5. Func update_for_tddft() * a. in principle, it should be added to components, but it related to real time(istep) * b. it should be called after update_from_charge() as a compensation; @@ -41,9 +41,9 @@ namespace elecstate * 2. use the final delta_V_eff for calculating force correction * 7. Func write_potential() * 8. Func write_elecstat_pot() - * 9. interfaces for v_effective_fixed/v_effective/vofk_effective + * 9. interfaces for v_eff_fixed/v_eff/vofk_eff * 10. Func interpolate_vrs() - * a. interpolate v_effective on the smooth mesh + * a. interpolate v_eff on the smooth mesh */ class Potential : public PotBase { @@ -53,7 +53,7 @@ class Potential : public PotBase // In constructor, size of every potential components should be allocated // rho_basis_in is the dense grids, rho_basis_smooth_in is the smooth grids in USPP // charge density and potential are defined on dense grids, - // but effective potential needs to be interpolated on smooth grids in order to compute Veff|psi> + // but eff potential needs to be interpolated on smooth grids in order to compute Veff|psi> // Note: rho_basis_in and rho_basis_smooth_in are the same in NCPP Potential(const ModulePW::PW_Basis* rho_basis_in, const ModulePW::PW_Basis* rho_basis_smooth_in, @@ -78,61 +78,61 @@ class Potential : public PotBase PotBase* get_pot_type(const std::string& pot_type); // interfaces to get values - ModuleBase::matrix& get_effective_v() + ModuleBase::matrix& get_eff_v() { - return this->v_effective; + return this->v_eff; } - const ModuleBase::matrix& get_effective_v() const + const ModuleBase::matrix& get_eff_v() const { - return this->v_effective; + return this->v_eff; } - double* get_effective_v(int is) + double* get_eff_v(int is) { - if (this->v_effective.nc > 0) + if (this->v_eff.nc > 0) { - return &(this->v_effective(is, 0)); + return &(this->v_eff(is, 0)); } else { return nullptr; } } - const double* get_effective_v(int is) const + const double* get_eff_v(int is) const { - if (this->v_effective.nc > 0) + if (this->v_eff.nc > 0) { - return &(this->v_effective(is, 0)); + return &(this->v_eff(is, 0)); } else { return nullptr; } } - ModuleBase::matrix& get_effective_vofk() + ModuleBase::matrix& get_eff_vofk() { - return this->vofk_effective; + return this->vofk_eff; } - const ModuleBase::matrix& get_effective_vofk() const + const ModuleBase::matrix& get_eff_vofk() const { - return this->vofk_effective; + return this->vofk_eff; } - double* get_effective_vofk(int is) + double* get_eff_vofk(int is) { - if (this->vofk_effective.nc > 0) + if (this->vofk_eff.nc > 0) { - return &(this->vofk_effective(is, 0)); + return &(this->vofk_eff(is, 0)); } else { return nullptr; } } - const double* get_effective_vofk(int is) const + const double* get_eff_vofk(int is) const { - if (this->vofk_effective.nc > 0) + if (this->vofk_eff.nc > 0) { - return &(this->vofk_effective(is, 0)); + return &(this->vofk_eff(is, 0)); } else { @@ -166,11 +166,11 @@ class Potential : public PotBase double* get_fixed_v() { - return this->v_effective_fixed.data(); + return this->v_eff_fixed.data(); } const double* get_fixed_v() const { - return this->v_effective_fixed.data(); + return this->v_eff_fixed.data(); } const ModulePW::PW_Basis *get_rho_basis() const { @@ -195,18 +195,20 @@ class Potential : public PotBase void allocate(); - std::vector v_effective_fixed; - ModuleBase::matrix v_effective; + std::vector v_eff_fixed; + ModuleBase::matrix v_eff; ModuleBase::matrix veff_smooth; // used in uspp liuyu 2023-10-12 ModuleBase::matrix vofk_smooth; // used in uspp liuyu 2023-10-12 ModuleBase::matrix v_xc; // if PAW is used, vxc must be stored separately - float *s_veff_smooth = nullptr, *s_vofk_smooth = nullptr; - double *d_veff_smooth = nullptr, *d_vofk_smooth = nullptr; + float *s_veff_smooth = nullptr; + float *s_vofk_smooth = nullptr; + double *d_veff_smooth = nullptr; + double *d_vofk_smooth = nullptr; - ModuleBase::matrix vofk_effective; + ModuleBase::matrix vofk_eff; bool fixed_done = false; diff --git a/source/source_estate/module_pot/potential_types.cpp b/source/source_estate/module_pot/potential_types.cpp index f62a34aa75..ba74f5143e 100644 --- a/source/source_estate/module_pot/potential_types.cpp +++ b/source/source_estate/module_pot/potential_types.cpp @@ -13,7 +13,6 @@ #include "pot_xc.h" #include "potential_new.h" #include "pot_sep.h" -#include "pot_local_paw.h" #ifdef __LCAO #include "H_TDDFT_pw.h" #endif @@ -34,13 +33,13 @@ PotBase* Potential::get_pot_type(const std::string& pot_type) } else if (pot_type == "xc") { - return new PotXC(this->rho_basis_, this->etxc_, this->vtxc_, &(this->vofk_effective)); + return new PotXC(this->rho_basis_, this->etxc_, this->vtxc_, &(this->vofk_eff)); } else if (pot_type == "surchem") { return new PotSurChem(this->rho_basis_, this->structure_factors_, - this->v_effective_fixed.data(), + this->v_eff_fixed.data(), this->solvent_); } else if (pot_type == "efield") diff --git a/source/source_io/ctrl_output_fp.cpp b/source/source_io/ctrl_output_fp.cpp index 0cde6e6011..bbe0fea792 100644 --- a/source/source_io/ctrl_output_fp.cpp +++ b/source/source_io/ctrl_output_fp.cpp @@ -121,7 +121,7 @@ void ctrl_output_fp(UnitCell& ucell, fn += spin_block + geom_block + ".cube"; ModuleIO::write_vdata_palgrid(para_grid, - pelec->pot->get_effective_v(is), + pelec->pot->get_eff_v(is), is, nspin, istep_in, diff --git a/source/source_io/ctrl_scf_lcao.cpp b/source/source_io/ctrl_scf_lcao.cpp index 590451b32d..6bd92c703d 100644 --- a/source/source_io/ctrl_scf_lcao.cpp +++ b/source/source_io/ctrl_scf_lcao.cpp @@ -216,7 +216,7 @@ void ModuleIO::ctrl_scf_lcao(UnitCell& ucell, inp.out_mat_t, inp.out_mat_r, istep, - pelec->pot->get_effective_v(), + pelec->pot->get_eff_v(), pv, two_center_bundle, orb, diff --git a/source/source_io/write_init.cpp b/source/source_io/write_init.cpp index 8881647023..ba435790f6 100644 --- a/source/source_io/write_init.cpp +++ b/source/source_io/write_init.cpp @@ -91,7 +91,7 @@ void ModuleIO::write_pot_init( } ModuleIO::write_vdata_palgrid(para_grid, - pelec->pot->get_effective_v(is), + pelec->pot->get_eff_v(is), is, nspin, istep, diff --git a/source/source_lcao/module_operator_lcao/veff_lcao.cpp b/source/source_lcao/module_operator_lcao/veff_lcao.cpp index 0df6ed33a5..f664844544 100644 --- a/source/source_lcao/module_operator_lcao/veff_lcao.cpp +++ b/source/source_lcao/module_operator_lcao/veff_lcao.cpp @@ -65,8 +65,8 @@ void Veff>::contributeHR() //(1) prepare data for this k point. // copy the local potential from array. //----------------------------------------- - double* vr_eff1 = this->pot->get_effective_v(this->current_spin); - double* vofk_eff1 = this->pot->get_effective_vofk(this->current_spin); + double* vr_eff1 = this->pot->get_eff_v(this->current_spin); + double* vofk_eff1 = this->pot->get_eff_vofk(this->current_spin); if(XC_Functional::get_ked_flag()) { @@ -95,8 +95,8 @@ void Veff, double>>::contributeHR() //(1) prepare data for this k point. // copy the local potential from array. //----------------------------------------- - double* vr_eff1 = this->pot->get_effective_v(this->current_spin); - double* vofk_eff1 = this->pot->get_effective_vofk(this->current_spin); + double* vr_eff1 = this->pot->get_eff_v(this->current_spin); + double* vofk_eff1 = this->pot->get_eff_vofk(this->current_spin); if(XC_Functional::get_ked_flag()) { @@ -126,16 +126,17 @@ void Veff, std::complex>>::contributeH std::vector vofk_eff(4, nullptr); for (int is = 0; is < 4; is++) { - vr_eff[is] = this->pot->get_effective_v(is); + vr_eff[is] = this->pot->get_eff_v(is); if(XC_Functional::get_ked_flag()) { - vofk_eff[is] = this->pot->get_effective_vofk(is); + vofk_eff[is] = this->pot->get_eff_vofk(is); } } if(XC_Functional::get_ked_flag()) { ModuleGint::cal_gint_vl_metagga(vr_eff, vofk_eff, this->hR); - } else + } + else { ModuleGint::cal_gint_vl(vr_eff, this->hR); } @@ -150,4 +151,4 @@ template class Veff>; template class Veff, double>>; template class Veff, std::complex>>; -} \ No newline at end of file +} diff --git a/source/source_lcao/pulay_fs_gint.hpp b/source/source_lcao/pulay_fs_gint.hpp index 9603a28c34..46040ce340 100644 --- a/source/source_lcao/pulay_fs_gint.hpp +++ b/source/source_lcao/pulay_fs_gint.hpp @@ -24,8 +24,8 @@ namespace PulayForceStress { for (int is = 0; is < nspin; ++is) { - vr_eff[is] = pot->get_effective_v(is); - vofk_eff[is] = pot->get_effective_vofk(is); + vr_eff[is] = pot->get_eff_v(is); + vofk_eff[is] = pot->get_eff_vofk(is); } ModuleGint::cal_gint_fvl_meta(nspin, vr_eff, vofk_eff, dm.get_DMR_vector(), isforce, isstress, &f, &s); } @@ -33,7 +33,7 @@ namespace PulayForceStress { for(int is = 0; is < nspin; ++is) { - vr_eff[is] = pot->get_effective_v(is); + vr_eff[is] = pot->get_eff_v(is); } ModuleGint::cal_gint_fvl(nspin, vr_eff, dm.get_DMR_vector(), isforce, isstress, &f, &s); } diff --git a/source/source_pw/module_ofdft/evolve_ofdft.cpp b/source/source_pw/module_ofdft/evolve_ofdft.cpp index f4aaea2cec..05a058671d 100644 --- a/source/source_pw/module_ofdft/evolve_ofdft.cpp +++ b/source/source_pw/module_ofdft/evolve_ofdft.cpp @@ -25,10 +25,10 @@ void Evolve_OFDFT::cal_Hpsi(elecstate::ElecState* pelec, } pelec->pot->update_from_charge(&chr, &ucell); // Hartree + XC + external - this->cal_tf_potential(chr.rho, pw_rho, pelec->pot->get_effective_v()); // TF potential + this->cal_tf_potential(chr.rho, pw_rho, pelec->pot->get_eff_v()); // TF potential if (PARAM.inp.of_cd) { - this->cal_CD_potential(psi_, pw_rho, pelec->pot->get_effective_v(), PARAM.inp.of_mCD_alpha); // CD potential + this->cal_CD_potential(psi_, pw_rho, pelec->pot->get_eff_v(), PARAM.inp.of_mCD_alpha); // CD potential } #ifdef _OPENMP @@ -36,7 +36,7 @@ void Evolve_OFDFT::cal_Hpsi(elecstate::ElecState* pelec, #endif for (int is = 0; is < PARAM.inp.nspin; ++is) { - const double* vr_eff = pelec->pot->get_effective_v(is); + const double* vr_eff = pelec->pot->get_eff_v(is); for (int ir = 0; ir < pw_rho->nrxx; ++ir) { Hpsi[is * pw_rho->nrxx + ir] = vr_eff[ir]*psi_[is * pw_rho->nrxx + ir]; @@ -188,14 +188,17 @@ void Evolve_OFDFT::cal_CD_potential(std::vector> psi_, pw_rho->real2recip(rCurrent_z,recipCurrent_z); for (int ik = 0; ik < pw_rho->npw; ++ik) { - recipCDPotential[ik]=recipCurrent_x[ik]*pw_rho->gcar[ik].x+recipCurrent_y[ik]*pw_rho->gcar[ik].y+recipCurrent_z[ik]*pw_rho->gcar[ik].z; + recipCDPotential[ik]=recipCurrent_x[ik]*pw_rho->gcar[ik].x + +recipCurrent_y[ik]*pw_rho->gcar[ik].y + +recipCurrent_z[ik]*pw_rho->gcar[ik].z; recipCDPotential[ik]*=imag/pw_rho->gg[ik]; } pw_rho->recip2real(recipCDPotential,rCDPotential); for (int ir = 0; ir < pw_rho->nrxx; ++ir) { - rpot(0, ir) -= mCD_para*2.0*std::real(rCDPotential[ir])*std::pow(ModuleBase::PI,3) / (2.0*std::pow(std::real(kF_r[ir]),2)); + rpot(0, ir) -= mCD_para*2.0*std::real(rCDPotential[ir])*std::pow(ModuleBase::PI,3) + / (2.0*std::pow(std::real(kF_r[ir]),2)); } delete[] recipCurrent_x; delete[] recipCurrent_y; @@ -278,9 +281,11 @@ void Evolve_OFDFT::propagate_psi(elecstate::ElecState* pelec, for (int ir = 0; ir < pw_rho->nrxx; ++ir) { K4[is * nrxx + ir]=-1.0*K4[is * nrxx + ir]*dt*imag; - pphi_[is * nrxx + ir]+=1.0/6.0*(K1[is * nrxx + ir]+2.0*K2[is * nrxx + ir]+2.0*K3[is * nrxx + ir]+K4[is * nrxx + ir]); + pphi_[is * nrxx + ir]+=1.0/6.0*(K1[is * nrxx + ir] + +2.0*K2[is * nrxx + ir]+2.0*K3[is * nrxx + ir] + +K4[is * nrxx + ir]); } } ModuleBase::timer::tick("ESolver_OF_TDDFT", "propagte_psi"); -} \ No newline at end of file +} diff --git a/source/source_pw/module_pwdft/forces_us.cpp b/source/source_pw/module_pwdft/forces_us.cpp index dd2fbc5f8d..f5a6a4444e 100644 --- a/source/source_pw/module_pwdft/forces_us.cpp +++ b/source/source_pw/module_pwdft/forces_us.cpp @@ -31,7 +31,7 @@ void Forces::cal_force_us(ModuleBase::matrix& forcenl, ModuleBase::matrix forceq(ucell.nat, 3); - ModuleBase::matrix veff = elec.pot->get_effective_v(); + ModuleBase::matrix veff = elec.pot->get_eff_v(); ModuleBase::ComplexMatrix vg(PARAM.inp.nspin, npw); // fourier transform of the total effective potential for (int is = 0; is < PARAM.inp.nspin; is++) @@ -143,4 +143,4 @@ void Forces::cal_force_us(ModuleBase::matrix& forcenl, template class Forces; #if ((defined __CUDA) || (defined __ROCM)) template class Forces; -#endif \ No newline at end of file +#endif diff --git a/source/source_pw/module_pwdft/setup_pot.cpp b/source/source_pw/module_pwdft/setup_pot.cpp index e4bc159c80..7a3b0c711a 100644 --- a/source/source_pw/module_pwdft/setup_pot.cpp +++ b/source/source_pw/module_pwdft/setup_pot.cpp @@ -66,7 +66,7 @@ void pw::setup_pot(const int istep, //! D in uspp need vloc, thus behind init_scf() //! calculate the effective coefficient matrix //! for non-local pseudopotential projectors - ModuleBase::matrix veff = pelec->pot->get_effective_v(); + ModuleBase::matrix veff = pelec->pot->get_eff_v(); ppcell.cal_effective_D(veff, pw_rhod, ucell); diff --git a/source/source_pw/module_pwdft/stress_func_us.cpp b/source/source_pw/module_pwdft/stress_func_us.cpp index adb8745901..1881dacafe 100644 --- a/source/source_pw/module_pwdft/stress_func_us.cpp +++ b/source/source_pw/module_pwdft/stress_func_us.cpp @@ -26,7 +26,7 @@ void Stress_PW::stress_us(ModuleBase::matrix& sigma, ModuleBase::matrix stressus(3, 3); - ModuleBase::matrix veff = this->pelec->pot->get_effective_v(); + ModuleBase::matrix veff = this->pelec->pot->get_eff_v(); ModuleBase::ComplexMatrix vg(PARAM.inp.nspin, npw); // fourier transform of the total effective potential for (int is = 0; is < PARAM.inp.nspin; is++) diff --git a/source/source_pw/module_pwdft/stress_pw.cpp b/source/source_pw/module_pwdft/stress_pw.cpp index ee069ad898..f79bd6349c 100644 --- a/source/source_pw/module_pwdft/stress_pw.cpp +++ b/source/source_pw/module_pwdft/stress_pw.cpp @@ -92,7 +92,7 @@ void Stress_PW::cal_stress(ModuleBase::matrix& sigmatot, this->stress_mgga(ucell, sigmaxc, this->pelec->wg, - this->pelec->pot->get_effective_vofk(), + this->pelec->pot->get_eff_vofk(), pelec->charge, p_kv, wfc_basis, From c5f52e134df80af2bd40490ab7bddde141460f94 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Wed, 12 Nov 2025 10:08:02 +0800 Subject: [PATCH 09/36] add dm2rho in init_dm --- source/source_estate/module_dm/cal_dm_psi.cpp | 28 +++++++++---------- source/source_estate/module_dm/init_dm.cpp | 8 ++++-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/source/source_estate/module_dm/cal_dm_psi.cpp b/source/source_estate/module_dm/cal_dm_psi.cpp index 7f68838c94..bd14f21774 100644 --- a/source/source_estate/module_dm/cal_dm_psi.cpp +++ b/source/source_estate/module_dm/cal_dm_psi.cpp @@ -15,8 +15,8 @@ void cal_dm_psi(const Parallel_Orbitals* ParaV, const psi::Psi& wfc, elecstate::DensityMatrix& DM) { - ModuleBase::TITLE("elecstate", "cal_dm"); - ModuleBase::timer::tick("elecstate", "cal_dm"); + ModuleBase::TITLE("elecstate", "cal_dm_psi"); + ModuleBase::timer::tick("elecstate", "cal_dm_psi"); // dm.resize(wfc.get_nk(), ParaV->ncol, ParaV->nrow); const int nbands_local = wfc.get_nbands(); @@ -33,13 +33,10 @@ void cal_dm_psi(const Parallel_Orbitals* ParaV, // dm[ik].create(ParaV->ncol, ParaV->nrow); // wg_wfc(ib,iw) = wg[ib] * wfc(ib,iw); - psi::Psi wg_wfc(1, - wfc.get_nbands(), - wfc.get_nbasis(), - wfc.get_nbasis(), - true); - wg_wfc.set_all_psi(wfc.get_pointer(), wg_wfc.size()); + psi::Psi wg_wfc(1, wfc.get_nbands(), + wfc.get_nbasis(), wfc.get_nbasis(), true); + wg_wfc.set_all_psi(wfc.get_pointer(), wg_wfc.size()); int ib_global = 0; for (int ib_local = 0; ib_local < nbands_local; ++ib_local) @@ -50,7 +47,6 @@ void cal_dm_psi(const Parallel_Orbitals* ParaV, if (ib_global >= wg.nc) { break; - ModuleBase::WARNING_QUIT("ElecStateLCAO::cal_dm", "please check global2local_col!"); } } if (ib_global >= wg.nc) @@ -70,7 +66,7 @@ void cal_dm_psi(const Parallel_Orbitals* ParaV, psiMulPsi(wg_wfc, wfc, dmk_pointer); #endif } - ModuleBase::timer::tick("elecstate", "cal_dm"); + ModuleBase::timer::tick("elecstate", "cal_dm_psi"); return; } @@ -80,8 +76,8 @@ void cal_dm_psi(const Parallel_Orbitals* ParaV, const psi::Psi>& wfc, elecstate::DensityMatrix, double>& DM) { - ModuleBase::TITLE("elecstate", "cal_dm"); - ModuleBase::timer::tick("elecstate", "cal_dm"); + ModuleBase::TITLE("elecstate", "cal_dm_psi"); + ModuleBase::timer::tick("elecstate", "cal_dm_psi"); // dm.resize(wfc.get_nk(), ParaV->ncol, ParaV->nrow); const int nbands_local = wfc.get_nbands(); @@ -104,6 +100,7 @@ void cal_dm_psi(const Parallel_Orbitals* ParaV, const std::complex* pwfc = wfc.get_pointer(); std::complex* pwg_wfc = wg_wfc.get_pointer(); + #ifdef _OPENMP #pragma omp parallel for schedule(static, 1024) #endif @@ -139,8 +136,9 @@ void cal_dm_psi(const Parallel_Orbitals* ParaV, if (PARAM.inp.ks_solver == "cg_in_lcao") { psiMulPsi(wg_wfc, wfc, dmk_pointer); - } else - { + } + else + { psiMulPsiMpi(wg_wfc, wfc, dmk_pointer, ParaV->desc_wfc, ParaV->desc); } #else @@ -148,7 +146,7 @@ void cal_dm_psi(const Parallel_Orbitals* ParaV, #endif } - ModuleBase::timer::tick("elecstate", "cal_dm"); + ModuleBase::timer::tick("elecstate", "cal_dm_psi"); return; } diff --git a/source/source_estate/module_dm/init_dm.cpp b/source/source_estate/module_dm/init_dm.cpp index 669360ee1e..12eac5171b 100644 --- a/source/source_estate/module_dm/init_dm.cpp +++ b/source/source_estate/module_dm/init_dm.cpp @@ -2,6 +2,7 @@ #include "source_estate/module_dm/cal_dm_psi.h" #include "source_estate/elecstate_tools.h" #include "source_estate/cal_ux.h" +#include "source_lcao/rho_tau_lcao.h" // mohan add 2025-11-12 template void elecstate::init_dm(UnitCell& ucell, @@ -16,11 +17,10 @@ void elecstate::init_dm(UnitCell& ucell, if (iter == 1 && exx_two_level_step == 0) { - std::cout << " WAVEFUN -> CHARGE " << std::endl; + std::cout << " LCAO WAVEFUN -> CHARGE " << std::endl; // calculate the density matrix using read in wave functions // and then calculate the charge density on grid. - pelec->skip_weights = true; elecstate::calculate_weights(pelec->ekb, pelec->wg, @@ -34,7 +34,9 @@ void elecstate::init_dm(UnitCell& ucell, elecstate::cal_dm_psi(dmat.dm->get_paraV_pointer(), pelec->wg, *psi, *dmat.dm); dmat.dm->cal_DMR(); -// pelec->psiToRho(*psi); // I found this sentence is useless, mohan add 2025-11-04 + // mohan add 2025-11-12, use density matrix to calculate the charge density + LCAO_domain::dm2rho(dmat.dm->get_DMR_vector(), PARAM.inp.nspin, &chr); + pelec->skip_weights = false; elecstate::cal_ux(ucell); From 4b782c1aff659f128d201adc8d693241e185db7f Mon Sep 17 00:00:00 2001 From: mohanchen Date: Fri, 28 Nov 2025 16:07:56 +0800 Subject: [PATCH 10/36] delete useless calculate_weights --- source/source_estate/module_dm/init_dm.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/source/source_estate/module_dm/init_dm.cpp b/source/source_estate/module_dm/init_dm.cpp index 12eac5171b..73371af723 100644 --- a/source/source_estate/module_dm/init_dm.cpp +++ b/source/source_estate/module_dm/init_dm.cpp @@ -19,17 +19,6 @@ void elecstate::init_dm(UnitCell& ucell, { std::cout << " LCAO WAVEFUN -> CHARGE " << std::endl; - // calculate the density matrix using read in wave functions - // and then calculate the charge density on grid. - pelec->skip_weights = true; - elecstate::calculate_weights(pelec->ekb, - pelec->wg, - pelec->klist, - pelec->eferm, - pelec->f_en, - pelec->nelec_spin, - pelec->skip_weights); - elecstate::calEBand(pelec->ekb, pelec->wg, pelec->f_en); elecstate::cal_dm_psi(dmat.dm->get_paraV_pointer(), pelec->wg, *psi, *dmat.dm); dmat.dm->cal_DMR(); From 4e7352967ebae1a81bfab2beefed49b4f16defbb Mon Sep 17 00:00:00 2001 From: mohanchen Date: Fri, 28 Nov 2025 17:08:37 +0800 Subject: [PATCH 11/36] fix a potential bug, the bcast of descf --- source/source_estate/elecstate_energy.cpp | 6 ++++++ source/source_estate/module_dm/init_dm.cpp | 3 +-- source/source_estate/update_pot.cpp | 3 --- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/source/source_estate/elecstate_energy.cpp b/source/source_estate/elecstate_energy.cpp index d249ec9272..bbdc269fec 100644 --- a/source/source_estate/elecstate_energy.cpp +++ b/source/source_estate/elecstate_energy.cpp @@ -252,6 +252,12 @@ double ElecState::cal_delta_escf() const descf *= this->charge->rhopw->omega / this->charge->rhopw->nxyz; +// mohan move the code here, 2025-11-28 +#ifdef __MPI + MPI_Bcast(&descf, 1, MPI_DOUBLE, 0, BP_WORLD); +#endif + + ModuleBase::timer::tick("ElecState", "cal_delta_escf"); return descf; } diff --git a/source/source_estate/module_dm/init_dm.cpp b/source/source_estate/module_dm/init_dm.cpp index 73371af723..c45190e01e 100644 --- a/source/source_estate/module_dm/init_dm.cpp +++ b/source/source_estate/module_dm/init_dm.cpp @@ -20,14 +20,13 @@ void elecstate::init_dm(UnitCell& ucell, std::cout << " LCAO WAVEFUN -> CHARGE " << std::endl; elecstate::calEBand(pelec->ekb, pelec->wg, pelec->f_en); + elecstate::cal_dm_psi(dmat.dm->get_paraV_pointer(), pelec->wg, *psi, *dmat.dm); dmat.dm->cal_DMR(); // mohan add 2025-11-12, use density matrix to calculate the charge density LCAO_domain::dm2rho(dmat.dm->get_DMR_vector(), PARAM.inp.nspin, &chr); - pelec->skip_weights = false; - elecstate::cal_ux(ucell); //! update the potentials by using new electron charge density diff --git a/source/source_estate/update_pot.cpp b/source/source_estate/update_pot.cpp index 8a49f66e0c..f0f0ef861a 100644 --- a/source/source_estate/update_pot.cpp +++ b/source/source_estate/update_pot.cpp @@ -12,9 +12,6 @@ void elecstate::update_pot(UnitCell& ucell, // unitcell elecstate::cal_ux(ucell); pelec->pot->update_from_charge(&chr, &ucell); pelec->f_en.descf = pelec->cal_delta_escf(); -#ifdef __MPI - MPI_Bcast(&(pelec->f_en.descf), 1, MPI_DOUBLE, 0, BP_WORLD); -#endif } else { From af44de1f7e4cddec02cf8bafb3997f0bd6290cab Mon Sep 17 00:00:00 2001 From: mohanchen Date: Fri, 28 Nov 2025 18:00:09 +0800 Subject: [PATCH 12/36] move init_rho to KS:before_all_runners --- source/source_esolver/esolver_ks.cpp | 9 ++++++++- source/source_esolver/esolver_ks_pw.cpp | 2 +- source/source_estate/elecstate.cpp | 2 ++ source/source_estate/module_charge/charge.h | 2 -- source/source_estate/module_charge/charge_init.cpp | 7 +------ source/source_estate/setup_estate_pw.cpp | 3 --- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/source/source_esolver/esolver_ks.cpp b/source/source_esolver/esolver_ks.cpp index f19bbc8bdf..361f22cfe5 100644 --- a/source/source_esolver/esolver_ks.cpp +++ b/source/source_esolver/esolver_ks.cpp @@ -97,11 +97,18 @@ void ESolver_KS::before_all_runners(UnitCell& ucell, const Input_para pw::setup_pwwfc(inp, ucell, *this->pw_rho, this->kv, this->pw_wfc); //! 10) parallel of FFT grid - Pgrid.init(this->pw_rhod->nx, this->pw_rhod->ny, this->pw_rhod->nz, + this->Pgrid.init(this->pw_rhod->nx, this->pw_rhod->ny, this->pw_rhod->nz, this->pw_rhod->nplane, this->pw_rhod->nrxx, pw_big->nbz, pw_big->bz); //! 11) calculate the structure factor this->sf.setup(&ucell, Pgrid, this->pw_rhod); + + //! 12) read in charge density, mohan add 2025-11-28 + //! Inititlize the charge density. + this->chr.allocate(inp.nspin); // mohan move this from setup_estate_pw, 20251128 + this->chr.init_rho(this->eferm, ucell, this->Pgrid, this->sf.strucfac, ucell.symm, &this->kv, this->pw_wfc); + this->chr.check_rho(); // check the rho + } template diff --git a/source/source_esolver/esolver_ks_pw.cpp b/source/source_esolver/esolver_ks_pw.cpp index 9d03059b41..61ee2e10bc 100644 --- a/source/source_esolver/esolver_ks_pw.cpp +++ b/source/source_esolver/esolver_ks_pw.cpp @@ -80,7 +80,7 @@ void ESolver_KS_PW::before_all_runners(UnitCell& ucell, const Input_p //! Call before_all_runners() of ESolver_KS ESolver_KS::before_all_runners(ucell, inp); - //! setup and allocation for pelec, charge density, potentials, etc. + //! setup and allocation for pelec, potentials, etc. elecstate::setup_estate_pw(ucell, this->kv, this->sf, this->pelec, this->chr, this->locpp, this->ppcell, this->vsep_cell, this->pw_wfc, this->pw_rho, this->pw_rhod, this->pw_big, this->solvent, inp); diff --git a/source/source_estate/elecstate.cpp b/source/source_estate/elecstate.cpp index 58fdf7344a..be409e403a 100644 --- a/source/source_estate/elecstate.cpp +++ b/source/source_estate/elecstate.cpp @@ -40,11 +40,13 @@ void ElecState::init_scf(const int istep, //! other effective potentials need charge density, // choose charge density from ionic step 0. +/* if (istep == 0) { this->charge->init_rho(this->eferm,ucell, pgrid, strucfac, symm, (const void*)this->klist, wfcpw); this->charge->check_rho(); // check the rho } +*/ //! renormalize the charge density this->charge->renormalize_rho(); diff --git a/source/source_estate/module_charge/charge.h b/source/source_estate/module_charge/charge.h index 479eb8dc66..d1adb63eb3 100644 --- a/source/source_estate/module_charge/charge.h +++ b/source/source_estate/module_charge/charge.h @@ -97,8 +97,6 @@ class Charge const ModuleBase::ComplexMatrix& structure_factor, const bool* numeric); - void set_rho_core_paw(); - void renormalize_rho(); double sum_rho() const; diff --git a/source/source_estate/module_charge/charge_init.cpp b/source/source_estate/module_charge/charge_init.cpp index b3a034c3d2..9981e896a8 100644 --- a/source/source_estate/module_charge/charge_init.cpp +++ b/source/source_estate/module_charge/charge_init.cpp @@ -372,11 +372,6 @@ void Charge::set_rho_core(const UnitCell& ucell, return; } // end subroutine set_rhoc -void Charge::set_rho_core_paw() -{ - ModuleBase::TITLE("Charge","set_rho_core_paw"); -} - void Charge::non_linear_core_correction ( @@ -397,7 +392,7 @@ void Charge::non_linear_core_correction double gx = 0.0; double rhocg1 = 0.0; - double *aux; + double *aux = nullptr; // here we compute the fourier transform is the charge in numeric form if (numeric) diff --git a/source/source_estate/setup_estate_pw.cpp b/source/source_estate/setup_estate_pw.cpp index d384b3a171..bf96f04f81 100644 --- a/source/source_estate/setup_estate_pw.cpp +++ b/source/source_estate/setup_estate_pw.cpp @@ -39,9 +39,6 @@ void elecstate::setup_estate_pw(UnitCell& ucell, // unitcell } } - //! Inititlize the charge density. - chr.allocate(inp.nspin); - //! Initialize DFT-1/2 if (PARAM.inp.dfthalf_type > 0) { From f73d73df2e6102916b933362a57cf303db634a43 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Sat, 29 Nov 2025 15:16:50 +0800 Subject: [PATCH 13/36] fix the input parametes of init_rho --- source/source_esolver/esolver_ks.cpp | 2 +- source/source_estate/module_charge/charge.h | 5 ++--- source/source_estate/module_charge/charge_init.cpp | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/source/source_esolver/esolver_ks.cpp b/source/source_esolver/esolver_ks.cpp index 361f22cfe5..dc2d2b0d8b 100644 --- a/source/source_esolver/esolver_ks.cpp +++ b/source/source_esolver/esolver_ks.cpp @@ -106,7 +106,7 @@ void ESolver_KS::before_all_runners(UnitCell& ucell, const Input_para //! 12) read in charge density, mohan add 2025-11-28 //! Inititlize the charge density. this->chr.allocate(inp.nspin); // mohan move this from setup_estate_pw, 20251128 - this->chr.init_rho(this->eferm, ucell, this->Pgrid, this->sf.strucfac, ucell.symm, &this->kv, this->pw_wfc); + this->chr.init_rho(ucell, this->Pgrid, this->sf.strucFac, ucell.symm, &this->kv, this->pw_wfc); this->chr.check_rho(); // check the rho } diff --git a/source/source_estate/module_charge/charge.h b/source/source_estate/module_charge/charge.h index d1adb63eb3..a9190676a0 100644 --- a/source/source_estate/module_charge/charge.h +++ b/source/source_estate/module_charge/charge.h @@ -7,7 +7,7 @@ #include "source_base/parallel_global.h" #include "source_basis/module_pw/pw_basis.h" #include "source_cell/module_symmetry/symmetry.h" -#include "source_estate/fp_energy.h" +// #include "source_estate/fp_energy.h" #include "source_pw/module_pwdft/parallel_grid.h" //a forward declaration of UnitCell @@ -77,8 +77,7 @@ class Charge * @param klist [in] k points list if needed * @param wfcpw [in] PW basis for wave function if needed */ - void init_rho(elecstate::Efermi& eferm_iout, - const UnitCell& ucell, + void init_rho(const UnitCell& ucell, const Parallel_Grid& pgrid, const ModuleBase::ComplexMatrix& strucFac, ModuleSymmetry::Symmetry& symm, diff --git a/source/source_estate/module_charge/charge_init.cpp b/source/source_estate/module_charge/charge_init.cpp index 9981e896a8..95f675eb90 100644 --- a/source/source_estate/module_charge/charge_init.cpp +++ b/source/source_estate/module_charge/charge_init.cpp @@ -18,8 +18,7 @@ #include "source_io/rhog_io.h" #include "source_io/read_wf2rho_pw.h" -void Charge::init_rho(elecstate::Efermi& eferm_iout, - const UnitCell& ucell, +void Charge::init_rho(const UnitCell& ucell, const Parallel_Grid& pgrid, const ModuleBase::ComplexMatrix& strucFac, ModuleSymmetry::Symmetry& symm, From bbaddb3afce455c61585086e98350ed89963bab0 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Sat, 29 Nov 2025 15:21:21 +0800 Subject: [PATCH 14/36] small update of esolver_of.cpp --- source/source_esolver/esolver_of.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/source/source_esolver/esolver_of.cpp b/source/source_esolver/esolver_of.cpp index 0d31938f8c..e76c725546 100644 --- a/source/source_esolver/esolver_of.cpp +++ b/source/source_esolver/esolver_of.cpp @@ -97,13 +97,9 @@ void ESolver_OF::before_all_runners(UnitCell& ucell, const Input_para& inp) // initialize the real-space uniform grid for FFT and parallel // distribution of plane waves - Pgrid.init(pw_rho->nx, - pw_rho->ny, - pw_rho->nz, - pw_rho->nplane, - pw_rho->nrxx, - pw_big->nbz, - pw_big->bz); // mohan add 2010-07-22, update 2011-05-04 + Pgrid.init(pw_rho->nx, pw_rho->ny, pw_rho->nz, pw_rho->nplane, + pw_rho->nrxx, pw_big->nbz, pw_big->bz); // mohan add 2010-07-22, update 2011-05-04 + // Calculate Structure factor sf.setup(&ucell, Pgrid, pw_rho); ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "INIT BASIS"); From fed376dd74686c12a2b3c1583571879ff17ce3a7 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Sat, 29 Nov 2025 16:06:53 +0800 Subject: [PATCH 15/36] fix tests --- .../test/elecstate_base_test.cpp | 6 +- .../source_estate/test/elecstate_pw_test.cpp | 6 +- .../source_estate/test/potential_new_test.cpp | 112 +++++++++--------- 3 files changed, 58 insertions(+), 66 deletions(-) diff --git a/source/source_estate/test/elecstate_base_test.cpp b/source/source_estate/test/elecstate_base_test.cpp index 24ec4a5fff..72b9da750e 100644 --- a/source/source_estate/test/elecstate_base_test.cpp +++ b/source/source_estate/test/elecstate_base_test.cpp @@ -80,11 +80,7 @@ void ModulePW::PW_Basis::distribute_r() void Charge::set_rho_core(const UnitCell& ucell, ModuleBase::ComplexMatrix const&, const bool*) { } -void Charge::set_rho_core_paw() -{ -} -void Charge::init_rho(elecstate::Efermi&, - const UnitCell&, +void Charge::init_rho(const UnitCell&, const Parallel_Grid&, ModuleBase::ComplexMatrix const&, ModuleSymmetry::Symmetry& symm, diff --git a/source/source_estate/test/elecstate_pw_test.cpp b/source/source_estate/test/elecstate_pw_test.cpp index 4128d12812..75c4e46329 100644 --- a/source/source_estate/test/elecstate_pw_test.cpp +++ b/source/source_estate/test/elecstate_pw_test.cpp @@ -130,11 +130,7 @@ Fcoef::~Fcoef() void Charge::set_rho_core(const UnitCell& ucell, ModuleBase::ComplexMatrix const&, const bool*) { } -void Charge::set_rho_core_paw() -{ -} -void Charge::init_rho(elecstate::Efermi&, - const UnitCell&, +void Charge::init_rho(const UnitCell&, const Parallel_Grid&, ModuleBase::ComplexMatrix const&, ModuleSymmetry::Symmetry& symm, diff --git a/source/source_estate/test/potential_new_test.cpp b/source/source_estate/test/potential_new_test.cpp index b874be7b39..ea260d248b 100644 --- a/source/source_estate/test/potential_new_test.cpp +++ b/source/source_estate/test/potential_new_test.cpp @@ -170,9 +170,9 @@ TEST_F(PotentialNewTest, ConstructorCPUDouble) pot = new elecstate::Potential(rhopw, rhopw, ucell, vloc, structure_factors, solvent, etxc, vtxc); EXPECT_TRUE(pot->fixed_mode); EXPECT_TRUE(pot->dynamic_mode); - EXPECT_EQ(pot->v_effective_fixed.size(), 100); - EXPECT_EQ(pot->v_effective.nr, PARAM.input.nspin); - EXPECT_EQ(pot->v_effective.nc, 100); + EXPECT_EQ(pot->v_eff_fixed.size(), 100); + EXPECT_EQ(pot->v_eff.nr, PARAM.input.nspin); + EXPECT_EQ(pot->v_eff.nc, 100); } TEST_F(PotentialNewTest, ConstructorCPUSingle) @@ -182,9 +182,9 @@ TEST_F(PotentialNewTest, ConstructorCPUSingle) pot = new elecstate::Potential(rhopw, rhopw, ucell, vloc, structure_factors, solvent, etxc, vtxc); EXPECT_TRUE(pot->fixed_mode); EXPECT_TRUE(pot->dynamic_mode); - EXPECT_EQ(pot->v_effective_fixed.size(), 100); - EXPECT_EQ(pot->v_effective.nr, PARAM.input.nspin); - EXPECT_EQ(pot->v_effective.nc, 100); + EXPECT_EQ(pot->v_eff_fixed.size(), 100); + EXPECT_EQ(pot->v_eff.nr, PARAM.input.nspin); + EXPECT_EQ(pot->v_eff.nc, 100); } TEST_F(PotentialNewTest, ConstructorNRXX0) @@ -203,11 +203,11 @@ TEST_F(PotentialNewTest, ConstructorXC3) pot = new elecstate::Potential(rhopw, rhopw, ucell, vloc, structure_factors, solvent, etxc, vtxc); EXPECT_TRUE(pot->fixed_mode); EXPECT_TRUE(pot->dynamic_mode); - EXPECT_EQ(pot->v_effective_fixed.size(), 100); - EXPECT_EQ(pot->v_effective.nr, PARAM.input.nspin); - EXPECT_EQ(pot->v_effective.nc, 100); - EXPECT_EQ(pot->vofk_effective.nr, PARAM.input.nspin); - EXPECT_EQ(pot->vofk_effective.nc, 100); + EXPECT_EQ(pot->v_eff_fixed.size(), 100); + EXPECT_EQ(pot->v_eff.nr, PARAM.input.nspin); + EXPECT_EQ(pot->v_eff.nc, 100); + EXPECT_EQ(pot->vofk_eff.nr, PARAM.input.nspin); + EXPECT_EQ(pot->vofk_eff.nc, 100); } TEST_F(PotentialNewTest, ConstructorGPUDouble) @@ -218,9 +218,9 @@ TEST_F(PotentialNewTest, ConstructorGPUDouble) pot = new elecstate::Potential(rhopw, rhopw, ucell, vloc, structure_factors, solvent, etxc, vtxc); EXPECT_TRUE(pot->fixed_mode); EXPECT_TRUE(pot->dynamic_mode); - EXPECT_EQ(pot->v_effective_fixed.size(), 100); - EXPECT_EQ(pot->v_effective.nr, PARAM.input.nspin); - EXPECT_EQ(pot->v_effective.nc, 100); + EXPECT_EQ(pot->v_eff_fixed.size(), 100); + EXPECT_EQ(pot->v_eff.nr, PARAM.input.nspin); + EXPECT_EQ(pot->v_eff.nc, 100); } TEST_F(PotentialNewTest, ConstructorGPUSingle) @@ -232,9 +232,9 @@ TEST_F(PotentialNewTest, ConstructorGPUSingle) pot = new elecstate::Potential(rhopw, rhopw, ucell, vloc, structure_factors, solvent, etxc, vtxc); EXPECT_TRUE(pot->fixed_mode); EXPECT_TRUE(pot->dynamic_mode); - EXPECT_EQ(pot->v_effective_fixed.size(), 100); - EXPECT_EQ(pot->v_effective.nr, PARAM.input.nspin); - EXPECT_EQ(pot->v_effective.nc, 100); + EXPECT_EQ(pot->v_eff_fixed.size(), 100); + EXPECT_EQ(pot->v_eff.nr, PARAM.input.nspin); + EXPECT_EQ(pot->v_eff.nc, 100); } TEST_F(PotentialNewTest, Getters) @@ -289,9 +289,9 @@ TEST_F(PotentialNewTest, CalFixedV) } double* vl_pseudo = new double[1000]; pot->cal_fixed_v(vl_pseudo); - for (int i = 0; i < pot->v_effective_fixed.size(); i++) + for (int i = 0; i < pot->v_eff_fixed.size(); i++) { - EXPECT_DOUBLE_EQ(pot->v_effective_fixed[i], 0.0); + EXPECT_DOUBLE_EQ(pot->v_eff_fixed[i], 0.0); } delete[] vl_pseudo; } @@ -319,9 +319,9 @@ TEST_F(PotentialNewTest, CalVeff) ModuleBase::matrix v_eff; v_eff.create(2, 100); pot->cal_v_eff(chg,this->ucell,v_eff); - for (int i = 0; i < pot->v_effective_fixed.size(); i++) + for (int i = 0; i < pot->v_eff_fixed.size(); i++) { - EXPECT_DOUBLE_EQ(pot->v_effective_fixed[i], 0.0); + EXPECT_DOUBLE_EQ(pot->v_eff_fixed[i], 0.0); } delete chg; } @@ -417,8 +417,8 @@ TEST_F(PotentialNewTest, GetEffectiveVmatrix) rhopw->nrxx = 100; pot = new elecstate::Potential(rhopw, rhopw, ucell, vloc, structure_factors, solvent, etxc, vtxc); // - ModuleBase::matrix v_eff_tmp = pot->get_effective_v(); - const ModuleBase::matrix v_eff_tmp_const = pot->get_effective_v(); + ModuleBase::matrix v_eff_tmp = pot->get_eff_v(); + const ModuleBase::matrix v_eff_tmp_const = pot->get_eff_v(); EXPECT_EQ(v_eff_tmp.nr, PARAM.input.nspin); EXPECT_EQ(v_eff_tmp.nc, 100); EXPECT_EQ(v_eff_tmp_const.nr, PARAM.input.nspin); @@ -427,8 +427,8 @@ TEST_F(PotentialNewTest, GetEffectiveVmatrix) { for (int ic = 0; ic < v_eff_tmp.nc; ic++) { - EXPECT_DOUBLE_EQ(v_eff_tmp(ir, ic), pot->v_effective(ir, ic)); - EXPECT_DOUBLE_EQ(v_eff_tmp_const(ir, ic), pot->v_effective(ir, ic)); + EXPECT_DOUBLE_EQ(v_eff_tmp(ir, ic), pot->v_eff(ir, ic)); + EXPECT_DOUBLE_EQ(v_eff_tmp_const(ir, ic), pot->v_eff(ir, ic)); } } } @@ -439,24 +439,24 @@ TEST_F(PotentialNewTest, GetEffectiveVarray) rhopw->nrxx = 100; pot = new elecstate::Potential(rhopw, rhopw, ucell, vloc, structure_factors, solvent, etxc, vtxc); // - double* v_eff_tmp = pot->get_effective_v(0); - const double* v_eff_tmp_const = pot->get_effective_v(0); + double* v_eff_tmp = pot->get_eff_v(0); + const double* v_eff_tmp_const = pot->get_eff_v(0); for (int ic = 0; ic < rhopw->nrxx; ic++) { - EXPECT_DOUBLE_EQ(v_eff_tmp[ic], pot->v_effective(0, ic)); - EXPECT_DOUBLE_EQ(v_eff_tmp_const[ic], pot->v_effective(0, ic)); + EXPECT_DOUBLE_EQ(v_eff_tmp[ic], pot->v_eff(0, ic)); + EXPECT_DOUBLE_EQ(v_eff_tmp_const[ic], pot->v_eff(0, ic)); } v_eff_tmp[0] = 1.0; - EXPECT_DOUBLE_EQ(pot->v_effective(0, 0), 1.0); + EXPECT_DOUBLE_EQ(pot->v_eff(0, 0), 1.0); EXPECT_DOUBLE_EQ(v_eff_tmp_const[0], 1.0); } TEST_F(PotentialNewTest, GetEffectiveVarrayNullptr) { pot = new elecstate::Potential; - EXPECT_EQ(pot->v_effective.nc, 0); - double* v_eff_tmp = pot->get_effective_v(0); - const double* v_eff_tmp_const = pot->get_effective_v(0); + EXPECT_EQ(pot->v_eff.nc, 0); + double* v_eff_tmp = pot->get_eff_v(0); + const double* v_eff_tmp_const = pot->get_eff_v(0); EXPECT_EQ(v_eff_tmp, nullptr); EXPECT_EQ(v_eff_tmp_const, nullptr); } @@ -469,8 +469,8 @@ TEST_F(PotentialNewTest, GetEffectiveVofkmatrix) rhopw->nrxx = 100; pot = new elecstate::Potential(rhopw, rhopw, ucell, vloc, structure_factors, solvent, etxc, vtxc); // - ModuleBase::matrix vofk_eff_tmp = pot->get_effective_vofk(); - const ModuleBase::matrix vofk_eff_tmp_const = pot->get_effective_vofk(); + ModuleBase::matrix vofk_eff_tmp = pot->get_eff_vofk(); + const ModuleBase::matrix vofk_eff_tmp_const = pot->get_eff_vofk(); EXPECT_EQ(vofk_eff_tmp.nr, PARAM.input.nspin); EXPECT_EQ(vofk_eff_tmp.nc, 100); EXPECT_EQ(vofk_eff_tmp_const.nr, PARAM.input.nspin); @@ -479,8 +479,8 @@ TEST_F(PotentialNewTest, GetEffectiveVofkmatrix) { for (int ic = 0; ic < vofk_eff_tmp.nc; ic++) { - EXPECT_DOUBLE_EQ(vofk_eff_tmp(ir, ic), pot->vofk_effective(ir, ic)); - EXPECT_DOUBLE_EQ(vofk_eff_tmp_const(ir, ic), pot->vofk_effective(ir, ic)); + EXPECT_DOUBLE_EQ(vofk_eff_tmp(ir, ic), pot->vofk_eff(ir, ic)); + EXPECT_DOUBLE_EQ(vofk_eff_tmp_const(ir, ic), pot->vofk_eff(ir, ic)); } } } @@ -491,24 +491,24 @@ TEST_F(PotentialNewTest, GetEffectiveVofkarray) rhopw->nrxx = 100; pot = new elecstate::Potential(rhopw, rhopw, ucell, vloc, structure_factors, solvent, etxc, vtxc); // - double* vofk_eff_tmp = pot->get_effective_vofk(0); - const double* vofk_eff_tmp_const = pot->get_effective_vofk(0); + double* vofk_eff_tmp = pot->get_eff_vofk(0); + const double* vofk_eff_tmp_const = pot->get_eff_vofk(0); for (int ic = 0; ic < rhopw->nrxx; ic++) { - EXPECT_DOUBLE_EQ(vofk_eff_tmp[ic], pot->vofk_effective(0, ic)); - EXPECT_DOUBLE_EQ(vofk_eff_tmp_const[ic], pot->vofk_effective(0, ic)); + EXPECT_DOUBLE_EQ(vofk_eff_tmp[ic], pot->vofk_eff(0, ic)); + EXPECT_DOUBLE_EQ(vofk_eff_tmp_const[ic], pot->vofk_eff(0, ic)); } vofk_eff_tmp[0] = 1.0; - EXPECT_DOUBLE_EQ(pot->vofk_effective(0, 0), 1.0); + EXPECT_DOUBLE_EQ(pot->vofk_eff(0, 0), 1.0); EXPECT_DOUBLE_EQ(vofk_eff_tmp_const[0], 1.0); } TEST_F(PotentialNewTest, GetEffectiveVofkarrayNullptr) { pot = new elecstate::Potential; - EXPECT_EQ(pot->v_effective.nc, 0); - double* vofk_eff_tmp = pot->get_effective_vofk(0); - const double* vofk_eff_tmp_const = pot->get_effective_vofk(0); + EXPECT_EQ(pot->v_eff.nc, 0); + double* vofk_eff_tmp = pot->get_eff_vofk(0); + const double* vofk_eff_tmp_const = pot->get_eff_vofk(0); EXPECT_EQ(vofk_eff_tmp, nullptr); EXPECT_EQ(vofk_eff_tmp_const, nullptr); } @@ -519,14 +519,14 @@ TEST_F(PotentialNewTest, GetFixedV) pot = new elecstate::Potential(rhopw, rhopw, ucell, vloc, structure_factors, solvent, etxc, vtxc); EXPECT_TRUE(pot->fixed_mode); EXPECT_TRUE(pot->dynamic_mode); - EXPECT_EQ(pot->v_effective_fixed.size(), 100); + EXPECT_EQ(pot->v_eff_fixed.size(), 100); double* v_eff_fixed_tmp = pot->get_fixed_v(); const double* v_eff_fixed_tmp_const = pot->get_fixed_v(); for (int ic = 0; ic < rhopw->nrxx; ic++) { v_eff_fixed_tmp[ic] = ic; - EXPECT_DOUBLE_EQ(v_eff_fixed_tmp[ic], pot->v_effective_fixed[ic]); - EXPECT_DOUBLE_EQ(v_eff_fixed_tmp_const[ic], pot->v_effective_fixed[ic]); + EXPECT_DOUBLE_EQ(v_eff_fixed_tmp[ic], pot->v_eff_fixed[ic]); + EXPECT_DOUBLE_EQ(v_eff_fixed_tmp_const[ic], pot->v_eff_fixed[ic]); } } @@ -594,12 +594,12 @@ TEST_F(PotentialNewTest, InterpolateVrsDoubleGrids) pot = new elecstate::Potential(rhodpw, rhopw, ucell, vloc, structure_factors, solvent, etxc, vtxc); - for (int ir = 0; ir < pot->v_effective.nr; ir++) + for (int ir = 0; ir < pot->v_eff.nr; ir++) { - for (int ic = 0; ic < pot->v_effective.nc; ic++) + for (int ic = 0; ic < pot->v_eff.nc; ic++) { - pot->v_effective(ir, ic) = ir + ic; - pot->vofk_effective(ir, ic) = ir + 2 * ic; + pot->v_eff(ir, ic) = ir + ic; + pot->vofk_eff(ir, ic) = ir + 2 * ic; } } @@ -655,12 +655,12 @@ TEST_F(PotentialNewTest, InterpolateVrsSingleGrids) pot = new elecstate::Potential(rhopw, rhopw, ucell, vloc, structure_factors, solvent, etxc, vtxc); - for (int ir = 0; ir < pot->v_effective.nr; ir++) + for (int ir = 0; ir < pot->v_eff.nr; ir++) { - for (int ic = 0; ic < pot->v_effective.nc; ic++) + for (int ic = 0; ic < pot->v_eff.nc; ic++) { - pot->v_effective(ir, ic) = ir + ic; - pot->vofk_effective(ir, ic) = ir + 2 * ic; + pot->v_eff(ir, ic) = ir + ic; + pot->vofk_eff(ir, ic) = ir + 2 * ic; } } From 9b1613a19c93b09ba7da11c5c3d736fd3f18381d Mon Sep 17 00:00:00 2001 From: mohanchen Date: Sat, 29 Nov 2025 16:16:54 +0800 Subject: [PATCH 16/36] update eff in ML_KEDF --- source/source_io/ctrl_output_pw.cpp | 2 +- source/source_io/write_elecstat_pot.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/source_io/ctrl_output_pw.cpp b/source/source_io/ctrl_output_pw.cpp index 34d57caa01..decd1f680a 100644 --- a/source/source_io/ctrl_output_pw.cpp +++ b/source/source_io/ctrl_output_pw.cpp @@ -366,7 +366,7 @@ void ModuleIO::ctrl_runner_pw(UnitCell& ucell, pw_wfc, pw_rho, ucell, - pelec->pot->get_effective_v(0)); + pelec->pot->get_eff_v(0)); } #endif diff --git a/source/source_io/write_elecstat_pot.h b/source/source_io/write_elecstat_pot.h index 76c90bf70d..bd3f2a8734 100644 --- a/source/source_io/write_elecstat_pot.h +++ b/source/source_io/write_elecstat_pot.h @@ -18,7 +18,7 @@ namespace ModuleIO /// @param rho_basis /// @param chr /// @param ucell_ -/// @param v_effective_fixed +/// @param v_eff_fixed void write_elecstat_pot( #ifdef __MPI const int& bz, @@ -29,7 +29,7 @@ void write_elecstat_pot( ModulePW::PW_Basis* rho_basis, const Charge* const chr, const UnitCell* ucell_, - const double* v_effective_fixed, + const double* v_eff_fixed, const surchem& solvent); } // namespace ModuleIO From 68ed730cda9e49dcfc8f9069319ce8cb3aeeb3bd Mon Sep 17 00:00:00 2001 From: mohanchen Date: Sat, 29 Nov 2025 17:42:57 +0800 Subject: [PATCH 17/36] fix a potential bug in allocate() function in charge.cpp --- source/source_estate/module_charge/charge.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/source_estate/module_charge/charge.cpp b/source/source_estate/module_charge/charge.cpp index be86a04800..326af9d57b 100644 --- a/source/source_estate/module_charge/charge.cpp +++ b/source/source_estate/module_charge/charge.cpp @@ -80,10 +80,17 @@ void Charge::destroy() void Charge::allocate(const int& nspin_in) { ModuleBase::TITLE("Charge", "allocate"); + + if (this->rhopw == nullptr) + { + ModuleBase::WARNING_QUIT("Charge::allocate","rhopw is nullptr."); + } + this->nrxx = this->rhopw->nrxx; this->nxyz = this->rhopw->nxyz; this->ngmc = this->rhopw->npw; + if (allocate_rho == true) { this->destroy(); From 65bbaa941373a2ede02ec1818a2786aa417f3762 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Sun, 30 Nov 2025 09:16:56 +0800 Subject: [PATCH 18/36] move set_rhopw from elecstate to before charge.allocate --- source/source_esolver/esolver_double_xc.cpp | 1 - source/source_esolver/esolver_gets.cpp | 1 - source/source_esolver/esolver_ks.cpp | 1 + source/source_esolver/esolver_ks_lcao.cpp | 2 +- source/source_estate/elecstate.cpp | 3 +-- source/source_estate/elecstate.h | 1 - source/source_estate/elecstate_lcao.h | 3 +-- source/source_estate/elecstate_pw.cpp | 3 +-- source/source_estate/elecstate_pw.h | 1 - source/source_estate/elecstate_pw_sdft.cpp | 2 +- source/source_estate/elecstate_pw_sdft.h | 3 +-- source/source_estate/setup_estate_pw.cpp | 6 ++---- source/source_estate/test/elecstate_base_test.cpp | 8 ++------ source/source_estate/test/elecstate_pw_test.cpp | 6 ------ source/source_hsolver/test/hsolver_supplementary_mock.h | 2 -- source/source_hsolver/test/test_hsolver_sdft.cpp | 4 ++-- 16 files changed, 13 insertions(+), 34 deletions(-) diff --git a/source/source_esolver/esolver_double_xc.cpp b/source/source_esolver/esolver_double_xc.cpp index 1e80391dfc..b137427851 100644 --- a/source/source_esolver/esolver_double_xc.cpp +++ b/source/source_esolver/esolver_double_xc.cpp @@ -51,7 +51,6 @@ void ESolver_DoubleXC::before_all_runners(UnitCell& ucell, const Input_p this->pelec_base = new elecstate::ElecStateLCAO(&(this->chr_base), // use which parameter? &(this->kv), this->kv.get_nks(), - this->pw_rho, this->pw_big); } diff --git a/source/source_esolver/esolver_gets.cpp b/source/source_esolver/esolver_gets.cpp index 4e79849367..108b148f7e 100644 --- a/source/source_esolver/esolver_gets.cpp +++ b/source/source_esolver/esolver_gets.cpp @@ -53,7 +53,6 @@ void ESolver_GetS::before_all_runners(UnitCell& ucell, const Input_para& inp) this->pelec = new elecstate::ElecStateLCAO>(&(this->chr), // use which parameter? &(this->kv), this->kv.get_nks(), - this->pw_rho, this->pw_big); } diff --git a/source/source_esolver/esolver_ks.cpp b/source/source_esolver/esolver_ks.cpp index dc2d2b0d8b..f291d22796 100644 --- a/source/source_esolver/esolver_ks.cpp +++ b/source/source_esolver/esolver_ks.cpp @@ -105,6 +105,7 @@ void ESolver_KS::before_all_runners(UnitCell& ucell, const Input_para //! 12) read in charge density, mohan add 2025-11-28 //! Inititlize the charge density. + this->chr.set_rhopw(this->pw_rhod); // mohan add 20251130 this->chr.allocate(inp.nspin); // mohan move this from setup_estate_pw, 20251128 this->chr.init_rho(ucell, this->Pgrid, this->sf.strucFac, ucell.symm, &this->kv, this->pw_wfc); this->chr.check_rho(); // check the rho diff --git a/source/source_esolver/esolver_ks_lcao.cpp b/source/source_esolver/esolver_ks_lcao.cpp index d15664dd6e..3a46d3b505 100644 --- a/source/source_esolver/esolver_ks_lcao.cpp +++ b/source/source_esolver/esolver_ks_lcao.cpp @@ -54,7 +54,7 @@ void ESolver_KS_LCAO::before_all_runners(UnitCell& ucell, const Input_pa { // TK stands for double and std::complex? this->pelec = new elecstate::ElecStateLCAO(&(this->chr), &(this->kv), - this->kv.get_nks(), this->pw_rho, this->pw_big); + this->kv.get_nks(), this->pw_big); } // 3) read LCAO orbitals/projectors and construct the interpolation tables. diff --git a/source/source_estate/elecstate.cpp b/source/source_estate/elecstate.cpp index be409e403a..1831ed8fce 100644 --- a/source/source_estate/elecstate.cpp +++ b/source/source_estate/elecstate.cpp @@ -59,12 +59,11 @@ void ElecState::init_scf(const int istep, void ElecState::init_ks(Charge* chr_in, // pointer for class Charge const K_Vectors* klist_in, int nk_in, - ModulePW::PW_Basis* rhopw_in, const ModulePW::PW_Basis_Big* bigpw_in) { this->charge = chr_in; this->klist = klist_in; - this->charge->set_rhopw(rhopw_in); +// this->charge->set_rhopw(rhopw_in); // mohan comment out 20251130 this->bigpw = bigpw_in; // init nelec_spin with nelec and nupdown this->init_nelec_spin(); diff --git a/source/source_estate/elecstate.h b/source/source_estate/elecstate.h index 4ac3cb8f8a..1ed769a875 100644 --- a/source/source_estate/elecstate.h +++ b/source/source_estate/elecstate.h @@ -35,7 +35,6 @@ class ElecState void init_ks(Charge* chr_in, // pointer for class Charge const K_Vectors* klist_in, int nk_in, // number of k points - ModulePW::PW_Basis* rhopw_in, const ModulePW::PW_Basis_Big* bigpw_in); // return current electronic density rho, as a input for constructing Hamiltonian diff --git a/source/source_estate/elecstate_lcao.h b/source/source_estate/elecstate_lcao.h index 3cf06641e3..bf1f11e1f7 100644 --- a/source/source_estate/elecstate_lcao.h +++ b/source/source_estate/elecstate_lcao.h @@ -18,10 +18,9 @@ class ElecStateLCAO : public ElecState ElecStateLCAO(Charge* chr_in, const K_Vectors* klist_in, int nks_in, - ModulePW::PW_Basis* rhopw_in, ModulePW::PW_Basis_Big* bigpw_in) { - init_ks(chr_in, klist_in, nks_in, rhopw_in, bigpw_in); + init_ks(chr_in, klist_in, nks_in, bigpw_in); this->classname = "ElecStateLCAO"; } diff --git a/source/source_estate/elecstate_pw.cpp b/source/source_estate/elecstate_pw.cpp index 247227149e..2d24321f2a 100644 --- a/source/source_estate/elecstate_pw.cpp +++ b/source/source_estate/elecstate_pw.cpp @@ -17,7 +17,6 @@ ElecStatePW::ElecStatePW(ModulePW::PW_Basis_K* wfc_basis_in, K_Vectors* pkv_in, UnitCell* ucell_in, pseudopot_cell_vnl* ppcell_in, - ModulePW::PW_Basis* rhodpw_in, ModulePW::PW_Basis* rhopw_in, ModulePW::PW_Basis_Big* bigpw_in) : basis(wfc_basis_in) @@ -26,7 +25,7 @@ ElecStatePW::ElecStatePW(ModulePW::PW_Basis_K* wfc_basis_in, this->rhopw_smooth = rhopw_in; this->ppcell = ppcell_in; this->ucell = ucell_in; - this->init_ks(chr_in, pkv_in, pkv_in->get_nks(), rhodpw_in, bigpw_in); + this->init_ks(chr_in, pkv_in, pkv_in->get_nks(), bigpw_in); } template diff --git a/source/source_estate/elecstate_pw.h b/source/source_estate/elecstate_pw.h index 10b54676e6..f674beed89 100644 --- a/source/source_estate/elecstate_pw.h +++ b/source/source_estate/elecstate_pw.h @@ -24,7 +24,6 @@ class ElecStatePW : public ElecState K_Vectors* pkv_in, UnitCell* ucell_in, pseudopot_cell_vnl* ppcell_in, - ModulePW::PW_Basis* rhodpw_in, ModulePW::PW_Basis* rhopw_in, ModulePW::PW_Basis_Big* bigpw_in); diff --git a/source/source_estate/elecstate_pw_sdft.cpp b/source/source_estate/elecstate_pw_sdft.cpp index 4c04fbd886..1df5545cb5 100644 --- a/source/source_estate/elecstate_pw_sdft.cpp +++ b/source/source_estate/elecstate_pw_sdft.cpp @@ -42,4 +42,4 @@ template class ElecStatePW_SDFT, base_device::DEVICE_CPU>; #if ((defined __CUDA) || (defined __ROCM)) template class ElecStatePW_SDFT, base_device::DEVICE_GPU>; #endif -} // namespace elecstate \ No newline at end of file +} // namespace elecstate diff --git a/source/source_estate/elecstate_pw_sdft.h b/source/source_estate/elecstate_pw_sdft.h index 506cabdd89..0ffa00efc4 100644 --- a/source/source_estate/elecstate_pw_sdft.h +++ b/source/source_estate/elecstate_pw_sdft.h @@ -12,11 +12,10 @@ class ElecStatePW_SDFT : public ElecStatePW K_Vectors* pkv_in, UnitCell* ucell_in, pseudopot_cell_vnl* ppcell_in, - ModulePW::PW_Basis* rhodpw_in, ModulePW::PW_Basis* rhopw_in, ModulePW::PW_Basis_Big* bigpw_in) : ElecStatePW(wfc_basis_in, chr_in, pkv_in, ucell_in, ppcell_in, rhodpw_in, rhopw_in, bigpw_in) + Device>(wfc_basis_in, chr_in, pkv_in, ucell_in, ppcell_in, rhopw_in, bigpw_in) { this->classname = "ElecStatePW_SDFT"; } diff --git a/source/source_estate/setup_estate_pw.cpp b/source/source_estate/setup_estate_pw.cpp index bf96f04f81..5daa7be1b5 100644 --- a/source/source_estate/setup_estate_pw.cpp +++ b/source/source_estate/setup_estate_pw.cpp @@ -28,14 +28,12 @@ void elecstate::setup_estate_pw(UnitCell& ucell, // unitcell { //! SDFT only supports double precision currently pelec = new elecstate::ElecStatePW_SDFT, Device>(pw_wfc, - &chr, &kv, &ucell, &ppcell, - pw_rhod, pw_rho, pw_big); + &chr, &kv, &ucell, &ppcell, pw_rho, pw_big); } else { pelec = new elecstate::ElecStatePW(pw_wfc, - &chr, &kv, &ucell, &ppcell, - pw_rhod, pw_rho, pw_big); + &chr, &kv, &ucell, &ppcell, pw_rho, pw_big); } } diff --git a/source/source_estate/test/elecstate_base_test.cpp b/source/source_estate/test/elecstate_base_test.cpp index 72b9da750e..8cc19b63b4 100644 --- a/source/source_estate/test/elecstate_base_test.cpp +++ b/source/source_estate/test/elecstate_base_test.cpp @@ -197,11 +197,10 @@ TEST_F(ElecStateTest, Constructor) TEST_F(ElecStateTest, InitKS) { Charge* charge = new Charge; - ModulePW::PW_Basis* rhopw = new ModulePW::PW_Basis; ModulePW::PW_Basis_Big* bigpw = new ModulePW::PW_Basis_Big; K_Vectors* klist = new K_Vectors; int nk = 1; - EXPECT_NO_THROW(elecstate->init_ks(charge, klist, nk, rhopw, bigpw)); + EXPECT_NO_THROW(elecstate->init_ks(charge, klist, nk, bigpw)); EXPECT_EQ(elecstate->charge, charge); EXPECT_EQ(elecstate->bigpw, bigpw); EXPECT_EQ(elecstate->klist, klist); @@ -211,14 +210,12 @@ TEST_F(ElecStateTest, InitKS) EXPECT_EQ(elecstate->wg.nc, PARAM.input.nbands); delete klist; delete bigpw; - delete rhopw; delete charge; } TEST_F(ElecStateTest, GetRho) { Charge* charge = new Charge; - ModulePW::PW_Basis* rhopw = new ModulePW::PW_Basis; ModulePW::PW_Basis_Big* bigpw = new ModulePW::PW_Basis_Big; K_Vectors* klist = new K_Vectors; int nk = 1; @@ -232,7 +229,7 @@ TEST_F(ElecStateTest, GetRho) charge->rho[i][j] = 1.0; } } - elecstate->init_ks(charge, klist, nk, rhopw, bigpw); + elecstate->init_ks(charge, klist, nk, bigpw); EXPECT_EQ(elecstate->getRho(0), &(charge->rho[0][0])); EXPECT_EQ(elecstate->getRho(0)[nrxx - 1], 1.0); for (int i = 0; i < PARAM.input.nspin; ++i) @@ -242,7 +239,6 @@ TEST_F(ElecStateTest, GetRho) delete[] charge->rho; delete klist; delete bigpw; - delete rhopw; delete charge; } diff --git a/source/source_estate/test/elecstate_pw_test.cpp b/source/source_estate/test/elecstate_pw_test.cpp index 75c4e46329..72fa56375b 100644 --- a/source/source_estate/test/elecstate_pw_test.cpp +++ b/source/source_estate/test/elecstate_pw_test.cpp @@ -240,7 +240,6 @@ TEST_F(ElecStatePWTest, ConstructorDouble) klist, ucell, ppcell, - rhodpw, rhopw, bigpw); EXPECT_EQ(elecstate_pw_d->classname, "ElecStatePW"); @@ -256,7 +255,6 @@ TEST_F(ElecStatePWTest, ConstructorSingle) klist, ucell, ppcell, - rhodpw, rhopw, bigpw); EXPECT_EQ(elecstate_pw_s->classname, "ElecStatePW"); @@ -274,7 +272,6 @@ TEST_F(ElecStatePWTest, InitRhoDataDouble) klist, ucell, ppcell, - rhodpw, rhopw, bigpw); elecstate_pw_d->init_rho_data(); @@ -294,7 +291,6 @@ TEST_F(ElecStatePWTest, InitRhoDataSingle) klist, ucell, ppcell, - rhodpw, rhopw, bigpw); elecstate_pw_s->init_rho_data(); @@ -311,7 +307,6 @@ TEST_F(ElecStatePWTest, ParallelKDouble) klist, ucell, ppcell, - rhodpw, rhopw, bigpw); EXPECT_NO_THROW(elecstate_pw_d->parallelK()); @@ -325,7 +320,6 @@ TEST_F(ElecStatePWTest, ParallelKSingle) klist, ucell, ppcell, - rhodpw, rhopw, bigpw); EXPECT_NO_THROW(elecstate_pw_s->parallelK()); diff --git a/source/source_hsolver/test/hsolver_supplementary_mock.h b/source/source_hsolver/test/hsolver_supplementary_mock.h index b6beb9cb2d..3c3c500194 100644 --- a/source/source_hsolver/test/hsolver_supplementary_mock.h +++ b/source/source_hsolver/test/hsolver_supplementary_mock.h @@ -33,7 +33,6 @@ void ElecState::init_scf(const int istep, void ElecState::init_ks(Charge* chg_in, // pointer for class Charge const K_Vectors* klist_in, int nk_in, - ModulePW::PW_Basis* rhopw_in, const ModulePW::PW_Basis_Big* bigpw_in) { return; @@ -45,7 +44,6 @@ ElecStatePW::ElecStatePW(ModulePW::PW_Basis_K* wfc_basis_in, K_Vectors* pkv_in, UnitCell* ucell_in, pseudopot_cell_vnl* ppcell_in, - ModulePW::PW_Basis* rhodpw_in, ModulePW::PW_Basis* rhopw_in, ModulePW::PW_Basis_Big* bigpw_in) : basis(wfc_basis_in) diff --git a/source/source_hsolver/test/test_hsolver_sdft.cpp b/source/source_hsolver/test/test_hsolver_sdft.cpp index 4118ba7bb7..7ab1464195 100644 --- a/source/source_hsolver/test/test_hsolver_sdft.cpp +++ b/source/source_hsolver/test/test_hsolver_sdft.cpp @@ -262,7 +262,7 @@ namespace ModulePW { class TestHSolverPW_SDFT : public ::testing::Test { public: - TestHSolverPW_SDFT() : stoche(8, 1, 0, 0), elecstate_test(nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr) + TestHSolverPW_SDFT() : stoche(8, 1, 0, 0), elecstate_test(nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr) { } ModulePW::PW_Basis_K pwbk; @@ -408,4 +408,4 @@ int main(int argc, char** argv) return result; } -#endif \ No newline at end of file +#endif From 1c576ab02996ccf319b369c31a3abd9fc37180e7 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Sun, 30 Nov 2025 09:39:05 +0800 Subject: [PATCH 19/36] fix bug about two allocations of charge class --- source/source_estate/module_dm/density_matrix.cpp | 4 ++-- source/source_lcao/LCAO_set.cpp | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/source/source_estate/module_dm/density_matrix.cpp b/source/source_estate/module_dm/density_matrix.cpp index 8dd87e73c4..7282226a84 100644 --- a/source/source_estate/module_dm/density_matrix.cpp +++ b/source/source_estate/module_dm/density_matrix.cpp @@ -29,7 +29,7 @@ template DensityMatrix::DensityMatrix(const Parallel_Orbitals* paraV_in, const int nspin, const std::vector>& kvec_d, const int nk) : _paraV(paraV_in), _nspin(nspin), _kvec_d(kvec_d), _nk((nk > 0 && nk <= _kvec_d.size()) ? nk : _kvec_d.size()) { - ModuleBase::TITLE("DensityMatrix", "DensityMatrix-MK"); + ModuleBase::TITLE("DensityMatrix", "resize_DMK"); const int nks = _nk * _nspin; this->_DMK.resize(nks); for (int ik = 0; ik < nks; ik++) @@ -42,7 +42,7 @@ DensityMatrix::DensityMatrix(const Parallel_Orbitals* paraV_in, const in template DensityMatrix::DensityMatrix(const Parallel_Orbitals* paraV_in, const int nspin) :_paraV(paraV_in), _nspin(nspin), _kvec_d({ ModuleBase::Vector3(0,0,0) }), _nk(1) { - ModuleBase::TITLE("DensityMatrix", "DensityMatrix-GO"); + ModuleBase::TITLE("DensityMatrix", "resize_gamma"); this->_DMK.resize(_nspin); for (int ik = 0; ik < this->_nspin; ik++) { diff --git a/source/source_lcao/LCAO_set.cpp b/source/source_lcao/LCAO_set.cpp index 2c87852fde..ebb296ffd2 100644 --- a/source/source_lcao/LCAO_set.cpp +++ b/source/source_lcao/LCAO_set.cpp @@ -39,9 +39,6 @@ void LCAO_domain::set_psi_occ_dm_chg( //! 4) init DMK, but DMR is constructed in before_scf() dmat.allocate_dm(&kv, &pv, inp.nspin); - //! 5) init charge density - chr.allocate(inp.nspin); - ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "CHARGE"); return; From 2b2580cad6b3fc487591abf302f296bb00654eed Mon Sep 17 00:00:00 2001 From: mohanchen Date: Sun, 30 Nov 2025 14:33:55 +0800 Subject: [PATCH 20/36] fix a bug in OFDFT --- source/source_esolver/esolver_of.cpp | 12 ++++++++++-- source/source_esolver/esolver_of_tool.cpp | 1 - 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/source/source_esolver/esolver_of.cpp b/source/source_esolver/esolver_of.cpp index e76c725546..396053f29e 100644 --- a/source/source_esolver/esolver_of.cpp +++ b/source/source_esolver/esolver_of.cpp @@ -97,13 +97,19 @@ void ESolver_OF::before_all_runners(UnitCell& ucell, const Input_para& inp) // initialize the real-space uniform grid for FFT and parallel // distribution of plane waves - Pgrid.init(pw_rho->nx, pw_rho->ny, pw_rho->nz, pw_rho->nplane, + this->Pgrid.init(pw_rho->nx, pw_rho->ny, pw_rho->nz, pw_rho->nplane, pw_rho->nrxx, pw_big->nbz, pw_big->bz); // mohan add 2010-07-22, update 2011-05-04 // Calculate Structure factor - sf.setup(&ucell, Pgrid, pw_rho); + this->sf.setup(&ucell, this->Pgrid, this->pw_rho); ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "INIT BASIS"); + // mohan add 20251130 + this->chr.set_rhopw(this->pw_rho); + this->chr.allocate(inp.nspin); + this->chr.init_rho(ucell, this->Pgrid, this->sf.strucFac, ucell.symm, &this->kv); + this->chr.check_rho(); // check the rho + // initialize local pseudopotential this->locpp.init_vloc(ucell,pw_rho); ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "LOCAL POTENTIAL"); @@ -210,6 +216,8 @@ void ESolver_OF::before_opt(const int istep, UnitCell& ucell) //! 1) call before_scf() of ESolver_FP ESolver_FP::before_scf(ucell, istep); + + if (ucell.cell_parameter_updated) { this->dV_ = ucell.omega / this->pw_rho->nxyz; diff --git a/source/source_esolver/esolver_of_tool.cpp b/source/source_esolver/esolver_of_tool.cpp index c7f8a17135..62aa9aa0b4 100644 --- a/source/source_esolver/esolver_of_tool.cpp +++ b/source/source_esolver/esolver_of_tool.cpp @@ -20,7 +20,6 @@ void ESolver_OF::init_elecstate(UnitCell& ucell) if (this->pelec == nullptr) { this->pelec = new elecstate::ElecState((Charge*)(&chr), this->pw_rho, pw_big); - this->chr.allocate(PARAM.inp.nspin); } delete this->pelec->pot; From c36a189cc025e91d82ee0b7749f0416ec22400d5 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Sun, 30 Nov 2025 14:49:13 +0800 Subject: [PATCH 21/36] move the common parts in esolver_ks and esolver_of to esolver_fp --- source/source_esolver/esolver_fp.cpp | 39 +++++++++++++++++++++++----- source/source_esolver/esolver_ks.cpp | 27 ++----------------- source/source_esolver/esolver_of.cpp | 27 ------------------- 3 files changed, 34 insertions(+), 59 deletions(-) diff --git a/source/source_esolver/esolver_fp.cpp b/source/source_esolver/esolver_fp.cpp index afe1fd6e78..4f3bc200ab 100644 --- a/source/source_esolver/esolver_fp.cpp +++ b/source/source_esolver/esolver_fp.cpp @@ -41,24 +41,49 @@ void ESolver_FP::before_all_runners(UnitCell& ucell, const Input_para& inp) { ModuleBase::TITLE("ESolver_FP", "before_all_runners"); - //! read pseudopotentials + //! 1) read pseudopotentials elecstate::read_pseudo(GlobalV::ofs_running, ucell); - // setup pw_rho, pw_rhod, pw_big, sf, and read_pseudopotentials + //! 2) setup pw_rho, pw_rhod, pw_big, sf, and read_pseudopotentials pw::setup_pwrho(ucell, PARAM.globalv.double_grid, this->pw_rho_flag, - this->pw_rho, this->pw_rhod, this->pw_big, - this->classname, inp); + this->pw_rho, this->pw_rhod, this->pw_big, this->classname, inp); - // setup structure factors + //! 3) setup structure factors this->sf.set(this->pw_rhod, inp.nbspline); - // write geometry file + //! 4) write geometry file ModuleIO::CifParser::write(PARAM.globalv.global_out_dir + "STRU.cif", ucell, "# Generated by ABACUS ModuleIO::CifParser", "data_?"); - // init charge extrapolation + //! 5) init charge extrapolation this->CE.Init_CE(inp.nspin, ucell.nat, this->pw_rhod->nrxx, inp.chg_extrap); + //! 6) symmetry analysis should be performed every time the cell is changed + if (ModuleSymmetry::Symmetry::symm_flag == 1) + { + ucell.symm.analy_sys(ucell.lat, ucell.st, ucell.atoms, GlobalV::ofs_running); + ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "SYMMETRY"); + } + + //! 7) setup k points in the Brillouin zone according to symmetry. + this->kv.set(ucell,ucell.symm, inp.kpoint_file, inp.nspin, ucell.G, ucell.latvec, GlobalV::ofs_running); + ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "INIT K-POINTS"); + + //! 8) print information + ModuleIO::print_parameters(ucell, this->kv, inp); + + //! 9) parallel of FFT grid + this->Pgrid.init(this->pw_rhod->nx, this->pw_rhod->ny, this->pw_rhod->nz, + this->pw_rhod->nplane, this->pw_rhod->nrxx, pw_big->nbz, pw_big->bz); + + //! 10) calculate the structure factor + this->sf.setup(&ucell, Pgrid, this->pw_rhod); + + //! 11) initialize the charge density + this->chr.set_rhopw(this->pw_rhod); // mohan add 20251130 + this->chr.allocate(inp.nspin); // mohan move this from setup_estate_pw, 20251128 + + return; } diff --git a/source/source_esolver/esolver_ks.cpp b/source/source_esolver/esolver_ks.cpp index f291d22796..bdc1d0b12b 100644 --- a/source/source_esolver/esolver_ks.cpp +++ b/source/source_esolver/esolver_ks.cpp @@ -79,34 +79,11 @@ void ESolver_KS::before_all_runners(UnitCell& ucell, const Input_para p_chgmix->init_mixing(); - //! 6) symmetry analysis should be performed every time the cell is changed - if (ModuleSymmetry::Symmetry::symm_flag == 1) - { - ucell.symm.analy_sys(ucell.lat, ucell.st, ucell.atoms, GlobalV::ofs_running); - ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "SYMMETRY"); - } - - //! 7) setup k points in the Brillouin zone according to symmetry. - this->kv.set(ucell,ucell.symm, inp.kpoint_file, inp.nspin, ucell.G, ucell.latvec, GlobalV::ofs_running); - ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "INIT K-POINTS"); - - //! 8) print information - ModuleIO::print_parameters(ucell, this->kv, inp); - - //! 9) setup plane wave for electronic wave functions + //! 6) setup plane wave for electronic wave functions pw::setup_pwwfc(inp, ucell, *this->pw_rho, this->kv, this->pw_wfc); - //! 10) parallel of FFT grid - this->Pgrid.init(this->pw_rhod->nx, this->pw_rhod->ny, this->pw_rhod->nz, - this->pw_rhod->nplane, this->pw_rhod->nrxx, pw_big->nbz, pw_big->bz); - - //! 11) calculate the structure factor - this->sf.setup(&ucell, Pgrid, this->pw_rhod); - - //! 12) read in charge density, mohan add 2025-11-28 + //! 7) read in charge density, mohan add 2025-11-28 //! Inititlize the charge density. - this->chr.set_rhopw(this->pw_rhod); // mohan add 20251130 - this->chr.allocate(inp.nspin); // mohan move this from setup_estate_pw, 20251128 this->chr.init_rho(ucell, this->Pgrid, this->sf.strucFac, ucell.symm, &this->kv, this->pw_wfc); this->chr.check_rho(); // check the rho diff --git a/source/source_esolver/esolver_of.cpp b/source/source_esolver/esolver_of.cpp index 396053f29e..e8142b1a48 100644 --- a/source/source_esolver/esolver_of.cpp +++ b/source/source_esolver/esolver_of.cpp @@ -80,33 +80,6 @@ void ESolver_OF::before_all_runners(UnitCell& ucell, const Input_para& inp) ModuleBase::WARNING_QUIT("esolver_of", "meta-GGA and Hybrid functionals are not supported by OFDFT."); } - // symmetry analysis should be performed every time the cell is changed - if (ModuleSymmetry::Symmetry::symm_flag == 1) - { - ucell.symm.analy_sys(ucell.lat, ucell.st, ucell.atoms, GlobalV::ofs_running); - ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "SYMMETRY"); - } - - // Setup the k points according to symmetry. - kv.set(ucell,ucell.symm, inp.kpoint_file, inp.nspin, ucell.G, ucell.latvec, GlobalV::ofs_running); - ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "INIT K-POINTS"); - - // print information - // mohan add 2021-01-30 - ModuleIO::print_parameters(ucell, kv, inp); - - // initialize the real-space uniform grid for FFT and parallel - // distribution of plane waves - this->Pgrid.init(pw_rho->nx, pw_rho->ny, pw_rho->nz, pw_rho->nplane, - pw_rho->nrxx, pw_big->nbz, pw_big->bz); // mohan add 2010-07-22, update 2011-05-04 - - // Calculate Structure factor - this->sf.setup(&ucell, this->Pgrid, this->pw_rho); - ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "INIT BASIS"); - - // mohan add 20251130 - this->chr.set_rhopw(this->pw_rho); - this->chr.allocate(inp.nspin); this->chr.init_rho(ucell, this->Pgrid, this->sf.strucFac, ucell.symm, &this->kv); this->chr.check_rho(); // check the rho From 0938f5a6b64a1868969ae2d64959a73930c2c816 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Sun, 30 Nov 2025 14:57:56 +0800 Subject: [PATCH 22/36] small updates of fp and ks esolvers --- source/source_esolver/esolver_fp.cpp | 2 ++ source/source_esolver/esolver_ks.cpp | 51 ++++++++-------------------- 2 files changed, 16 insertions(+), 37 deletions(-) diff --git a/source/source_esolver/esolver_fp.cpp b/source/source_esolver/esolver_fp.cpp index 4f3bc200ab..de55f51194 100644 --- a/source/source_esolver/esolver_fp.cpp +++ b/source/source_esolver/esolver_fp.cpp @@ -65,6 +65,8 @@ void ESolver_FP::before_all_runners(UnitCell& ucell, const Input_para& inp) ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "SYMMETRY"); } + ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "SETUP UNITCELL"); + //! 7) setup k points in the Brillouin zone according to symmetry. this->kv.set(ucell,ucell.symm, inp.kpoint_file, inp.nspin, ucell.G, ucell.latvec, GlobalV::ofs_running); ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "INIT K-POINTS"); diff --git a/source/source_esolver/esolver_ks.cpp b/source/source_esolver/esolver_ks.cpp index bdc1d0b12b..4845426579 100644 --- a/source/source_esolver/esolver_ks.cpp +++ b/source/source_esolver/esolver_ks.cpp @@ -62,27 +62,22 @@ void ESolver_KS::before_all_runners(UnitCell& ucell, const Input_para // cell_factor this->ppcell.cell_factor = inp.cell_factor; - //! 3) setup charge mixing - p_chgmix = new Charge_Mixing(); - p_chgmix->set_rhopw(this->pw_rho, this->pw_rhod); - - ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "SETUP UNITCELL"); - - //! 4) setup Exc for the first element '0' (all elements have same exc) + //! 3) setup Exc for the first element '0' (all elements have same exc) XC_Functional::set_xc_type(ucell.atoms[0].ncpp.xc_func); GlobalV::ofs_running<set_rhopw(this->pw_rho, this->pw_rhod); p_chgmix->set_mixing(inp.mixing_mode, inp.mixing_beta, inp.mixing_ndim, inp.mixing_gg0, inp.mixing_tau, inp.mixing_beta_mag, inp.mixing_gg0_mag, inp.mixing_gg0_min, inp.mixing_angle, inp.mixing_dmr, ucell.omega, ucell.tpiba); - p_chgmix->init_mixing(); - //! 6) setup plane wave for electronic wave functions + //! 5) setup plane wave for electronic wave functions pw::setup_pwwfc(inp, ucell, *this->pw_rho, this->kv, this->pw_wfc); - //! 7) read in charge density, mohan add 2025-11-28 + //! 6) read in charge density, mohan add 2025-11-28 //! Inititlize the charge density. this->chr.init_rho(ucell, this->Pgrid, this->sf.strucFac, ucell.symm, &this->kv, this->pw_wfc); this->chr.check_rho(); // check the rho @@ -100,20 +95,14 @@ void ESolver_KS::hamilt2rho(UnitCell& ucell, const int istep, const i this->hamilt2rho_single(ucell, istep, iter, diag_ethr); // 2) for MPI: STOGROUP? need to rewrite - // It may be changed when more clever parallel algorithm is - // put forward. - // When parallel algorithm for bands are adopted. Density will only be - // treated in the first group. - //(Different ranks should have abtained the same, but small differences - // always exist in practice.) + // It may be changed when more clever parallel algorithm is put forward. + // When parallel algorithm for bands are adopted. Density will only be treated in the first group. + //(Different ranks should have abtained the same, but small differences always exist in practice.) // Maybe in the future, density and wavefunctions should use different // parallel algorithms, in which they do not occupy all processors, for // example wavefunctions uses 20 processors while density uses 10. if (PARAM.globalv.ks_run) { - // double drho = this->estate.caldr2(); - // EState should be used after it is constructed. - drho = p_chgmix->get_drho(&this->chr, PARAM.inp.nelec); hsolver_error = 0.0; if (iter == 1 && PARAM.inp.calculation != "nscf") @@ -125,23 +114,16 @@ void ESolver_KS::hamilt2rho(UnitCell& ucell, const int istep, const i // so a more precise HSolver should be executed. if (hsolver_error > drho) { - diag_ethr = hsolver::reset_diag_ethr(GlobalV::ofs_running, - PARAM.inp.basis_type, - PARAM.inp.esolver_type, - PARAM.inp.precision, - hsolver_error, - drho, - diag_ethr, - PARAM.inp.nelec); + diag_ethr = hsolver::reset_diag_ethr(GlobalV::ofs_running, PARAM.inp.basis_type, + PARAM.inp.esolver_type, PARAM.inp.precision, hsolver_error, + drho, diag_ethr, PARAM.inp.nelec); this->hamilt2rho_single(ucell, istep, iter, diag_ethr); drho = p_chgmix->get_drho(&this->chr, PARAM.inp.nelec); hsolver_error = hsolver::cal_hsolve_error(PARAM.inp.basis_type, - PARAM.inp.esolver_type, - diag_ethr, - PARAM.inp.nelec); + PARAM.inp.esolver_type, diag_ethr, PARAM.inp.nelec); } } } @@ -153,22 +135,17 @@ void ESolver_KS::runner(UnitCell& ucell, const int istep) ModuleBase::TITLE("ESolver_KS", "runner"); ModuleBase::timer::tick(this->classname, "runner"); - //---------------------------------------------------------------- // 1) before_scf (electronic iteration loops) - //---------------------------------------------------------------- this->before_scf(ucell, istep); ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "INIT SCF"); - //---------------------------------------------------------------- // 2) SCF iterations - //---------------------------------------------------------------- bool conv_esolver = false; this->niter = this->maxniter; this->diag_ethr = PARAM.inp.pw_diag_thr; this->scf_nmax_flag = false; // mohan add 2025-09-21 for (int iter = 1; iter <= this->maxniter; ++iter) { - // mohan add 2025-09-21 if(iter == this->maxniter) { this->scf_nmax_flag=true; From ab23e5edfc1bc7267d981bba2080ec4b1813e7e8 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Sun, 30 Nov 2025 19:25:34 +0800 Subject: [PATCH 23/36] update double xc --- source/source_esolver/esolver_double_xc.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/source_esolver/esolver_double_xc.cpp b/source/source_esolver/esolver_double_xc.cpp index b137427851..cc5328c3c9 100644 --- a/source/source_esolver/esolver_double_xc.cpp +++ b/source/source_esolver/esolver_double_xc.cpp @@ -86,7 +86,10 @@ void ESolver_DoubleXC::before_all_runners(UnitCell& ucell, const Input_p this->dmat_base.allocate_dm(&this->kv, &this->pv, PARAM.inp.nspin); // 10) inititlize the charge density - this->chr_base.allocate(PARAM.inp.nspin); + this->chr_base.set_rhopw(this->pw_rhod); // mohan add 20251130 + this->chr_base.allocate(PARAM.inp.nspin); + this->chr_base.init_rho(ucell, this->Pgrid, this->sf.strucFac, ucell.symm, &this->kv); + this->chr_base.check_rho(); // 11) initialize the potential if (this->pelec_base->pot == nullptr) From 1058756920a2c11f4a0b8b79f7fc97ac53383711 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Tue, 2 Dec 2025 14:12:45 +0800 Subject: [PATCH 24/36] fix bug about allocation of charge density --- source/source_esolver/esolver_fp.cpp | 7 ++++++- source/source_esolver/esolver_ks.cpp | 4 ++-- source/source_esolver/esolver_of.cpp | 2 +- source/source_estate/module_charge/charge.cpp | 2 ++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/source/source_esolver/esolver_fp.cpp b/source/source_esolver/esolver_fp.cpp index de55f51194..6a6f09ed98 100644 --- a/source/source_esolver/esolver_fp.cpp +++ b/source/source_esolver/esolver_fp.cpp @@ -81,7 +81,12 @@ void ESolver_FP::before_all_runners(UnitCell& ucell, const Input_para& inp) //! 10) calculate the structure factor this->sf.setup(&ucell, Pgrid, this->pw_rhod); - //! 11) initialize the charge density + //! 11) setup the xc functional + XC_Functional::set_xc_type(ucell.atoms[0].ncpp.xc_func); + GlobalV::ofs_running<chr.set_rhopw(this->pw_rhod); // mohan add 20251130 this->chr.allocate(inp.nspin); // mohan move this from setup_estate_pw, 20251128 diff --git a/source/source_esolver/esolver_ks.cpp b/source/source_esolver/esolver_ks.cpp index 4845426579..604c1569cc 100644 --- a/source/source_esolver/esolver_ks.cpp +++ b/source/source_esolver/esolver_ks.cpp @@ -63,8 +63,8 @@ void ESolver_KS::before_all_runners(UnitCell& ucell, const Input_para this->ppcell.cell_factor = inp.cell_factor; //! 3) setup Exc for the first element '0' (all elements have same exc) - XC_Functional::set_xc_type(ucell.atoms[0].ncpp.xc_func); - GlobalV::ofs_running< 2) { diff --git a/source/source_estate/module_charge/charge.cpp b/source/source_estate/module_charge/charge.cpp index 326af9d57b..9dfba3782a 100644 --- a/source/source_estate/module_charge/charge.cpp +++ b/source/source_estate/module_charge/charge.cpp @@ -641,6 +641,8 @@ void Charge::save_rho_before_sum_band() double Charge::cal_rho2ne(const double* rho_in) const { + assert(this->rhopw->nxyz > 0); // mohan add 2025-12-02 + double ne = 0.0; for (int ir = 0; ir < this->rhopw->nrxx; ir++) { From caf00459976d129e5ec976c1bc95d4840760f0a5 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Tue, 2 Dec 2025 15:15:08 +0800 Subject: [PATCH 25/36] delete istep in init_pot and init_scf --- source/source_esolver/esolver_double_xc.cpp | 2 +- source/source_esolver/esolver_ks_lcao.cpp | 2 +- source/source_esolver/esolver_ks_lcao_tddft.cpp | 2 +- source/source_esolver/esolver_of.cpp | 4 ++-- source/source_esolver/lcao_others.cpp | 2 +- source/source_estate/elecstate.cpp | 15 ++------------- source/source_estate/elecstate.h | 4 +--- source/source_estate/module_pot/potential_new.cpp | 3 +-- source/source_estate/module_pot/potential_new.h | 2 +- source/source_pw/module_pwdft/setup_pot.cpp | 9 ++------- 10 files changed, 13 insertions(+), 32 deletions(-) diff --git a/source/source_esolver/esolver_double_xc.cpp b/source/source_esolver/esolver_double_xc.cpp index cc5328c3c9..a8a98fcd90 100644 --- a/source/source_esolver/esolver_double_xc.cpp +++ b/source/source_esolver/esolver_double_xc.cpp @@ -156,7 +156,7 @@ void ESolver_DoubleXC::before_scf(UnitCell& ucell, const int istep) } XC_Functional::set_xc_type(PARAM.inp.deepks_out_base); - this->pelec_base->init_scf(istep, ucell, this->Pgrid, this->sf.strucFac, this->locpp.numeric, ucell.symm); + this->pelec_base->init_scf(ucell, this->Pgrid, this->sf.strucFac, this->locpp.numeric, ucell.symm); XC_Functional::set_xc_type(ucell.atoms[0].ncpp.xc_func); // DMR should be same size with Hamiltonian(R) diff --git a/source/source_esolver/esolver_ks_lcao.cpp b/source/source_esolver/esolver_ks_lcao.cpp index 3a46d3b505..8820ac7161 100644 --- a/source/source_esolver/esolver_ks_lcao.cpp +++ b/source/source_esolver/esolver_ks_lcao.cpp @@ -161,7 +161,7 @@ void ESolver_KS_LCAO::before_scf(UnitCell& ucell, const int istep) this->exx_nao.before_scf(ucell, this->kv, orb_, this->p_chgmix, istep, PARAM.inp); // 12) init_scf, should be before_scf? mohan add 2025-03-10 - this->pelec->init_scf(istep, ucell, this->Pgrid, this->sf.strucFac, this->locpp.numeric, ucell.symm); + this->pelec->init_scf(ucell, this->Pgrid, this->sf.strucFac, this->locpp.numeric, ucell.symm); // 13) initalize DM(R), which has the same size with Hamiltonian(R) auto* hamilt_lcao = dynamic_cast*>(this->p_hamilt); diff --git a/source/source_esolver/esolver_ks_lcao_tddft.cpp b/source/source_esolver/esolver_ks_lcao_tddft.cpp index 3860856bd7..f674368ad1 100644 --- a/source/source_esolver/esolver_ks_lcao_tddft.cpp +++ b/source/source_esolver/esolver_ks_lcao_tddft.cpp @@ -133,7 +133,7 @@ void ESolver_KS_LCAO_TDDFT::runner(UnitCell& ucell, const int istep) GlobalV::ofs_running, GlobalV::ofs_warning); // need to test if correct when estep>0 - this->pelec->init_scf(totstep, ucell, this->Pgrid, this->sf.strucFac, this->locpp.numeric, ucell.symm); + this->pelec->init_scf(ucell, this->Pgrid, this->sf.strucFac, this->locpp.numeric, ucell.symm); if (totstep <= PARAM.inp.td_tend + 1) { diff --git a/source/source_esolver/esolver_of.cpp b/source/source_esolver/esolver_of.cpp index fef5e5fb14..db4d7c19a2 100644 --- a/source/source_esolver/esolver_of.cpp +++ b/source/source_esolver/esolver_of.cpp @@ -92,7 +92,7 @@ void ESolver_OF::before_all_runners(UnitCell& ucell, const Input_para& inp) this->init_elecstate(ucell); // calculate the total local pseudopotential in real space - this->pelec->init_scf(0, ucell, Pgrid, sf.strucFac, locpp.numeric, ucell.symm); // atomic_rho, v_of_rho, set_vrs + this->pelec->init_scf(ucell, Pgrid, sf.strucFac, locpp.numeric, ucell.symm); // atomic_rho, v_of_rho, set_vrs // liuyu move here 2023-10-09 // D in uspp need vloc, thus behind init_scf() @@ -234,7 +234,7 @@ void ESolver_OF::before_opt(const int istep, UnitCell& ucell) } } - this->pelec->init_scf(istep, ucell, Pgrid, sf.strucFac, locpp.numeric, ucell.symm); + this->pelec->init_scf(ucell, Pgrid, sf.strucFac, locpp.numeric, ucell.symm); Symmetry_rho srho; for (int is = 0; is < PARAM.inp.nspin; is++) diff --git a/source/source_esolver/lcao_others.cpp b/source/source_esolver/lcao_others.cpp index 0c404dbbcf..32934463b8 100644 --- a/source/source_esolver/lcao_others.cpp +++ b/source/source_esolver/lcao_others.cpp @@ -219,7 +219,7 @@ void ESolver_KS_LCAO::others(UnitCell& ucell, const int istep) elecstate::cal_ux(ucell); // pelec should be initialized before these calculations - this->pelec->init_scf(istep, ucell, this->Pgrid, this->sf.strucFac, this->locpp.numeric, ucell.symm); + this->pelec->init_scf(ucell, this->Pgrid, this->sf.strucFac, this->locpp.numeric, ucell.symm); // self consistent calculations for electronic ground state if (cal_type == "get_pchg") diff --git a/source/source_estate/elecstate.cpp b/source/source_estate/elecstate.cpp index 1831ed8fce..0cb3ef066f 100644 --- a/source/source_estate/elecstate.cpp +++ b/source/source_estate/elecstate.cpp @@ -27,8 +27,7 @@ void ElecState::init_nelec_spin() } } -void ElecState::init_scf(const int istep, - const UnitCell& ucell, +void ElecState::init_scf(const UnitCell& ucell, const Parallel_Grid& pgrid, const ModuleBase::ComplexMatrix& strucfac, const bool* numeric, @@ -38,21 +37,11 @@ void ElecState::init_scf(const int istep, //! core correction potential. this->charge->set_rho_core(ucell,strucfac, numeric); - //! other effective potentials need charge density, - // choose charge density from ionic step 0. -/* - if (istep == 0) - { - this->charge->init_rho(this->eferm,ucell, pgrid, strucfac, symm, (const void*)this->klist, wfcpw); - this->charge->check_rho(); // check the rho - } -*/ - //! renormalize the charge density this->charge->renormalize_rho(); //! initialize the potential - this->pot->init_pot(istep, this->charge); + this->pot->init_pot(this->charge); } diff --git a/source/source_estate/elecstate.h b/source/source_estate/elecstate.h index 1ed769a875..888b3b95dc 100644 --- a/source/source_estate/elecstate.h +++ b/source/source_estate/elecstate.h @@ -97,14 +97,12 @@ class ElecState /** * @brief Init rho_core, init rho, renormalize rho, init pot * - * @param istep i-th step * @param ucell unit cell * @param strucfac structure factor * @param symm symmetry * @param wfcpw PW basis for wave function if needed */ - void init_scf(const int istep, - const UnitCell& ucell, + void init_scf(const UnitCell& ucell, const Parallel_Grid& pgrid, const ModuleBase::ComplexMatrix& strucfac, const bool* numeric, diff --git a/source/source_estate/module_pot/potential_new.cpp b/source/source_estate/module_pot/potential_new.cpp index ba59b5e8ed..9026cd6b48 100644 --- a/source/source_estate/module_pot/potential_new.cpp +++ b/source/source_estate/module_pot/potential_new.cpp @@ -247,12 +247,11 @@ void Potential::cal_v_eff(const Charge*const chg, const UnitCell*const ucell, Mo ModuleBase::timer::tick("Potential", "cal_veff"); } -void Potential::init_pot(int istep, const Charge*const chg) +void Potential::init_pot(const Charge*const chg) { ModuleBase::TITLE("Potential", "init_pot"); ModuleBase::timer::tick("Potential", "init_pot"); - assert(istep >= 0); // fixed components only calculated in the beginning of SCF this->fixed_done = false; diff --git a/source/source_estate/module_pot/potential_new.h b/source/source_estate/module_pot/potential_new.h index 6ed7bdc93d..4aaadf698b 100644 --- a/source/source_estate/module_pot/potential_new.h +++ b/source/source_estate/module_pot/potential_new.h @@ -67,7 +67,7 @@ class Potential : public PotBase ~Potential(); // initialize potential when SCF begin - void init_pot(int istep, const Charge*const chg); + void init_pot(const Charge*const chg); // initialize potential components before SCF void pot_register(const std::vector& components_list); // update potential from current charge diff --git a/source/source_pw/module_pwdft/setup_pot.cpp b/source/source_pw/module_pwdft/setup_pot.cpp index 7a3b0c711a..5080e265f7 100644 --- a/source/source_pw/module_pwdft/setup_pot.cpp +++ b/source/source_pw/module_pwdft/setup_pot.cpp @@ -38,13 +38,8 @@ void pw::setup_pot(const int istep, //---------------------------------------------------------- //! 1) Renew local pseudopotential //---------------------------------------------------------- - pelec->init_scf(istep, - ucell, - para_grid, - sf.strucFac, - locpp.numeric, - ucell.symm, - (void*)pw_wfc); + pelec->init_scf(ucell, para_grid, sf.strucFac, + locpp.numeric, ucell.symm, (void*)pw_wfc); //---------------------------------------------------------- //! 2) Symmetrize the charge density (rho) From 43faa3d21fdb01c995f7299869ebbd4feebfc8bf Mon Sep 17 00:00:00 2001 From: mohanchen Date: Tue, 2 Dec 2025 15:34:09 +0800 Subject: [PATCH 26/36] add an input parameter in chr.allocate --- source/source_esolver/esolver_double_xc.cpp | 3 ++- source/source_esolver/esolver_fp.cpp | 3 ++- source/source_esolver/esolver_of.cpp | 5 ++-- source/source_esolver/esolver_of_tool.cpp | 3 ++- source/source_estate/elecstate.cpp | 1 - source/source_estate/module_charge/charge.cpp | 23 +++++++++++++++---- source/source_estate/module_charge/charge.h | 5 +++- .../module_charge/charge_mpi.cpp | 9 ++++---- .../module_lr/esolver_lrtd_lcao.cpp | 3 ++- 9 files changed, 38 insertions(+), 17 deletions(-) diff --git a/source/source_esolver/esolver_double_xc.cpp b/source/source_esolver/esolver_double_xc.cpp index a8a98fcd90..94ad1e209f 100644 --- a/source/source_esolver/esolver_double_xc.cpp +++ b/source/source_esolver/esolver_double_xc.cpp @@ -87,7 +87,8 @@ void ESolver_DoubleXC::before_all_runners(UnitCell& ucell, const Input_p // 10) inititlize the charge density this->chr_base.set_rhopw(this->pw_rhod); // mohan add 20251130 - this->chr_base.allocate(PARAM.inp.nspin); + const bool kin_den = this->chr_base.kin_density(); // mohan add 20251202 + this->chr_base.allocate(PARAM.inp.nspin, kin_den); this->chr_base.init_rho(ucell, this->Pgrid, this->sf.strucFac, ucell.symm, &this->kv); this->chr_base.check_rho(); diff --git a/source/source_esolver/esolver_fp.cpp b/source/source_esolver/esolver_fp.cpp index 6a6f09ed98..44596c99e5 100644 --- a/source/source_esolver/esolver_fp.cpp +++ b/source/source_esolver/esolver_fp.cpp @@ -88,7 +88,8 @@ void ESolver_FP::before_all_runners(UnitCell& ucell, const Input_para& inp) //! 11) initialize the charge density, we need to first set xc_type, // then we can call chr.allocate() this->chr.set_rhopw(this->pw_rhod); // mohan add 20251130 - this->chr.allocate(inp.nspin); // mohan move this from setup_estate_pw, 20251128 + const bool kin_den = this->chr.kin_density(); // mohan add 20251202 + this->chr.allocate(inp.nspin, kin_den); // mohan move this from setup_estate_pw, 20251128 return; diff --git a/source/source_esolver/esolver_of.cpp b/source/source_esolver/esolver_of.cpp index db4d7c19a2..a1a299d610 100644 --- a/source/source_esolver/esolver_of.cpp +++ b/source/source_esolver/esolver_of.cpp @@ -218,8 +218,9 @@ void ESolver_OF::before_opt(const int istep, UnitCell& ucell) delete this->ptemp_rho_; this->ptemp_rho_ = new Charge(); - this->ptemp_rho_->set_rhopw(this->pw_rho); - this->ptemp_rho_->allocate(PARAM.inp.nspin); + this->ptemp_rho_->set_rhopw(this->pw_rho); + const bool kin_den = this->ptemp_rho_->kin_density(); // mohan add 20251202 + this->ptemp_rho_->allocate(PARAM.inp.nspin, kin_den); for (int is = 0; is < PARAM.inp.nspin; ++is) { diff --git a/source/source_esolver/esolver_of_tool.cpp b/source/source_esolver/esolver_of_tool.cpp index 62aa9aa0b4..ab5b033e34 100644 --- a/source/source_esolver/esolver_of_tool.cpp +++ b/source/source_esolver/esolver_of_tool.cpp @@ -86,7 +86,8 @@ void ESolver_OF::allocate_array() delete this->ptemp_rho_; this->ptemp_rho_ = new Charge(); this->ptemp_rho_->set_rhopw(this->pw_rho); - this->ptemp_rho_->allocate(PARAM.inp.nspin); + const bool kin_den = this->ptemp_rho_->kin_density(); // mohan add 20251202 + this->ptemp_rho_->allocate(PARAM.inp.nspin, kin_den); this->theta_ = new double[PARAM.inp.nspin]; this->pdLdphi_ = new double*[PARAM.inp.nspin]; diff --git a/source/source_estate/elecstate.cpp b/source/source_estate/elecstate.cpp index 0cb3ef066f..5e2c6a8ced 100644 --- a/source/source_estate/elecstate.cpp +++ b/source/source_estate/elecstate.cpp @@ -52,7 +52,6 @@ void ElecState::init_ks(Charge* chr_in, // pointer for class Charge { this->charge = chr_in; this->klist = klist_in; -// this->charge->set_rhopw(rhopw_in); // mohan comment out 20251130 this->bigpw = bigpw_in; // init nelec_spin with nelec and nupdown this->init_nelec_spin(); diff --git a/source/source_estate/module_charge/charge.cpp b/source/source_estate/module_charge/charge.cpp index 9dfba3782a..7c8008c34d 100644 --- a/source/source_estate/module_charge/charge.cpp +++ b/source/source_estate/module_charge/charge.cpp @@ -53,6 +53,19 @@ void Charge::set_rhopw(ModulePW::PW_Basis* rhopw_in) this->rhopw = rhopw_in; } +// mohan add 2025-12-02 +bool Charge::kin_density() +{ + if (XC_Functional::get_ked_flag() || PARAM.inp.out_elf[0] > 0) + { + return true; + } + else + { + return false; + } +} + void Charge::destroy() { if (allocate_rho || allocate_rho_final_scf) // LiuXh add 20180619 @@ -77,7 +90,7 @@ void Charge::destroy() } } -void Charge::allocate(const int& nspin_in) +void Charge::allocate(const int& nspin_in, const bool kin_den) { ModuleBase::TITLE("Charge", "allocate"); @@ -112,7 +125,7 @@ void Charge::allocate(const int& nspin_in) _space_rho_save = new double[nspin * nrxx]; _space_rhog = new std::complex[nspin * ngmc]; _space_rhog_save = new std::complex[nspin * ngmc]; - if (XC_Functional::get_ked_flag() || PARAM.inp.out_elf[0] > 0) + if(kin_den) { _space_kin_r = new double[nspin * nrxx]; _space_kin_r_save = new double[nspin * nrxx]; @@ -121,7 +134,7 @@ void Charge::allocate(const int& nspin_in) rhog = new std::complex*[nspin]; rho_save = new double*[nspin]; rhog_save = new std::complex*[nspin]; - if (XC_Functional::get_ked_flag() || PARAM.inp.out_elf[0] > 0) + if(kin_den) { kin_r = new double*[nspin]; kin_r_save = new double*[nspin]; @@ -136,7 +149,7 @@ void Charge::allocate(const int& nspin_in) ModuleBase::GlobalFunc::ZEROS(rhog[is], ngmc); ModuleBase::GlobalFunc::ZEROS(rho_save[is], nrxx); ModuleBase::GlobalFunc::ZEROS(rhog_save[is], ngmc); - if (XC_Functional::get_ked_flag() || PARAM.inp.out_elf[0] > 0) + if(kin_den) { kin_r[is] = _space_kin_r + is * nrxx; ModuleBase::GlobalFunc::ZEROS(kin_r[is], nrxx); @@ -149,7 +162,7 @@ void Charge::allocate(const int& nspin_in) ModuleBase::Memory::record("Chg::rho_save", sizeof(double) * nspin * nrxx); ModuleBase::Memory::record("Chg::rhog", sizeof(double) * nspin * ngmc); ModuleBase::Memory::record("Chg::rhog_save", sizeof(double) * nspin * ngmc); - if (XC_Functional::get_ked_flag() || PARAM.inp.out_elf[0] > 0) + if(kin_den) { ModuleBase::Memory::record("Chg::kin_r", sizeof(double) * nspin * ngmc); ModuleBase::Memory::record("Chg::kin_r_save", sizeof(double) * nspin * ngmc); diff --git a/source/source_estate/module_charge/charge.h b/source/source_estate/module_charge/charge.h index a9190676a0..79a5f5ca9e 100644 --- a/source/source_estate/module_charge/charge.h +++ b/source/source_estate/module_charge/charge.h @@ -84,7 +84,10 @@ class Charge const void* klist = nullptr, const void* wfcpw = nullptr); - void allocate(const int &nspin_in); + // mohan add 2025-12-02 + bool kin_density(); + + void allocate(const int &nspin_in, const bool kin_den); void atomic_rho(const int spin_number_need, const double& omega, diff --git a/source/source_estate/module_charge/charge_mpi.cpp b/source/source_estate/module_charge/charge_mpi.cpp index db1b458fbf..32fc8bc195 100644 --- a/source/source_estate/module_charge/charge_mpi.cpp +++ b/source/source_estate/module_charge/charge_mpi.cpp @@ -119,9 +119,10 @@ void Charge::reduce_diff_pools(double* array_rho) const void Charge::rho_mpi() { ModuleBase::TITLE("Charge", "rho_mpi"); - if (GlobalV::KPAR * PARAM.inp.bndpar <= 1) { - return; -} + if (GlobalV::KPAR * PARAM.inp.bndpar <= 1) + { + return; + } ModuleBase::timer::tick("Charge", "rho_mpi"); for (int is = 0; is < PARAM.inp.nspin; ++is) @@ -136,4 +137,4 @@ void Charge::rho_mpi() ModuleBase::timer::tick("Charge", "rho_mpi"); return; } -#endif \ No newline at end of file +#endif diff --git a/source/source_lcao/module_lr/esolver_lrtd_lcao.cpp b/source/source_lcao/module_lr/esolver_lrtd_lcao.cpp index f8cafe4902..16efc5f046 100644 --- a/source/source_lcao/module_lr/esolver_lrtd_lcao.cpp +++ b/source/source_lcao/module_lr/esolver_lrtd_lcao.cpp @@ -684,7 +684,8 @@ template void LR::ESolver_LR::read_ks_chg(Charge& chg_gs) { chg_gs.set_rhopw(this->pw_rho); - chg_gs.allocate(this->nspin); + const bool kin_den = chg_gs.kin_density(); // mohan add 20251202 + chg_gs.allocate(this->nspin, kin_den); GlobalV::ofs_running << " try to read charge from file : "; for (int is = 0; is < this->nspin; ++is) { From d102b5e5e55c8f4f91200e70522b2715c8c6c2b4 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Tue, 2 Dec 2025 16:10:44 +0800 Subject: [PATCH 27/36] update directory names of deepks --- .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../{101_PW_ORB_deepks_d => 03_NO_GO_deepks_md}/KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../{102_NO_KP_deepks_md => 04_NO_KP_deepks_md}/KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../chg.cube | 0 .../deepks_projdm.dat | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../chg.cube | 0 .../deepks_projdm.dat | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../deepks_hrdelta.csr.ref | 0 .../deepks_hrtot.csr.ref | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../deepks_hrdelta.csr.ref | 0 .../deepks_hrtot.csr.ref | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../deepks_hrdelta.csr.ref | 0 .../deepks_hrtot.csr.ref | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../deepks_hrdelta.csr.ref | 0 .../deepks_hrtot.csr.ref | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../descriptor.dat.ref | 0 .../jle.orb.ref | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../descriptor.dat.ref | 0 .../jle.orb.ref | 0 .../result.ref | 0 .../INPUT | 0 .../KPT | 0 .../README | 0 .../STRU | 0 .../descriptor.dat.ref | 0 .../jle.orb.ref | 0 .../result.ref | 0 .../E_delta_bands_ref.dat | 0 .../E_delta_ref.dat | 0 .../F_delta_ref.dat | 0 .../{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/INPUT | 0 .../{104_NO_GO_deepks_out_2 => NO_GO_deepks_UT}/KPT | 0 .../{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/STRU | 0 .../S_I_mu_alpha_ref.dat | 0 .../descriptor_ref.dat | 0 .../{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/dm | 0 .../dphialpha_x_ref.dat | 0 .../dphialpha_y_ref.dat | 0 .../dphialpha_z_ref.dat | 0 .../gdmepsl_ref.dat | 0 .../gdmx_ref.dat | 0 .../gedm_ref.dat | 0 .../gvepsl_ref.dat | 0 .../gvx_ref.dat | 0 .../iRmat_ref.dat | 0 .../jle.orb | 0 .../model.ptg | Bin .../o_delta_ref.dat | 0 .../orbpre_ref.dat | 0 .../pdm_ref.dat | 0 .../phialpha_r_ref.dat | 0 .../phialpha_ref.dat | 0 .../stress_delta_ref.dat | 0 .../vdpre_ref.dat | 0 .../vdrpre_ref.dat | 0 .../E_delta_bands_ref.dat | 0 .../E_delta_ref.dat | 0 .../F_delta_ref.dat | 0 .../{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/INPUT | 0 .../{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/KPT | 0 .../{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/STRU | 0 .../S_I_mu_alpha_ref.dat | 0 .../descriptor_ref.dat | 0 .../{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/dm_0 | 0 .../{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/dm_1 | 0 .../{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/dm_2 | 0 .../{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/dm_3 | 0 .../{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/dm_4 | 0 .../{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/dm_5 | 0 .../{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/dm_6 | 0 .../{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/dm_7 | 0 .../{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/dm_8 | 0 .../dphialpha_x_ref.dat | 0 .../dphialpha_y_ref.dat | 0 .../dphialpha_z_ref.dat | 0 .../gdmepsl_ref.dat | 0 .../gdmx_ref.dat | 0 .../gedm_ref.dat | 0 .../gvepsl_ref.dat | 0 .../gvx_ref.dat | 0 .../iRmat_ref.dat | 0 .../jle.orb | 0 .../model.ptg | Bin .../o_delta_ref.dat | 0 .../orbpre_ref.dat | 0 .../pdm_ref.dat | 0 .../phialpha_r_ref.dat | 0 .../phialpha_ref.dat | 0 .../stress_delta_ref.dat | 0 .../vdpre_ref.dat | 0 .../vdrpre_ref.dat | 0 237 files changed, 0 insertions(+), 0 deletions(-) rename tests/09_DeePKS/{102_NO_GO_deepks_scf => 01_NO_GO_deepks_scf}/INPUT (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => 01_NO_GO_deepks_scf}/KPT (100%) rename tests/09_DeePKS/{102_NO_GO_deepks_scf => 01_NO_GO_deepks_scf}/README (100%) rename tests/09_DeePKS/{102_NO_GO_deepks_nscf => 01_NO_GO_deepks_scf}/STRU (100%) rename tests/09_DeePKS/{102_NO_GO_deepks_scf => 01_NO_GO_deepks_scf}/result.ref (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_scf => 02_NO_KP_deepks_scf}/INPUT (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_nscf => 02_NO_KP_deepks_scf}/KPT (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_scf => 02_NO_KP_deepks_scf}/README (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_nscf => 02_NO_KP_deepks_scf}/STRU (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_scf => 02_NO_KP_deepks_scf}/result.ref (100%) rename tests/09_DeePKS/{102_NO_GO_deepks_md => 03_NO_GO_deepks_md}/INPUT (100%) rename tests/09_DeePKS/{101_PW_ORB_deepks_d => 03_NO_GO_deepks_md}/KPT (100%) rename tests/09_DeePKS/{102_NO_GO_deepks_md => 03_NO_GO_deepks_md}/README (100%) rename tests/09_DeePKS/{102_NO_GO_deepks_md => 03_NO_GO_deepks_md}/STRU (100%) rename tests/09_DeePKS/{102_NO_GO_deepks_md => 03_NO_GO_deepks_md}/result.ref (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_md => 04_NO_KP_deepks_md}/INPUT (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_md => 04_NO_KP_deepks_md}/KPT (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_md => 04_NO_KP_deepks_md}/README (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_md => 04_NO_KP_deepks_md}/STRU (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_md => 04_NO_KP_deepks_md}/result.ref (100%) rename tests/09_DeePKS/{102_NO_GO_deepks_nscf => 05_NO_GO_deepks_nscf}/INPUT (100%) rename tests/09_DeePKS/{101_PW_ORB_deepks_p => 05_NO_GO_deepks_nscf}/KPT (100%) rename tests/09_DeePKS/{102_NO_GO_deepks_nscf => 05_NO_GO_deepks_nscf}/README (100%) rename tests/09_DeePKS/{102_NO_GO_deepks_scf => 05_NO_GO_deepks_nscf}/STRU (100%) rename tests/09_DeePKS/{102_NO_GO_deepks_nscf => 05_NO_GO_deepks_nscf}/chg.cube (100%) rename tests/09_DeePKS/{102_NO_GO_deepks_nscf => 05_NO_GO_deepks_nscf}/deepks_projdm.dat (100%) rename tests/09_DeePKS/{102_NO_GO_deepks_nscf => 05_NO_GO_deepks_nscf}/result.ref (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_nscf => 06_NO_KP_deepks_nscf}/INPUT (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_scf => 06_NO_KP_deepks_nscf}/KPT (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_nscf => 06_NO_KP_deepks_nscf}/README (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_scf => 06_NO_KP_deepks_nscf}/STRU (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_nscf => 06_NO_KP_deepks_nscf}/chg.cube (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_nscf => 06_NO_KP_deepks_nscf}/deepks_projdm.dat (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_nscf => 06_NO_KP_deepks_nscf}/result.ref (100%) rename tests/09_DeePKS/{102_NO_GO_deepks_relax => 07_NO_GO_deepks_relax}/INPUT (100%) rename tests/09_DeePKS/{101_PW_ORB_deepks_s => 07_NO_GO_deepks_relax}/KPT (100%) rename tests/09_DeePKS/{102_NO_GO_deepks_relax => 07_NO_GO_deepks_relax}/README (100%) rename tests/09_DeePKS/{102_NO_GO_deepks_relax => 07_NO_GO_deepks_relax}/STRU (100%) rename tests/09_DeePKS/{102_NO_GO_deepks_relax => 07_NO_GO_deepks_relax}/result.ref (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_relax => 08_NO_KP_deepks_relax}/INPUT (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_relax => 08_NO_KP_deepks_relax}/KPT (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_relax => 08_NO_KP_deepks_relax}/README (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_relax => 08_NO_KP_deepks_relax}/STRU (100%) rename tests/09_DeePKS/{102_NO_KP_deepks_relax => 08_NO_KP_deepks_relax}/result.ref (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_basic => 09_NO_GO_deepks_basic}/INPUT (100%) rename tests/09_DeePKS/{102_NO_GO_deepks_md => 09_NO_GO_deepks_basic}/KPT (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_basic => 09_NO_GO_deepks_basic}/README (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_basic => 09_NO_GO_deepks_basic}/STRU (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_basic => 09_NO_GO_deepks_basic}/result.ref (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_basic => 10_NO_KP_deepks_basic}/INPUT (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_basic => 10_NO_KP_deepks_basic}/KPT (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_basic => 10_NO_KP_deepks_basic}/README (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_basic => 10_NO_KP_deepks_basic}/STRU (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_basic => 10_NO_KP_deepks_basic}/result.ref (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_bandgap => 11_NO_GO_deepks_bandgap}/INPUT (100%) rename tests/09_DeePKS/{102_NO_GO_deepks_nscf => 11_NO_GO_deepks_bandgap}/KPT (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_bandgap => 11_NO_GO_deepks_bandgap}/README (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_bandgap => 11_NO_GO_deepks_bandgap}/STRU (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_bandgap => 11_NO_GO_deepks_bandgap}/result.ref (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_bandgap_2 => 12_NO_GO_deepks_bandgap_2}/INPUT (100%) rename tests/09_DeePKS/{102_NO_GO_deepks_relax => 12_NO_GO_deepks_bandgap_2}/KPT (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_bandgap_2 => 12_NO_GO_deepks_bandgap_2}/README (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_bandgap_2 => 12_NO_GO_deepks_bandgap_2}/STRU (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_bandgap_2 => 12_NO_GO_deepks_bandgap_2}/result.ref (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_bandgap_3 => 13_NO_GO_deepks_bandgap_3}/INPUT (100%) rename tests/09_DeePKS/{102_NO_GO_deepks_scf => 13_NO_GO_deepks_bandgap_3}/KPT (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_bandgap_3 => 13_NO_GO_deepks_bandgap_3}/README (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_bandgap_3 => 13_NO_GO_deepks_bandgap_3}/STRU (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_bandgap_3 => 13_NO_GO_deepks_bandgap_3}/result.ref (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_bandgap => 14_NO_KP_deepks_bandgap}/INPUT (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_bandgap => 14_NO_KP_deepks_bandgap}/KPT (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_bandgap => 14_NO_KP_deepks_bandgap}/README (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_bandgap => 14_NO_KP_deepks_bandgap}/STRU (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_bandgap => 14_NO_KP_deepks_bandgap}/result.ref (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_bandgap_2 => 15_NO_KP_deepks_bandgap_2}/INPUT (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_bandgap_2 => 15_NO_KP_deepks_bandgap_2}/KPT (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_bandgap_2 => 15_NO_KP_deepks_bandgap_2}/README (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_bandgap_2 => 15_NO_KP_deepks_bandgap_2}/STRU (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_bandgap_2 => 15_NO_KP_deepks_bandgap_2}/result.ref (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_bandgap_3 => 16_NO_KP_deepks_bandgap_3}/INPUT (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_bandgap_3 => 16_NO_KP_deepks_bandgap_3}/KPT (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_bandgap_3 => 16_NO_KP_deepks_bandgap_3}/README (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_bandgap_3 => 16_NO_KP_deepks_bandgap_3}/STRU (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_bandgap_3 => 16_NO_KP_deepks_bandgap_3}/result.ref (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_1 => 17_NO_GO_deepks_vdelta_1}/INPUT (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_bandgap => 17_NO_GO_deepks_vdelta_1}/KPT (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_1 => 17_NO_GO_deepks_vdelta_1}/README (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_1 => 17_NO_GO_deepks_vdelta_1}/STRU (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_1 => 17_NO_GO_deepks_vdelta_1}/result.ref (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_2 => 18_NO_GO_deepks_vdelta_2}/INPUT (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_bandgap_2 => 18_NO_GO_deepks_vdelta_2}/KPT (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_2 => 18_NO_GO_deepks_vdelta_2}/README (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_2 => 18_NO_GO_deepks_vdelta_2}/STRU (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_2 => 18_NO_GO_deepks_vdelta_2}/result.ref (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_1 => 19_NO_KP_deepks_vdelta_1}/INPUT (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_1 => 19_NO_KP_deepks_vdelta_1}/KPT (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_1 => 19_NO_KP_deepks_vdelta_1}/README (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_r_1 => 19_NO_KP_deepks_vdelta_1}/STRU (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_1 => 19_NO_KP_deepks_vdelta_1}/result.ref (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_2 => 20_NO_KP_deepks_vdelta_2}/INPUT (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_2 => 20_NO_KP_deepks_vdelta_2}/KPT (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_2 => 20_NO_KP_deepks_vdelta_2}/README (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_r_2 => 20_NO_KP_deepks_vdelta_2}/STRU (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_2 => 20_NO_KP_deepks_vdelta_2}/result.ref (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_r_1 => 21_NO_GO_deepks_vdelta_r_1}/INPUT (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_bandgap_3 => 21_NO_GO_deepks_vdelta_r_1}/KPT (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_r_1 => 21_NO_GO_deepks_vdelta_r_1}/README (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_1 => 21_NO_GO_deepks_vdelta_r_1}/STRU (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_r_1 => 21_NO_GO_deepks_vdelta_r_1}/deepks_hrdelta.csr.ref (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_r_1 => 21_NO_GO_deepks_vdelta_r_1}/deepks_hrtot.csr.ref (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_r_1 => 21_NO_GO_deepks_vdelta_r_1}/result.ref (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_r_2 => 22_NO_GO_deepks_vdelta_r_2}/INPUT (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_basic => 22_NO_GO_deepks_vdelta_r_2}/KPT (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_r_2 => 22_NO_GO_deepks_vdelta_r_2}/README (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_2 => 22_NO_GO_deepks_vdelta_r_2}/STRU (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_r_2 => 22_NO_GO_deepks_vdelta_r_2}/deepks_hrdelta.csr.ref (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_r_2 => 22_NO_GO_deepks_vdelta_r_2}/deepks_hrtot.csr.ref (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_r_2 => 22_NO_GO_deepks_vdelta_r_2}/result.ref (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_r_1 => 23_NO_KP_deepks_vdelta_r_1}/INPUT (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_r_1 => 23_NO_KP_deepks_vdelta_r_1}/KPT (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_r_1 => 23_NO_KP_deepks_vdelta_r_1}/README (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_r_1 => 23_NO_KP_deepks_vdelta_r_1}/STRU (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_r_1 => 23_NO_KP_deepks_vdelta_r_1}/deepks_hrdelta.csr.ref (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_r_1 => 23_NO_KP_deepks_vdelta_r_1}/deepks_hrtot.csr.ref (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_r_1 => 23_NO_KP_deepks_vdelta_r_1}/result.ref (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_r_2 => 24_NO_KP_deepks_vdelta_r_2}/INPUT (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_r_2 => 24_NO_KP_deepks_vdelta_r_2}/KPT (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_r_2 => 24_NO_KP_deepks_vdelta_r_2}/README (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_r_2 => 24_NO_KP_deepks_vdelta_r_2}/STRU (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_r_2 => 24_NO_KP_deepks_vdelta_r_2}/deepks_hrdelta.csr.ref (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_r_2 => 24_NO_KP_deepks_vdelta_r_2}/deepks_hrtot.csr.ref (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_vdelta_r_2 => 24_NO_KP_deepks_vdelta_r_2}/result.ref (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_out_freq_elec => 25_NO_GO_deepks_out_freq_elec}/INPUT (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_out_freq_elec => 25_NO_GO_deepks_out_freq_elec}/KPT (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_out_freq_elec => 25_NO_GO_deepks_out_freq_elec}/README (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_out_freq_elec => 25_NO_GO_deepks_out_freq_elec}/STRU (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_out_freq_elec => 25_NO_GO_deepks_out_freq_elec}/result.ref (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_out_freq_elec => 26_NO_KP_deepks_out_freq_elec}/INPUT (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_1 => 26_NO_KP_deepks_out_freq_elec}/KPT (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_out_freq_elec => 26_NO_KP_deepks_out_freq_elec}/README (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_out_freq_elec => 26_NO_KP_deepks_out_freq_elec}/STRU (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_out_freq_elec => 26_NO_KP_deepks_out_freq_elec}/result.ref (100%) rename tests/09_DeePKS/{104_NO_GO_deepks_out_2 => 27_NO_GO_deepks_out_2}/INPUT (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_2 => 27_NO_GO_deepks_out_2}/KPT (100%) rename tests/09_DeePKS/{104_NO_GO_deepks_out_2 => 27_NO_GO_deepks_out_2}/README (100%) rename tests/09_DeePKS/{104_NO_GO_deepks_out_2 => 27_NO_GO_deepks_out_2}/STRU (100%) rename tests/09_DeePKS/{104_NO_GO_deepks_out_2 => 27_NO_GO_deepks_out_2}/result.ref (100%) rename tests/09_DeePKS/{104_NO_KP_deepks_out_2 => 28_NO_KP_deepks_out_2}/INPUT (100%) rename tests/09_DeePKS/{104_NO_KP_deepks_out_2 => 28_NO_KP_deepks_out_2}/KPT (100%) rename tests/09_DeePKS/{104_NO_KP_deepks_out_2 => 28_NO_KP_deepks_out_2}/README (100%) rename tests/09_DeePKS/{104_NO_KP_deepks_out_2 => 28_NO_KP_deepks_out_2}/STRU (100%) rename tests/09_DeePKS/{104_NO_KP_deepks_out_2 => 28_NO_KP_deepks_out_2}/result.ref (100%) rename tests/09_DeePKS/{101_PW_ORB_deepks_s => 97_PW_ORB_deepks_s}/INPUT (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_r_1 => 97_PW_ORB_deepks_s}/KPT (100%) rename tests/09_DeePKS/{101_PW_ORB_deepks_d => 97_PW_ORB_deepks_s}/README (100%) rename tests/09_DeePKS/{101_PW_ORB_deepks_s => 97_PW_ORB_deepks_s}/STRU (100%) rename tests/09_DeePKS/{101_PW_ORB_deepks_s => 97_PW_ORB_deepks_s}/descriptor.dat.ref (100%) rename tests/09_DeePKS/{101_PW_ORB_deepks_s => 97_PW_ORB_deepks_s}/jle.orb.ref (100%) rename tests/09_DeePKS/{101_PW_ORB_deepks_s => 97_PW_ORB_deepks_s}/result.ref (100%) rename tests/09_DeePKS/{101_PW_ORB_deepks_p => 98_PW_ORB_deepks_p}/INPUT (100%) rename tests/09_DeePKS/{103_NO_GO_deepks_vdelta_r_2 => 98_PW_ORB_deepks_p}/KPT (100%) rename tests/09_DeePKS/{101_PW_ORB_deepks_p => 98_PW_ORB_deepks_p}/README (100%) rename tests/09_DeePKS/{101_PW_ORB_deepks_d => 98_PW_ORB_deepks_p}/STRU (100%) rename tests/09_DeePKS/{101_PW_ORB_deepks_p => 98_PW_ORB_deepks_p}/descriptor.dat.ref (100%) rename tests/09_DeePKS/{101_PW_ORB_deepks_p => 98_PW_ORB_deepks_p}/jle.orb.ref (100%) rename tests/09_DeePKS/{101_PW_ORB_deepks_p => 98_PW_ORB_deepks_p}/result.ref (100%) rename tests/09_DeePKS/{101_PW_ORB_deepks_d => 99_PW_ORB_deepks_d}/INPUT (100%) rename tests/09_DeePKS/{103_NO_KP_deepks_out_freq_elec => 99_PW_ORB_deepks_d}/KPT (100%) rename tests/09_DeePKS/{101_PW_ORB_deepks_s => 99_PW_ORB_deepks_d}/README (100%) rename tests/09_DeePKS/{101_PW_ORB_deepks_p => 99_PW_ORB_deepks_d}/STRU (100%) rename tests/09_DeePKS/{101_PW_ORB_deepks_d => 99_PW_ORB_deepks_d}/descriptor.dat.ref (100%) rename tests/09_DeePKS/{101_PW_ORB_deepks_d => 99_PW_ORB_deepks_d}/jle.orb.ref (100%) rename tests/09_DeePKS/{101_PW_ORB_deepks_d => 99_PW_ORB_deepks_d}/result.ref (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/E_delta_bands_ref.dat (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/E_delta_ref.dat (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/F_delta_ref.dat (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/INPUT (100%) rename tests/09_DeePKS/{104_NO_GO_deepks_out_2 => NO_GO_deepks_UT}/KPT (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/STRU (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/S_I_mu_alpha_ref.dat (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/descriptor_ref.dat (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/dm (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/dphialpha_x_ref.dat (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/dphialpha_y_ref.dat (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/dphialpha_z_ref.dat (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/gdmepsl_ref.dat (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/gdmx_ref.dat (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/gedm_ref.dat (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/gvepsl_ref.dat (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/gvx_ref.dat (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/iRmat_ref.dat (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/jle.orb (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/model.ptg (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/o_delta_ref.dat (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/orbpre_ref.dat (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/pdm_ref.dat (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/phialpha_r_ref.dat (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/phialpha_ref.dat (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/stress_delta_ref.dat (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/vdpre_ref.dat (100%) rename tests/09_DeePKS/{100_NO_GO_deepks_UT => NO_GO_deepks_UT}/vdrpre_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/E_delta_bands_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/E_delta_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/F_delta_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/INPUT (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/KPT (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/STRU (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/S_I_mu_alpha_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/descriptor_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/dm_0 (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/dm_1 (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/dm_2 (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/dm_3 (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/dm_4 (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/dm_5 (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/dm_6 (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/dm_7 (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/dm_8 (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/dphialpha_x_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/dphialpha_y_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/dphialpha_z_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/gdmepsl_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/gdmx_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/gedm_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/gvepsl_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/gvx_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/iRmat_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/jle.orb (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/model.ptg (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/o_delta_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/orbpre_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/pdm_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/phialpha_r_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/phialpha_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/stress_delta_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/vdpre_ref.dat (100%) rename tests/09_DeePKS/{100_NO_KP_deepks_UT => NO_KP_deepks_UT}/vdrpre_ref.dat (100%) diff --git a/tests/09_DeePKS/102_NO_GO_deepks_scf/INPUT b/tests/09_DeePKS/01_NO_GO_deepks_scf/INPUT similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_scf/INPUT rename to tests/09_DeePKS/01_NO_GO_deepks_scf/INPUT diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/KPT b/tests/09_DeePKS/01_NO_GO_deepks_scf/KPT similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/KPT rename to tests/09_DeePKS/01_NO_GO_deepks_scf/KPT diff --git a/tests/09_DeePKS/102_NO_GO_deepks_scf/README b/tests/09_DeePKS/01_NO_GO_deepks_scf/README similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_scf/README rename to tests/09_DeePKS/01_NO_GO_deepks_scf/README diff --git a/tests/09_DeePKS/102_NO_GO_deepks_nscf/STRU b/tests/09_DeePKS/01_NO_GO_deepks_scf/STRU similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_nscf/STRU rename to tests/09_DeePKS/01_NO_GO_deepks_scf/STRU diff --git a/tests/09_DeePKS/102_NO_GO_deepks_scf/result.ref b/tests/09_DeePKS/01_NO_GO_deepks_scf/result.ref similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_scf/result.ref rename to tests/09_DeePKS/01_NO_GO_deepks_scf/result.ref diff --git a/tests/09_DeePKS/102_NO_KP_deepks_scf/INPUT b/tests/09_DeePKS/02_NO_KP_deepks_scf/INPUT similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_scf/INPUT rename to tests/09_DeePKS/02_NO_KP_deepks_scf/INPUT diff --git a/tests/09_DeePKS/102_NO_KP_deepks_nscf/KPT b/tests/09_DeePKS/02_NO_KP_deepks_scf/KPT similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_nscf/KPT rename to tests/09_DeePKS/02_NO_KP_deepks_scf/KPT diff --git a/tests/09_DeePKS/102_NO_KP_deepks_scf/README b/tests/09_DeePKS/02_NO_KP_deepks_scf/README similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_scf/README rename to tests/09_DeePKS/02_NO_KP_deepks_scf/README diff --git a/tests/09_DeePKS/102_NO_KP_deepks_nscf/STRU b/tests/09_DeePKS/02_NO_KP_deepks_scf/STRU similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_nscf/STRU rename to tests/09_DeePKS/02_NO_KP_deepks_scf/STRU diff --git a/tests/09_DeePKS/102_NO_KP_deepks_scf/result.ref b/tests/09_DeePKS/02_NO_KP_deepks_scf/result.ref similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_scf/result.ref rename to tests/09_DeePKS/02_NO_KP_deepks_scf/result.ref diff --git a/tests/09_DeePKS/102_NO_GO_deepks_md/INPUT b/tests/09_DeePKS/03_NO_GO_deepks_md/INPUT similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_md/INPUT rename to tests/09_DeePKS/03_NO_GO_deepks_md/INPUT diff --git a/tests/09_DeePKS/101_PW_ORB_deepks_d/KPT b/tests/09_DeePKS/03_NO_GO_deepks_md/KPT similarity index 100% rename from tests/09_DeePKS/101_PW_ORB_deepks_d/KPT rename to tests/09_DeePKS/03_NO_GO_deepks_md/KPT diff --git a/tests/09_DeePKS/102_NO_GO_deepks_md/README b/tests/09_DeePKS/03_NO_GO_deepks_md/README similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_md/README rename to tests/09_DeePKS/03_NO_GO_deepks_md/README diff --git a/tests/09_DeePKS/102_NO_GO_deepks_md/STRU b/tests/09_DeePKS/03_NO_GO_deepks_md/STRU similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_md/STRU rename to tests/09_DeePKS/03_NO_GO_deepks_md/STRU diff --git a/tests/09_DeePKS/102_NO_GO_deepks_md/result.ref b/tests/09_DeePKS/03_NO_GO_deepks_md/result.ref similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_md/result.ref rename to tests/09_DeePKS/03_NO_GO_deepks_md/result.ref diff --git a/tests/09_DeePKS/102_NO_KP_deepks_md/INPUT b/tests/09_DeePKS/04_NO_KP_deepks_md/INPUT similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_md/INPUT rename to tests/09_DeePKS/04_NO_KP_deepks_md/INPUT diff --git a/tests/09_DeePKS/102_NO_KP_deepks_md/KPT b/tests/09_DeePKS/04_NO_KP_deepks_md/KPT similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_md/KPT rename to tests/09_DeePKS/04_NO_KP_deepks_md/KPT diff --git a/tests/09_DeePKS/102_NO_KP_deepks_md/README b/tests/09_DeePKS/04_NO_KP_deepks_md/README similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_md/README rename to tests/09_DeePKS/04_NO_KP_deepks_md/README diff --git a/tests/09_DeePKS/102_NO_KP_deepks_md/STRU b/tests/09_DeePKS/04_NO_KP_deepks_md/STRU similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_md/STRU rename to tests/09_DeePKS/04_NO_KP_deepks_md/STRU diff --git a/tests/09_DeePKS/102_NO_KP_deepks_md/result.ref b/tests/09_DeePKS/04_NO_KP_deepks_md/result.ref similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_md/result.ref rename to tests/09_DeePKS/04_NO_KP_deepks_md/result.ref diff --git a/tests/09_DeePKS/102_NO_GO_deepks_nscf/INPUT b/tests/09_DeePKS/05_NO_GO_deepks_nscf/INPUT similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_nscf/INPUT rename to tests/09_DeePKS/05_NO_GO_deepks_nscf/INPUT diff --git a/tests/09_DeePKS/101_PW_ORB_deepks_p/KPT b/tests/09_DeePKS/05_NO_GO_deepks_nscf/KPT similarity index 100% rename from tests/09_DeePKS/101_PW_ORB_deepks_p/KPT rename to tests/09_DeePKS/05_NO_GO_deepks_nscf/KPT diff --git a/tests/09_DeePKS/102_NO_GO_deepks_nscf/README b/tests/09_DeePKS/05_NO_GO_deepks_nscf/README similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_nscf/README rename to tests/09_DeePKS/05_NO_GO_deepks_nscf/README diff --git a/tests/09_DeePKS/102_NO_GO_deepks_scf/STRU b/tests/09_DeePKS/05_NO_GO_deepks_nscf/STRU similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_scf/STRU rename to tests/09_DeePKS/05_NO_GO_deepks_nscf/STRU diff --git a/tests/09_DeePKS/102_NO_GO_deepks_nscf/chg.cube b/tests/09_DeePKS/05_NO_GO_deepks_nscf/chg.cube similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_nscf/chg.cube rename to tests/09_DeePKS/05_NO_GO_deepks_nscf/chg.cube diff --git a/tests/09_DeePKS/102_NO_GO_deepks_nscf/deepks_projdm.dat b/tests/09_DeePKS/05_NO_GO_deepks_nscf/deepks_projdm.dat similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_nscf/deepks_projdm.dat rename to tests/09_DeePKS/05_NO_GO_deepks_nscf/deepks_projdm.dat diff --git a/tests/09_DeePKS/102_NO_GO_deepks_nscf/result.ref b/tests/09_DeePKS/05_NO_GO_deepks_nscf/result.ref similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_nscf/result.ref rename to tests/09_DeePKS/05_NO_GO_deepks_nscf/result.ref diff --git a/tests/09_DeePKS/102_NO_KP_deepks_nscf/INPUT b/tests/09_DeePKS/06_NO_KP_deepks_nscf/INPUT similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_nscf/INPUT rename to tests/09_DeePKS/06_NO_KP_deepks_nscf/INPUT diff --git a/tests/09_DeePKS/102_NO_KP_deepks_scf/KPT b/tests/09_DeePKS/06_NO_KP_deepks_nscf/KPT similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_scf/KPT rename to tests/09_DeePKS/06_NO_KP_deepks_nscf/KPT diff --git a/tests/09_DeePKS/102_NO_KP_deepks_nscf/README b/tests/09_DeePKS/06_NO_KP_deepks_nscf/README similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_nscf/README rename to tests/09_DeePKS/06_NO_KP_deepks_nscf/README diff --git a/tests/09_DeePKS/102_NO_KP_deepks_scf/STRU b/tests/09_DeePKS/06_NO_KP_deepks_nscf/STRU similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_scf/STRU rename to tests/09_DeePKS/06_NO_KP_deepks_nscf/STRU diff --git a/tests/09_DeePKS/102_NO_KP_deepks_nscf/chg.cube b/tests/09_DeePKS/06_NO_KP_deepks_nscf/chg.cube similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_nscf/chg.cube rename to tests/09_DeePKS/06_NO_KP_deepks_nscf/chg.cube diff --git a/tests/09_DeePKS/102_NO_KP_deepks_nscf/deepks_projdm.dat b/tests/09_DeePKS/06_NO_KP_deepks_nscf/deepks_projdm.dat similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_nscf/deepks_projdm.dat rename to tests/09_DeePKS/06_NO_KP_deepks_nscf/deepks_projdm.dat diff --git a/tests/09_DeePKS/102_NO_KP_deepks_nscf/result.ref b/tests/09_DeePKS/06_NO_KP_deepks_nscf/result.ref similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_nscf/result.ref rename to tests/09_DeePKS/06_NO_KP_deepks_nscf/result.ref diff --git a/tests/09_DeePKS/102_NO_GO_deepks_relax/INPUT b/tests/09_DeePKS/07_NO_GO_deepks_relax/INPUT similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_relax/INPUT rename to tests/09_DeePKS/07_NO_GO_deepks_relax/INPUT diff --git a/tests/09_DeePKS/101_PW_ORB_deepks_s/KPT b/tests/09_DeePKS/07_NO_GO_deepks_relax/KPT similarity index 100% rename from tests/09_DeePKS/101_PW_ORB_deepks_s/KPT rename to tests/09_DeePKS/07_NO_GO_deepks_relax/KPT diff --git a/tests/09_DeePKS/102_NO_GO_deepks_relax/README b/tests/09_DeePKS/07_NO_GO_deepks_relax/README similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_relax/README rename to tests/09_DeePKS/07_NO_GO_deepks_relax/README diff --git a/tests/09_DeePKS/102_NO_GO_deepks_relax/STRU b/tests/09_DeePKS/07_NO_GO_deepks_relax/STRU similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_relax/STRU rename to tests/09_DeePKS/07_NO_GO_deepks_relax/STRU diff --git a/tests/09_DeePKS/102_NO_GO_deepks_relax/result.ref b/tests/09_DeePKS/07_NO_GO_deepks_relax/result.ref similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_relax/result.ref rename to tests/09_DeePKS/07_NO_GO_deepks_relax/result.ref diff --git a/tests/09_DeePKS/102_NO_KP_deepks_relax/INPUT b/tests/09_DeePKS/08_NO_KP_deepks_relax/INPUT similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_relax/INPUT rename to tests/09_DeePKS/08_NO_KP_deepks_relax/INPUT diff --git a/tests/09_DeePKS/102_NO_KP_deepks_relax/KPT b/tests/09_DeePKS/08_NO_KP_deepks_relax/KPT similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_relax/KPT rename to tests/09_DeePKS/08_NO_KP_deepks_relax/KPT diff --git a/tests/09_DeePKS/102_NO_KP_deepks_relax/README b/tests/09_DeePKS/08_NO_KP_deepks_relax/README similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_relax/README rename to tests/09_DeePKS/08_NO_KP_deepks_relax/README diff --git a/tests/09_DeePKS/102_NO_KP_deepks_relax/STRU b/tests/09_DeePKS/08_NO_KP_deepks_relax/STRU similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_relax/STRU rename to tests/09_DeePKS/08_NO_KP_deepks_relax/STRU diff --git a/tests/09_DeePKS/102_NO_KP_deepks_relax/result.ref b/tests/09_DeePKS/08_NO_KP_deepks_relax/result.ref similarity index 100% rename from tests/09_DeePKS/102_NO_KP_deepks_relax/result.ref rename to tests/09_DeePKS/08_NO_KP_deepks_relax/result.ref diff --git a/tests/09_DeePKS/103_NO_GO_deepks_basic/INPUT b/tests/09_DeePKS/09_NO_GO_deepks_basic/INPUT similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_basic/INPUT rename to tests/09_DeePKS/09_NO_GO_deepks_basic/INPUT diff --git a/tests/09_DeePKS/102_NO_GO_deepks_md/KPT b/tests/09_DeePKS/09_NO_GO_deepks_basic/KPT similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_md/KPT rename to tests/09_DeePKS/09_NO_GO_deepks_basic/KPT diff --git a/tests/09_DeePKS/103_NO_GO_deepks_basic/README b/tests/09_DeePKS/09_NO_GO_deepks_basic/README similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_basic/README rename to tests/09_DeePKS/09_NO_GO_deepks_basic/README diff --git a/tests/09_DeePKS/103_NO_GO_deepks_basic/STRU b/tests/09_DeePKS/09_NO_GO_deepks_basic/STRU similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_basic/STRU rename to tests/09_DeePKS/09_NO_GO_deepks_basic/STRU diff --git a/tests/09_DeePKS/103_NO_GO_deepks_basic/result.ref b/tests/09_DeePKS/09_NO_GO_deepks_basic/result.ref similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_basic/result.ref rename to tests/09_DeePKS/09_NO_GO_deepks_basic/result.ref diff --git a/tests/09_DeePKS/103_NO_KP_deepks_basic/INPUT b/tests/09_DeePKS/10_NO_KP_deepks_basic/INPUT similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_basic/INPUT rename to tests/09_DeePKS/10_NO_KP_deepks_basic/INPUT diff --git a/tests/09_DeePKS/103_NO_KP_deepks_basic/KPT b/tests/09_DeePKS/10_NO_KP_deepks_basic/KPT similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_basic/KPT rename to tests/09_DeePKS/10_NO_KP_deepks_basic/KPT diff --git a/tests/09_DeePKS/103_NO_KP_deepks_basic/README b/tests/09_DeePKS/10_NO_KP_deepks_basic/README similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_basic/README rename to tests/09_DeePKS/10_NO_KP_deepks_basic/README diff --git a/tests/09_DeePKS/103_NO_KP_deepks_basic/STRU b/tests/09_DeePKS/10_NO_KP_deepks_basic/STRU similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_basic/STRU rename to tests/09_DeePKS/10_NO_KP_deepks_basic/STRU diff --git a/tests/09_DeePKS/103_NO_KP_deepks_basic/result.ref b/tests/09_DeePKS/10_NO_KP_deepks_basic/result.ref similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_basic/result.ref rename to tests/09_DeePKS/10_NO_KP_deepks_basic/result.ref diff --git a/tests/09_DeePKS/103_NO_GO_deepks_bandgap/INPUT b/tests/09_DeePKS/11_NO_GO_deepks_bandgap/INPUT similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_bandgap/INPUT rename to tests/09_DeePKS/11_NO_GO_deepks_bandgap/INPUT diff --git a/tests/09_DeePKS/102_NO_GO_deepks_nscf/KPT b/tests/09_DeePKS/11_NO_GO_deepks_bandgap/KPT similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_nscf/KPT rename to tests/09_DeePKS/11_NO_GO_deepks_bandgap/KPT diff --git a/tests/09_DeePKS/103_NO_GO_deepks_bandgap/README b/tests/09_DeePKS/11_NO_GO_deepks_bandgap/README similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_bandgap/README rename to tests/09_DeePKS/11_NO_GO_deepks_bandgap/README diff --git a/tests/09_DeePKS/103_NO_GO_deepks_bandgap/STRU b/tests/09_DeePKS/11_NO_GO_deepks_bandgap/STRU similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_bandgap/STRU rename to tests/09_DeePKS/11_NO_GO_deepks_bandgap/STRU diff --git a/tests/09_DeePKS/103_NO_GO_deepks_bandgap/result.ref b/tests/09_DeePKS/11_NO_GO_deepks_bandgap/result.ref similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_bandgap/result.ref rename to tests/09_DeePKS/11_NO_GO_deepks_bandgap/result.ref diff --git a/tests/09_DeePKS/103_NO_GO_deepks_bandgap_2/INPUT b/tests/09_DeePKS/12_NO_GO_deepks_bandgap_2/INPUT similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_bandgap_2/INPUT rename to tests/09_DeePKS/12_NO_GO_deepks_bandgap_2/INPUT diff --git a/tests/09_DeePKS/102_NO_GO_deepks_relax/KPT b/tests/09_DeePKS/12_NO_GO_deepks_bandgap_2/KPT similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_relax/KPT rename to tests/09_DeePKS/12_NO_GO_deepks_bandgap_2/KPT diff --git a/tests/09_DeePKS/103_NO_GO_deepks_bandgap_2/README b/tests/09_DeePKS/12_NO_GO_deepks_bandgap_2/README similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_bandgap_2/README rename to tests/09_DeePKS/12_NO_GO_deepks_bandgap_2/README diff --git a/tests/09_DeePKS/103_NO_GO_deepks_bandgap_2/STRU b/tests/09_DeePKS/12_NO_GO_deepks_bandgap_2/STRU similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_bandgap_2/STRU rename to tests/09_DeePKS/12_NO_GO_deepks_bandgap_2/STRU diff --git a/tests/09_DeePKS/103_NO_GO_deepks_bandgap_2/result.ref b/tests/09_DeePKS/12_NO_GO_deepks_bandgap_2/result.ref similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_bandgap_2/result.ref rename to tests/09_DeePKS/12_NO_GO_deepks_bandgap_2/result.ref diff --git a/tests/09_DeePKS/103_NO_GO_deepks_bandgap_3/INPUT b/tests/09_DeePKS/13_NO_GO_deepks_bandgap_3/INPUT similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_bandgap_3/INPUT rename to tests/09_DeePKS/13_NO_GO_deepks_bandgap_3/INPUT diff --git a/tests/09_DeePKS/102_NO_GO_deepks_scf/KPT b/tests/09_DeePKS/13_NO_GO_deepks_bandgap_3/KPT similarity index 100% rename from tests/09_DeePKS/102_NO_GO_deepks_scf/KPT rename to tests/09_DeePKS/13_NO_GO_deepks_bandgap_3/KPT diff --git a/tests/09_DeePKS/103_NO_GO_deepks_bandgap_3/README b/tests/09_DeePKS/13_NO_GO_deepks_bandgap_3/README similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_bandgap_3/README rename to tests/09_DeePKS/13_NO_GO_deepks_bandgap_3/README diff --git a/tests/09_DeePKS/103_NO_GO_deepks_bandgap_3/STRU b/tests/09_DeePKS/13_NO_GO_deepks_bandgap_3/STRU similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_bandgap_3/STRU rename to tests/09_DeePKS/13_NO_GO_deepks_bandgap_3/STRU diff --git a/tests/09_DeePKS/103_NO_GO_deepks_bandgap_3/result.ref b/tests/09_DeePKS/13_NO_GO_deepks_bandgap_3/result.ref similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_bandgap_3/result.ref rename to tests/09_DeePKS/13_NO_GO_deepks_bandgap_3/result.ref diff --git a/tests/09_DeePKS/103_NO_KP_deepks_bandgap/INPUT b/tests/09_DeePKS/14_NO_KP_deepks_bandgap/INPUT similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_bandgap/INPUT rename to tests/09_DeePKS/14_NO_KP_deepks_bandgap/INPUT diff --git a/tests/09_DeePKS/103_NO_KP_deepks_bandgap/KPT b/tests/09_DeePKS/14_NO_KP_deepks_bandgap/KPT similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_bandgap/KPT rename to tests/09_DeePKS/14_NO_KP_deepks_bandgap/KPT diff --git a/tests/09_DeePKS/103_NO_KP_deepks_bandgap/README b/tests/09_DeePKS/14_NO_KP_deepks_bandgap/README similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_bandgap/README rename to tests/09_DeePKS/14_NO_KP_deepks_bandgap/README diff --git a/tests/09_DeePKS/103_NO_KP_deepks_bandgap/STRU b/tests/09_DeePKS/14_NO_KP_deepks_bandgap/STRU similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_bandgap/STRU rename to tests/09_DeePKS/14_NO_KP_deepks_bandgap/STRU diff --git a/tests/09_DeePKS/103_NO_KP_deepks_bandgap/result.ref b/tests/09_DeePKS/14_NO_KP_deepks_bandgap/result.ref similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_bandgap/result.ref rename to tests/09_DeePKS/14_NO_KP_deepks_bandgap/result.ref diff --git a/tests/09_DeePKS/103_NO_KP_deepks_bandgap_2/INPUT b/tests/09_DeePKS/15_NO_KP_deepks_bandgap_2/INPUT similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_bandgap_2/INPUT rename to tests/09_DeePKS/15_NO_KP_deepks_bandgap_2/INPUT diff --git a/tests/09_DeePKS/103_NO_KP_deepks_bandgap_2/KPT b/tests/09_DeePKS/15_NO_KP_deepks_bandgap_2/KPT similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_bandgap_2/KPT rename to tests/09_DeePKS/15_NO_KP_deepks_bandgap_2/KPT diff --git a/tests/09_DeePKS/103_NO_KP_deepks_bandgap_2/README b/tests/09_DeePKS/15_NO_KP_deepks_bandgap_2/README similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_bandgap_2/README rename to tests/09_DeePKS/15_NO_KP_deepks_bandgap_2/README diff --git a/tests/09_DeePKS/103_NO_KP_deepks_bandgap_2/STRU b/tests/09_DeePKS/15_NO_KP_deepks_bandgap_2/STRU similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_bandgap_2/STRU rename to tests/09_DeePKS/15_NO_KP_deepks_bandgap_2/STRU diff --git a/tests/09_DeePKS/103_NO_KP_deepks_bandgap_2/result.ref b/tests/09_DeePKS/15_NO_KP_deepks_bandgap_2/result.ref similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_bandgap_2/result.ref rename to tests/09_DeePKS/15_NO_KP_deepks_bandgap_2/result.ref diff --git a/tests/09_DeePKS/103_NO_KP_deepks_bandgap_3/INPUT b/tests/09_DeePKS/16_NO_KP_deepks_bandgap_3/INPUT similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_bandgap_3/INPUT rename to tests/09_DeePKS/16_NO_KP_deepks_bandgap_3/INPUT diff --git a/tests/09_DeePKS/103_NO_KP_deepks_bandgap_3/KPT b/tests/09_DeePKS/16_NO_KP_deepks_bandgap_3/KPT similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_bandgap_3/KPT rename to tests/09_DeePKS/16_NO_KP_deepks_bandgap_3/KPT diff --git a/tests/09_DeePKS/103_NO_KP_deepks_bandgap_3/README b/tests/09_DeePKS/16_NO_KP_deepks_bandgap_3/README similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_bandgap_3/README rename to tests/09_DeePKS/16_NO_KP_deepks_bandgap_3/README diff --git a/tests/09_DeePKS/103_NO_KP_deepks_bandgap_3/STRU b/tests/09_DeePKS/16_NO_KP_deepks_bandgap_3/STRU similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_bandgap_3/STRU rename to tests/09_DeePKS/16_NO_KP_deepks_bandgap_3/STRU diff --git a/tests/09_DeePKS/103_NO_KP_deepks_bandgap_3/result.ref b/tests/09_DeePKS/16_NO_KP_deepks_bandgap_3/result.ref similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_bandgap_3/result.ref rename to tests/09_DeePKS/16_NO_KP_deepks_bandgap_3/result.ref diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_1/INPUT b/tests/09_DeePKS/17_NO_GO_deepks_vdelta_1/INPUT similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_1/INPUT rename to tests/09_DeePKS/17_NO_GO_deepks_vdelta_1/INPUT diff --git a/tests/09_DeePKS/103_NO_GO_deepks_bandgap/KPT b/tests/09_DeePKS/17_NO_GO_deepks_vdelta_1/KPT similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_bandgap/KPT rename to tests/09_DeePKS/17_NO_GO_deepks_vdelta_1/KPT diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_1/README b/tests/09_DeePKS/17_NO_GO_deepks_vdelta_1/README similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_1/README rename to tests/09_DeePKS/17_NO_GO_deepks_vdelta_1/README diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_1/STRU b/tests/09_DeePKS/17_NO_GO_deepks_vdelta_1/STRU similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_1/STRU rename to tests/09_DeePKS/17_NO_GO_deepks_vdelta_1/STRU diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_1/result.ref b/tests/09_DeePKS/17_NO_GO_deepks_vdelta_1/result.ref similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_1/result.ref rename to tests/09_DeePKS/17_NO_GO_deepks_vdelta_1/result.ref diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_2/INPUT b/tests/09_DeePKS/18_NO_GO_deepks_vdelta_2/INPUT similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_2/INPUT rename to tests/09_DeePKS/18_NO_GO_deepks_vdelta_2/INPUT diff --git a/tests/09_DeePKS/103_NO_GO_deepks_bandgap_2/KPT b/tests/09_DeePKS/18_NO_GO_deepks_vdelta_2/KPT similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_bandgap_2/KPT rename to tests/09_DeePKS/18_NO_GO_deepks_vdelta_2/KPT diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_2/README b/tests/09_DeePKS/18_NO_GO_deepks_vdelta_2/README similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_2/README rename to tests/09_DeePKS/18_NO_GO_deepks_vdelta_2/README diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_2/STRU b/tests/09_DeePKS/18_NO_GO_deepks_vdelta_2/STRU similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_2/STRU rename to tests/09_DeePKS/18_NO_GO_deepks_vdelta_2/STRU diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_2/result.ref b/tests/09_DeePKS/18_NO_GO_deepks_vdelta_2/result.ref similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_2/result.ref rename to tests/09_DeePKS/18_NO_GO_deepks_vdelta_2/result.ref diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_1/INPUT b/tests/09_DeePKS/19_NO_KP_deepks_vdelta_1/INPUT similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_1/INPUT rename to tests/09_DeePKS/19_NO_KP_deepks_vdelta_1/INPUT diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_1/KPT b/tests/09_DeePKS/19_NO_KP_deepks_vdelta_1/KPT similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_1/KPT rename to tests/09_DeePKS/19_NO_KP_deepks_vdelta_1/KPT diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_1/README b/tests/09_DeePKS/19_NO_KP_deepks_vdelta_1/README similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_1/README rename to tests/09_DeePKS/19_NO_KP_deepks_vdelta_1/README diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_1/STRU b/tests/09_DeePKS/19_NO_KP_deepks_vdelta_1/STRU similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_1/STRU rename to tests/09_DeePKS/19_NO_KP_deepks_vdelta_1/STRU diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_1/result.ref b/tests/09_DeePKS/19_NO_KP_deepks_vdelta_1/result.ref similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_1/result.ref rename to tests/09_DeePKS/19_NO_KP_deepks_vdelta_1/result.ref diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_2/INPUT b/tests/09_DeePKS/20_NO_KP_deepks_vdelta_2/INPUT similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_2/INPUT rename to tests/09_DeePKS/20_NO_KP_deepks_vdelta_2/INPUT diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_2/KPT b/tests/09_DeePKS/20_NO_KP_deepks_vdelta_2/KPT similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_2/KPT rename to tests/09_DeePKS/20_NO_KP_deepks_vdelta_2/KPT diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_2/README b/tests/09_DeePKS/20_NO_KP_deepks_vdelta_2/README similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_2/README rename to tests/09_DeePKS/20_NO_KP_deepks_vdelta_2/README diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_2/STRU b/tests/09_DeePKS/20_NO_KP_deepks_vdelta_2/STRU similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_2/STRU rename to tests/09_DeePKS/20_NO_KP_deepks_vdelta_2/STRU diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_2/result.ref b/tests/09_DeePKS/20_NO_KP_deepks_vdelta_2/result.ref similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_2/result.ref rename to tests/09_DeePKS/20_NO_KP_deepks_vdelta_2/result.ref diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_1/INPUT b/tests/09_DeePKS/21_NO_GO_deepks_vdelta_r_1/INPUT similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_1/INPUT rename to tests/09_DeePKS/21_NO_GO_deepks_vdelta_r_1/INPUT diff --git a/tests/09_DeePKS/103_NO_GO_deepks_bandgap_3/KPT b/tests/09_DeePKS/21_NO_GO_deepks_vdelta_r_1/KPT similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_bandgap_3/KPT rename to tests/09_DeePKS/21_NO_GO_deepks_vdelta_r_1/KPT diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_1/README b/tests/09_DeePKS/21_NO_GO_deepks_vdelta_r_1/README similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_1/README rename to tests/09_DeePKS/21_NO_GO_deepks_vdelta_r_1/README diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_1/STRU b/tests/09_DeePKS/21_NO_GO_deepks_vdelta_r_1/STRU similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_1/STRU rename to tests/09_DeePKS/21_NO_GO_deepks_vdelta_r_1/STRU diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_1/deepks_hrdelta.csr.ref b/tests/09_DeePKS/21_NO_GO_deepks_vdelta_r_1/deepks_hrdelta.csr.ref similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_1/deepks_hrdelta.csr.ref rename to tests/09_DeePKS/21_NO_GO_deepks_vdelta_r_1/deepks_hrdelta.csr.ref diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_1/deepks_hrtot.csr.ref b/tests/09_DeePKS/21_NO_GO_deepks_vdelta_r_1/deepks_hrtot.csr.ref similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_1/deepks_hrtot.csr.ref rename to tests/09_DeePKS/21_NO_GO_deepks_vdelta_r_1/deepks_hrtot.csr.ref diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_1/result.ref b/tests/09_DeePKS/21_NO_GO_deepks_vdelta_r_1/result.ref similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_1/result.ref rename to tests/09_DeePKS/21_NO_GO_deepks_vdelta_r_1/result.ref diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_2/INPUT b/tests/09_DeePKS/22_NO_GO_deepks_vdelta_r_2/INPUT similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_2/INPUT rename to tests/09_DeePKS/22_NO_GO_deepks_vdelta_r_2/INPUT diff --git a/tests/09_DeePKS/103_NO_GO_deepks_basic/KPT b/tests/09_DeePKS/22_NO_GO_deepks_vdelta_r_2/KPT similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_basic/KPT rename to tests/09_DeePKS/22_NO_GO_deepks_vdelta_r_2/KPT diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_2/README b/tests/09_DeePKS/22_NO_GO_deepks_vdelta_r_2/README similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_2/README rename to tests/09_DeePKS/22_NO_GO_deepks_vdelta_r_2/README diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_2/STRU b/tests/09_DeePKS/22_NO_GO_deepks_vdelta_r_2/STRU similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_2/STRU rename to tests/09_DeePKS/22_NO_GO_deepks_vdelta_r_2/STRU diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_2/deepks_hrdelta.csr.ref b/tests/09_DeePKS/22_NO_GO_deepks_vdelta_r_2/deepks_hrdelta.csr.ref similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_2/deepks_hrdelta.csr.ref rename to tests/09_DeePKS/22_NO_GO_deepks_vdelta_r_2/deepks_hrdelta.csr.ref diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_2/deepks_hrtot.csr.ref b/tests/09_DeePKS/22_NO_GO_deepks_vdelta_r_2/deepks_hrtot.csr.ref similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_2/deepks_hrtot.csr.ref rename to tests/09_DeePKS/22_NO_GO_deepks_vdelta_r_2/deepks_hrtot.csr.ref diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_2/result.ref b/tests/09_DeePKS/22_NO_GO_deepks_vdelta_r_2/result.ref similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_2/result.ref rename to tests/09_DeePKS/22_NO_GO_deepks_vdelta_r_2/result.ref diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_1/INPUT b/tests/09_DeePKS/23_NO_KP_deepks_vdelta_r_1/INPUT similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_1/INPUT rename to tests/09_DeePKS/23_NO_KP_deepks_vdelta_r_1/INPUT diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_1/KPT b/tests/09_DeePKS/23_NO_KP_deepks_vdelta_r_1/KPT similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_1/KPT rename to tests/09_DeePKS/23_NO_KP_deepks_vdelta_r_1/KPT diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_1/README b/tests/09_DeePKS/23_NO_KP_deepks_vdelta_r_1/README similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_1/README rename to tests/09_DeePKS/23_NO_KP_deepks_vdelta_r_1/README diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_1/STRU b/tests/09_DeePKS/23_NO_KP_deepks_vdelta_r_1/STRU similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_1/STRU rename to tests/09_DeePKS/23_NO_KP_deepks_vdelta_r_1/STRU diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_1/deepks_hrdelta.csr.ref b/tests/09_DeePKS/23_NO_KP_deepks_vdelta_r_1/deepks_hrdelta.csr.ref similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_1/deepks_hrdelta.csr.ref rename to tests/09_DeePKS/23_NO_KP_deepks_vdelta_r_1/deepks_hrdelta.csr.ref diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_1/deepks_hrtot.csr.ref b/tests/09_DeePKS/23_NO_KP_deepks_vdelta_r_1/deepks_hrtot.csr.ref similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_1/deepks_hrtot.csr.ref rename to tests/09_DeePKS/23_NO_KP_deepks_vdelta_r_1/deepks_hrtot.csr.ref diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_1/result.ref b/tests/09_DeePKS/23_NO_KP_deepks_vdelta_r_1/result.ref similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_1/result.ref rename to tests/09_DeePKS/23_NO_KP_deepks_vdelta_r_1/result.ref diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_2/INPUT b/tests/09_DeePKS/24_NO_KP_deepks_vdelta_r_2/INPUT similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_2/INPUT rename to tests/09_DeePKS/24_NO_KP_deepks_vdelta_r_2/INPUT diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_2/KPT b/tests/09_DeePKS/24_NO_KP_deepks_vdelta_r_2/KPT similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_2/KPT rename to tests/09_DeePKS/24_NO_KP_deepks_vdelta_r_2/KPT diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_2/README b/tests/09_DeePKS/24_NO_KP_deepks_vdelta_r_2/README similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_2/README rename to tests/09_DeePKS/24_NO_KP_deepks_vdelta_r_2/README diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_2/STRU b/tests/09_DeePKS/24_NO_KP_deepks_vdelta_r_2/STRU similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_2/STRU rename to tests/09_DeePKS/24_NO_KP_deepks_vdelta_r_2/STRU diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_2/deepks_hrdelta.csr.ref b/tests/09_DeePKS/24_NO_KP_deepks_vdelta_r_2/deepks_hrdelta.csr.ref similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_2/deepks_hrdelta.csr.ref rename to tests/09_DeePKS/24_NO_KP_deepks_vdelta_r_2/deepks_hrdelta.csr.ref diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_2/deepks_hrtot.csr.ref b/tests/09_DeePKS/24_NO_KP_deepks_vdelta_r_2/deepks_hrtot.csr.ref similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_2/deepks_hrtot.csr.ref rename to tests/09_DeePKS/24_NO_KP_deepks_vdelta_r_2/deepks_hrtot.csr.ref diff --git a/tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_2/result.ref b/tests/09_DeePKS/24_NO_KP_deepks_vdelta_r_2/result.ref similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_vdelta_r_2/result.ref rename to tests/09_DeePKS/24_NO_KP_deepks_vdelta_r_2/result.ref diff --git a/tests/09_DeePKS/103_NO_GO_deepks_out_freq_elec/INPUT b/tests/09_DeePKS/25_NO_GO_deepks_out_freq_elec/INPUT similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_out_freq_elec/INPUT rename to tests/09_DeePKS/25_NO_GO_deepks_out_freq_elec/INPUT diff --git a/tests/09_DeePKS/103_NO_GO_deepks_out_freq_elec/KPT b/tests/09_DeePKS/25_NO_GO_deepks_out_freq_elec/KPT similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_out_freq_elec/KPT rename to tests/09_DeePKS/25_NO_GO_deepks_out_freq_elec/KPT diff --git a/tests/09_DeePKS/103_NO_GO_deepks_out_freq_elec/README b/tests/09_DeePKS/25_NO_GO_deepks_out_freq_elec/README similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_out_freq_elec/README rename to tests/09_DeePKS/25_NO_GO_deepks_out_freq_elec/README diff --git a/tests/09_DeePKS/103_NO_GO_deepks_out_freq_elec/STRU b/tests/09_DeePKS/25_NO_GO_deepks_out_freq_elec/STRU similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_out_freq_elec/STRU rename to tests/09_DeePKS/25_NO_GO_deepks_out_freq_elec/STRU diff --git a/tests/09_DeePKS/103_NO_GO_deepks_out_freq_elec/result.ref b/tests/09_DeePKS/25_NO_GO_deepks_out_freq_elec/result.ref similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_out_freq_elec/result.ref rename to tests/09_DeePKS/25_NO_GO_deepks_out_freq_elec/result.ref diff --git a/tests/09_DeePKS/103_NO_KP_deepks_out_freq_elec/INPUT b/tests/09_DeePKS/26_NO_KP_deepks_out_freq_elec/INPUT similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_out_freq_elec/INPUT rename to tests/09_DeePKS/26_NO_KP_deepks_out_freq_elec/INPUT diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_1/KPT b/tests/09_DeePKS/26_NO_KP_deepks_out_freq_elec/KPT similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_1/KPT rename to tests/09_DeePKS/26_NO_KP_deepks_out_freq_elec/KPT diff --git a/tests/09_DeePKS/103_NO_KP_deepks_out_freq_elec/README b/tests/09_DeePKS/26_NO_KP_deepks_out_freq_elec/README similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_out_freq_elec/README rename to tests/09_DeePKS/26_NO_KP_deepks_out_freq_elec/README diff --git a/tests/09_DeePKS/103_NO_KP_deepks_out_freq_elec/STRU b/tests/09_DeePKS/26_NO_KP_deepks_out_freq_elec/STRU similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_out_freq_elec/STRU rename to tests/09_DeePKS/26_NO_KP_deepks_out_freq_elec/STRU diff --git a/tests/09_DeePKS/103_NO_KP_deepks_out_freq_elec/result.ref b/tests/09_DeePKS/26_NO_KP_deepks_out_freq_elec/result.ref similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_out_freq_elec/result.ref rename to tests/09_DeePKS/26_NO_KP_deepks_out_freq_elec/result.ref diff --git a/tests/09_DeePKS/104_NO_GO_deepks_out_2/INPUT b/tests/09_DeePKS/27_NO_GO_deepks_out_2/INPUT similarity index 100% rename from tests/09_DeePKS/104_NO_GO_deepks_out_2/INPUT rename to tests/09_DeePKS/27_NO_GO_deepks_out_2/INPUT diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_2/KPT b/tests/09_DeePKS/27_NO_GO_deepks_out_2/KPT similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_2/KPT rename to tests/09_DeePKS/27_NO_GO_deepks_out_2/KPT diff --git a/tests/09_DeePKS/104_NO_GO_deepks_out_2/README b/tests/09_DeePKS/27_NO_GO_deepks_out_2/README similarity index 100% rename from tests/09_DeePKS/104_NO_GO_deepks_out_2/README rename to tests/09_DeePKS/27_NO_GO_deepks_out_2/README diff --git a/tests/09_DeePKS/104_NO_GO_deepks_out_2/STRU b/tests/09_DeePKS/27_NO_GO_deepks_out_2/STRU similarity index 100% rename from tests/09_DeePKS/104_NO_GO_deepks_out_2/STRU rename to tests/09_DeePKS/27_NO_GO_deepks_out_2/STRU diff --git a/tests/09_DeePKS/104_NO_GO_deepks_out_2/result.ref b/tests/09_DeePKS/27_NO_GO_deepks_out_2/result.ref similarity index 100% rename from tests/09_DeePKS/104_NO_GO_deepks_out_2/result.ref rename to tests/09_DeePKS/27_NO_GO_deepks_out_2/result.ref diff --git a/tests/09_DeePKS/104_NO_KP_deepks_out_2/INPUT b/tests/09_DeePKS/28_NO_KP_deepks_out_2/INPUT similarity index 100% rename from tests/09_DeePKS/104_NO_KP_deepks_out_2/INPUT rename to tests/09_DeePKS/28_NO_KP_deepks_out_2/INPUT diff --git a/tests/09_DeePKS/104_NO_KP_deepks_out_2/KPT b/tests/09_DeePKS/28_NO_KP_deepks_out_2/KPT similarity index 100% rename from tests/09_DeePKS/104_NO_KP_deepks_out_2/KPT rename to tests/09_DeePKS/28_NO_KP_deepks_out_2/KPT diff --git a/tests/09_DeePKS/104_NO_KP_deepks_out_2/README b/tests/09_DeePKS/28_NO_KP_deepks_out_2/README similarity index 100% rename from tests/09_DeePKS/104_NO_KP_deepks_out_2/README rename to tests/09_DeePKS/28_NO_KP_deepks_out_2/README diff --git a/tests/09_DeePKS/104_NO_KP_deepks_out_2/STRU b/tests/09_DeePKS/28_NO_KP_deepks_out_2/STRU similarity index 100% rename from tests/09_DeePKS/104_NO_KP_deepks_out_2/STRU rename to tests/09_DeePKS/28_NO_KP_deepks_out_2/STRU diff --git a/tests/09_DeePKS/104_NO_KP_deepks_out_2/result.ref b/tests/09_DeePKS/28_NO_KP_deepks_out_2/result.ref similarity index 100% rename from tests/09_DeePKS/104_NO_KP_deepks_out_2/result.ref rename to tests/09_DeePKS/28_NO_KP_deepks_out_2/result.ref diff --git a/tests/09_DeePKS/101_PW_ORB_deepks_s/INPUT b/tests/09_DeePKS/97_PW_ORB_deepks_s/INPUT similarity index 100% rename from tests/09_DeePKS/101_PW_ORB_deepks_s/INPUT rename to tests/09_DeePKS/97_PW_ORB_deepks_s/INPUT diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_1/KPT b/tests/09_DeePKS/97_PW_ORB_deepks_s/KPT similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_1/KPT rename to tests/09_DeePKS/97_PW_ORB_deepks_s/KPT diff --git a/tests/09_DeePKS/101_PW_ORB_deepks_d/README b/tests/09_DeePKS/97_PW_ORB_deepks_s/README similarity index 100% rename from tests/09_DeePKS/101_PW_ORB_deepks_d/README rename to tests/09_DeePKS/97_PW_ORB_deepks_s/README diff --git a/tests/09_DeePKS/101_PW_ORB_deepks_s/STRU b/tests/09_DeePKS/97_PW_ORB_deepks_s/STRU similarity index 100% rename from tests/09_DeePKS/101_PW_ORB_deepks_s/STRU rename to tests/09_DeePKS/97_PW_ORB_deepks_s/STRU diff --git a/tests/09_DeePKS/101_PW_ORB_deepks_s/descriptor.dat.ref b/tests/09_DeePKS/97_PW_ORB_deepks_s/descriptor.dat.ref similarity index 100% rename from tests/09_DeePKS/101_PW_ORB_deepks_s/descriptor.dat.ref rename to tests/09_DeePKS/97_PW_ORB_deepks_s/descriptor.dat.ref diff --git a/tests/09_DeePKS/101_PW_ORB_deepks_s/jle.orb.ref b/tests/09_DeePKS/97_PW_ORB_deepks_s/jle.orb.ref similarity index 100% rename from tests/09_DeePKS/101_PW_ORB_deepks_s/jle.orb.ref rename to tests/09_DeePKS/97_PW_ORB_deepks_s/jle.orb.ref diff --git a/tests/09_DeePKS/101_PW_ORB_deepks_s/result.ref b/tests/09_DeePKS/97_PW_ORB_deepks_s/result.ref similarity index 100% rename from tests/09_DeePKS/101_PW_ORB_deepks_s/result.ref rename to tests/09_DeePKS/97_PW_ORB_deepks_s/result.ref diff --git a/tests/09_DeePKS/101_PW_ORB_deepks_p/INPUT b/tests/09_DeePKS/98_PW_ORB_deepks_p/INPUT similarity index 100% rename from tests/09_DeePKS/101_PW_ORB_deepks_p/INPUT rename to tests/09_DeePKS/98_PW_ORB_deepks_p/INPUT diff --git a/tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_2/KPT b/tests/09_DeePKS/98_PW_ORB_deepks_p/KPT similarity index 100% rename from tests/09_DeePKS/103_NO_GO_deepks_vdelta_r_2/KPT rename to tests/09_DeePKS/98_PW_ORB_deepks_p/KPT diff --git a/tests/09_DeePKS/101_PW_ORB_deepks_p/README b/tests/09_DeePKS/98_PW_ORB_deepks_p/README similarity index 100% rename from tests/09_DeePKS/101_PW_ORB_deepks_p/README rename to tests/09_DeePKS/98_PW_ORB_deepks_p/README diff --git a/tests/09_DeePKS/101_PW_ORB_deepks_d/STRU b/tests/09_DeePKS/98_PW_ORB_deepks_p/STRU similarity index 100% rename from tests/09_DeePKS/101_PW_ORB_deepks_d/STRU rename to tests/09_DeePKS/98_PW_ORB_deepks_p/STRU diff --git a/tests/09_DeePKS/101_PW_ORB_deepks_p/descriptor.dat.ref b/tests/09_DeePKS/98_PW_ORB_deepks_p/descriptor.dat.ref similarity index 100% rename from tests/09_DeePKS/101_PW_ORB_deepks_p/descriptor.dat.ref rename to tests/09_DeePKS/98_PW_ORB_deepks_p/descriptor.dat.ref diff --git a/tests/09_DeePKS/101_PW_ORB_deepks_p/jle.orb.ref b/tests/09_DeePKS/98_PW_ORB_deepks_p/jle.orb.ref similarity index 100% rename from tests/09_DeePKS/101_PW_ORB_deepks_p/jle.orb.ref rename to tests/09_DeePKS/98_PW_ORB_deepks_p/jle.orb.ref diff --git a/tests/09_DeePKS/101_PW_ORB_deepks_p/result.ref b/tests/09_DeePKS/98_PW_ORB_deepks_p/result.ref similarity index 100% rename from tests/09_DeePKS/101_PW_ORB_deepks_p/result.ref rename to tests/09_DeePKS/98_PW_ORB_deepks_p/result.ref diff --git a/tests/09_DeePKS/101_PW_ORB_deepks_d/INPUT b/tests/09_DeePKS/99_PW_ORB_deepks_d/INPUT similarity index 100% rename from tests/09_DeePKS/101_PW_ORB_deepks_d/INPUT rename to tests/09_DeePKS/99_PW_ORB_deepks_d/INPUT diff --git a/tests/09_DeePKS/103_NO_KP_deepks_out_freq_elec/KPT b/tests/09_DeePKS/99_PW_ORB_deepks_d/KPT similarity index 100% rename from tests/09_DeePKS/103_NO_KP_deepks_out_freq_elec/KPT rename to tests/09_DeePKS/99_PW_ORB_deepks_d/KPT diff --git a/tests/09_DeePKS/101_PW_ORB_deepks_s/README b/tests/09_DeePKS/99_PW_ORB_deepks_d/README similarity index 100% rename from tests/09_DeePKS/101_PW_ORB_deepks_s/README rename to tests/09_DeePKS/99_PW_ORB_deepks_d/README diff --git a/tests/09_DeePKS/101_PW_ORB_deepks_p/STRU b/tests/09_DeePKS/99_PW_ORB_deepks_d/STRU similarity index 100% rename from tests/09_DeePKS/101_PW_ORB_deepks_p/STRU rename to tests/09_DeePKS/99_PW_ORB_deepks_d/STRU diff --git a/tests/09_DeePKS/101_PW_ORB_deepks_d/descriptor.dat.ref b/tests/09_DeePKS/99_PW_ORB_deepks_d/descriptor.dat.ref similarity index 100% rename from tests/09_DeePKS/101_PW_ORB_deepks_d/descriptor.dat.ref rename to tests/09_DeePKS/99_PW_ORB_deepks_d/descriptor.dat.ref diff --git a/tests/09_DeePKS/101_PW_ORB_deepks_d/jle.orb.ref b/tests/09_DeePKS/99_PW_ORB_deepks_d/jle.orb.ref similarity index 100% rename from tests/09_DeePKS/101_PW_ORB_deepks_d/jle.orb.ref rename to tests/09_DeePKS/99_PW_ORB_deepks_d/jle.orb.ref diff --git a/tests/09_DeePKS/101_PW_ORB_deepks_d/result.ref b/tests/09_DeePKS/99_PW_ORB_deepks_d/result.ref similarity index 100% rename from tests/09_DeePKS/101_PW_ORB_deepks_d/result.ref rename to tests/09_DeePKS/99_PW_ORB_deepks_d/result.ref diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/E_delta_bands_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/E_delta_bands_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/E_delta_bands_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/E_delta_bands_ref.dat diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/E_delta_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/E_delta_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/E_delta_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/E_delta_ref.dat diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/F_delta_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/F_delta_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/F_delta_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/F_delta_ref.dat diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/INPUT b/tests/09_DeePKS/NO_GO_deepks_UT/INPUT similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/INPUT rename to tests/09_DeePKS/NO_GO_deepks_UT/INPUT diff --git a/tests/09_DeePKS/104_NO_GO_deepks_out_2/KPT b/tests/09_DeePKS/NO_GO_deepks_UT/KPT similarity index 100% rename from tests/09_DeePKS/104_NO_GO_deepks_out_2/KPT rename to tests/09_DeePKS/NO_GO_deepks_UT/KPT diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/STRU b/tests/09_DeePKS/NO_GO_deepks_UT/STRU similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/STRU rename to tests/09_DeePKS/NO_GO_deepks_UT/STRU diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/S_I_mu_alpha_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/S_I_mu_alpha_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/S_I_mu_alpha_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/S_I_mu_alpha_ref.dat diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/descriptor_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/descriptor_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/descriptor_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/descriptor_ref.dat diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/dm b/tests/09_DeePKS/NO_GO_deepks_UT/dm similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/dm rename to tests/09_DeePKS/NO_GO_deepks_UT/dm diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/dphialpha_x_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/dphialpha_x_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/dphialpha_x_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/dphialpha_x_ref.dat diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/dphialpha_y_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/dphialpha_y_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/dphialpha_y_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/dphialpha_y_ref.dat diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/dphialpha_z_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/dphialpha_z_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/dphialpha_z_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/dphialpha_z_ref.dat diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/gdmepsl_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/gdmepsl_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/gdmepsl_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/gdmepsl_ref.dat diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/gdmx_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/gdmx_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/gdmx_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/gdmx_ref.dat diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/gedm_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/gedm_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/gedm_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/gedm_ref.dat diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/gvepsl_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/gvepsl_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/gvepsl_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/gvepsl_ref.dat diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/gvx_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/gvx_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/gvx_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/gvx_ref.dat diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/iRmat_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/iRmat_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/iRmat_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/iRmat_ref.dat diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/jle.orb b/tests/09_DeePKS/NO_GO_deepks_UT/jle.orb similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/jle.orb rename to tests/09_DeePKS/NO_GO_deepks_UT/jle.orb diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/model.ptg b/tests/09_DeePKS/NO_GO_deepks_UT/model.ptg similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/model.ptg rename to tests/09_DeePKS/NO_GO_deepks_UT/model.ptg diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/o_delta_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/o_delta_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/o_delta_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/o_delta_ref.dat diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/orbpre_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/orbpre_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/orbpre_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/orbpre_ref.dat diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/pdm_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/pdm_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/pdm_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/pdm_ref.dat diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/phialpha_r_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/phialpha_r_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/phialpha_r_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/phialpha_r_ref.dat diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/phialpha_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/phialpha_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/phialpha_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/phialpha_ref.dat diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/stress_delta_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/stress_delta_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/stress_delta_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/stress_delta_ref.dat diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/vdpre_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/vdpre_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/vdpre_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/vdpre_ref.dat diff --git a/tests/09_DeePKS/100_NO_GO_deepks_UT/vdrpre_ref.dat b/tests/09_DeePKS/NO_GO_deepks_UT/vdrpre_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_GO_deepks_UT/vdrpre_ref.dat rename to tests/09_DeePKS/NO_GO_deepks_UT/vdrpre_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/E_delta_bands_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/E_delta_bands_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/E_delta_bands_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/E_delta_bands_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/E_delta_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/E_delta_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/E_delta_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/E_delta_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/F_delta_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/F_delta_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/F_delta_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/F_delta_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/INPUT b/tests/09_DeePKS/NO_KP_deepks_UT/INPUT similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/INPUT rename to tests/09_DeePKS/NO_KP_deepks_UT/INPUT diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/KPT b/tests/09_DeePKS/NO_KP_deepks_UT/KPT similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/KPT rename to tests/09_DeePKS/NO_KP_deepks_UT/KPT diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/STRU b/tests/09_DeePKS/NO_KP_deepks_UT/STRU similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/STRU rename to tests/09_DeePKS/NO_KP_deepks_UT/STRU diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/S_I_mu_alpha_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/S_I_mu_alpha_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/S_I_mu_alpha_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/S_I_mu_alpha_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/descriptor_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/descriptor_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/descriptor_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/descriptor_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/dm_0 b/tests/09_DeePKS/NO_KP_deepks_UT/dm_0 similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/dm_0 rename to tests/09_DeePKS/NO_KP_deepks_UT/dm_0 diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/dm_1 b/tests/09_DeePKS/NO_KP_deepks_UT/dm_1 similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/dm_1 rename to tests/09_DeePKS/NO_KP_deepks_UT/dm_1 diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/dm_2 b/tests/09_DeePKS/NO_KP_deepks_UT/dm_2 similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/dm_2 rename to tests/09_DeePKS/NO_KP_deepks_UT/dm_2 diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/dm_3 b/tests/09_DeePKS/NO_KP_deepks_UT/dm_3 similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/dm_3 rename to tests/09_DeePKS/NO_KP_deepks_UT/dm_3 diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/dm_4 b/tests/09_DeePKS/NO_KP_deepks_UT/dm_4 similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/dm_4 rename to tests/09_DeePKS/NO_KP_deepks_UT/dm_4 diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/dm_5 b/tests/09_DeePKS/NO_KP_deepks_UT/dm_5 similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/dm_5 rename to tests/09_DeePKS/NO_KP_deepks_UT/dm_5 diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/dm_6 b/tests/09_DeePKS/NO_KP_deepks_UT/dm_6 similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/dm_6 rename to tests/09_DeePKS/NO_KP_deepks_UT/dm_6 diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/dm_7 b/tests/09_DeePKS/NO_KP_deepks_UT/dm_7 similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/dm_7 rename to tests/09_DeePKS/NO_KP_deepks_UT/dm_7 diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/dm_8 b/tests/09_DeePKS/NO_KP_deepks_UT/dm_8 similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/dm_8 rename to tests/09_DeePKS/NO_KP_deepks_UT/dm_8 diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/dphialpha_x_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/dphialpha_x_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/dphialpha_x_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/dphialpha_x_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/dphialpha_y_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/dphialpha_y_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/dphialpha_y_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/dphialpha_y_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/dphialpha_z_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/dphialpha_z_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/dphialpha_z_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/dphialpha_z_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/gdmepsl_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/gdmepsl_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/gdmepsl_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/gdmepsl_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/gdmx_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/gdmx_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/gdmx_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/gdmx_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/gedm_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/gedm_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/gedm_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/gedm_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/gvepsl_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/gvepsl_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/gvepsl_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/gvepsl_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/gvx_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/gvx_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/gvx_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/gvx_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/iRmat_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/iRmat_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/iRmat_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/iRmat_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/jle.orb b/tests/09_DeePKS/NO_KP_deepks_UT/jle.orb similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/jle.orb rename to tests/09_DeePKS/NO_KP_deepks_UT/jle.orb diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/model.ptg b/tests/09_DeePKS/NO_KP_deepks_UT/model.ptg similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/model.ptg rename to tests/09_DeePKS/NO_KP_deepks_UT/model.ptg diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/o_delta_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/o_delta_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/o_delta_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/o_delta_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/orbpre_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/orbpre_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/orbpre_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/orbpre_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/pdm_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/pdm_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/pdm_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/pdm_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/phialpha_r_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/phialpha_r_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/phialpha_r_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/phialpha_r_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/phialpha_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/phialpha_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/phialpha_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/phialpha_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/stress_delta_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/stress_delta_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/stress_delta_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/stress_delta_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/vdpre_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/vdpre_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/vdpre_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/vdpre_ref.dat diff --git a/tests/09_DeePKS/100_NO_KP_deepks_UT/vdrpre_ref.dat b/tests/09_DeePKS/NO_KP_deepks_UT/vdrpre_ref.dat similarity index 100% rename from tests/09_DeePKS/100_NO_KP_deepks_UT/vdrpre_ref.dat rename to tests/09_DeePKS/NO_KP_deepks_UT/vdrpre_ref.dat From 054805ade350ae7a22cf542b916be63bc46df3a6 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Tue, 2 Dec 2025 16:21:30 +0800 Subject: [PATCH 28/36] update some small places --- source/source_esolver/esolver_ks.cpp | 10 ++-- source/source_esolver/esolver_ks_lcao.cpp | 2 +- source/source_esolver/esolver_of.cpp | 15 ++---- tests/09_DeePKS/97_PW_ORB_deepks_s/INPUT | 8 +-- tests/09_DeePKS/CASES1 | 4 +- tests/09_DeePKS/CASES_CPU.txt | 59 +++++++++++------------ 6 files changed, 43 insertions(+), 55 deletions(-) diff --git a/source/source_esolver/esolver_ks.cpp b/source/source_esolver/esolver_ks.cpp index 604c1569cc..166e7b3fb9 100644 --- a/source/source_esolver/esolver_ks.cpp +++ b/source/source_esolver/esolver_ks.cpp @@ -62,11 +62,7 @@ void ESolver_KS::before_all_runners(UnitCell& ucell, const Input_para // cell_factor this->ppcell.cell_factor = inp.cell_factor; - //! 3) setup Exc for the first element '0' (all elements have same exc) -// XC_Functional::set_xc_type(ucell.atoms[0].ncpp.xc_func); -// GlobalV::ofs_running<set_rhopw(this->pw_rho, this->pw_rhod); p_chgmix->set_mixing(inp.mixing_mode, inp.mixing_beta, inp.mixing_ndim, @@ -74,10 +70,10 @@ void ESolver_KS::before_all_runners(UnitCell& ucell, const Input_para inp.mixing_gg0_min, inp.mixing_angle, inp.mixing_dmr, ucell.omega, ucell.tpiba); p_chgmix->init_mixing(); - //! 5) setup plane wave for electronic wave functions + //! 4) setup plane wave for electronic wave functions pw::setup_pwwfc(inp, ucell, *this->pw_rho, this->kv, this->pw_wfc); - //! 6) read in charge density, mohan add 2025-11-28 + //! 5) read in charge density, mohan add 2025-11-28 //! Inititlize the charge density. this->chr.init_rho(ucell, this->Pgrid, this->sf.strucFac, ucell.symm, &this->kv, this->pw_wfc); this->chr.check_rho(); // check the rho diff --git a/source/source_esolver/esolver_ks_lcao.cpp b/source/source_esolver/esolver_ks_lcao.cpp index 8820ac7161..2e136bff76 100644 --- a/source/source_esolver/esolver_ks_lcao.cpp +++ b/source/source_esolver/esolver_ks_lcao.cpp @@ -160,7 +160,7 @@ void ESolver_KS_LCAO::before_scf(UnitCell& ucell, const int istep) // 11) set xc type before the first cal of xc in pelec->init_scf, Peize Lin add 2016-12-03 this->exx_nao.before_scf(ucell, this->kv, orb_, this->p_chgmix, istep, PARAM.inp); - // 12) init_scf, should be before_scf? mohan add 2025-03-10 + // 12) init_scf this->pelec->init_scf(ucell, this->Pgrid, this->sf.strucFac, this->locpp.numeric, ucell.symm); // 13) initalize DM(R), which has the same size with Hamiltonian(R) diff --git a/source/source_esolver/esolver_of.cpp b/source/source_esolver/esolver_of.cpp index a1a299d610..d36ed867f8 100644 --- a/source/source_esolver/esolver_of.cpp +++ b/source/source_esolver/esolver_of.cpp @@ -206,11 +206,9 @@ void ESolver_OF::before_opt(const int istep, UnitCell& ucell) // Refresh the arrays delete this->psi_; - this->psi_ = new psi::Psi(1, - PARAM.inp.nspin, - this->pw_rho->nrxx, - this->pw_rho->nrxx, - true); + this->psi_ = new psi::Psi(1, PARAM.inp.nspin, + this->pw_rho->nrxx, this->pw_rho->nrxx, true); + for (int is = 0; is < PARAM.inp.nspin; ++is) { this->pphi_[is] = this->psi_->get_pointer(is); @@ -568,11 +566,8 @@ void ESolver_OF::cal_stress(UnitCell& ucell, ModuleBase::matrix& stress) { ModuleBase::matrix kinetic_stress_; kinetic_stress_.create(3, 3); - this->kedf_manager_->get_stress(ucell.omega, - this->chr.rho, - this->pphi_, - this->pw_rho, - kinetic_stress_); // kinetic stress + this->kedf_manager_->get_stress(ucell.omega, this->chr.rho, + this->pphi_, this->pw_rho, kinetic_stress_); // kinetic stress OF_Stress_PW ss(this->pelec, this->pw_rho); ss.cal_stress(stress, kinetic_stress_, ucell, &ucell.symm, this->locpp, &sf, &kv); diff --git a/tests/09_DeePKS/97_PW_ORB_deepks_s/INPUT b/tests/09_DeePKS/97_PW_ORB_deepks_s/INPUT index 9f8840ad7b..c0676b867b 100644 --- a/tests/09_DeePKS/97_PW_ORB_deepks_s/INPUT +++ b/tests/09_DeePKS/97_PW_ORB_deepks_s/INPUT @@ -9,16 +9,16 @@ symmetry 0 #Parameters (2.Iteration) ecutwfc 20 -scf_thr 1e-8 -scf_nmax 50 +scf_thr 1e-8 +scf_nmax 50 #Parameters (3.Basis) basis_type pw gamma_only 1 #Parameters (4.Smearing) -smearing_method gaussian -smearing_sigma 0.1 +smearing_method gaussian +smearing_sigma 0.1 #Parameters (5.Mixing) mixing_type broyden diff --git a/tests/09_DeePKS/CASES1 b/tests/09_DeePKS/CASES1 index e22d970cbd..217c3b26c8 100644 --- a/tests/09_DeePKS/CASES1 +++ b/tests/09_DeePKS/CASES1 @@ -1,2 +1,2 @@ -100_NO_GO_deepks_UT -100_NO_KP_deepks_UT \ No newline at end of file +NO_GO_deepks_UT +NO_KP_deepks_UT diff --git a/tests/09_DeePKS/CASES_CPU.txt b/tests/09_DeePKS/CASES_CPU.txt index e90fd05bef..6d0393047d 100644 --- a/tests/09_DeePKS/CASES_CPU.txt +++ b/tests/09_DeePKS/CASES_CPU.txt @@ -1,31 +1,28 @@ -#101_PW_ORB_deepks_s -#101_PW_ORB_deepks_p -#101_PW_ORB_deepks_d -102_NO_GO_deepks_scf -102_NO_KP_deepks_scf -102_NO_GO_deepks_md -102_NO_KP_deepks_md -102_NO_GO_deepks_nscf -102_NO_KP_deepks_nscf -102_NO_GO_deepks_relax -102_NO_KP_deepks_relax -103_NO_GO_deepks_basic -103_NO_KP_deepks_basic -103_NO_GO_deepks_bandgap -103_NO_GO_deepks_bandgap_2 -103_NO_GO_deepks_bandgap_3 -103_NO_KP_deepks_bandgap -103_NO_KP_deepks_bandgap_2 -103_NO_KP_deepks_bandgap_3 -103_NO_GO_deepks_vdelta_1 -103_NO_KP_deepks_vdelta_1 -103_NO_GO_deepks_vdelta_2 -103_NO_KP_deepks_vdelta_2 -103_NO_GO_deepks_vdelta_r_1 -103_NO_KP_deepks_vdelta_r_1 -103_NO_GO_deepks_vdelta_r_2 -103_NO_KP_deepks_vdelta_r_2 -103_NO_GO_deepks_out_freq_elec -103_NO_KP_deepks_out_freq_elec -104_NO_GO_deepks_out_2 -104_NO_KP_deepks_out_2 \ No newline at end of file +01_NO_GO_deepks_scf +02_NO_KP_deepks_scf +03_NO_GO_deepks_md +04_NO_KP_deepks_md +05_NO_GO_deepks_nscf +06_NO_KP_deepks_nscf +07_NO_GO_deepks_relax +08_NO_KP_deepks_relax +09_NO_GO_deepks_basic +10_NO_KP_deepks_basic +11_NO_GO_deepks_bandgap +12_NO_GO_deepks_bandgap_2 +13_NO_GO_deepks_bandgap_3 +14_NO_KP_deepks_bandgap +15_NO_KP_deepks_bandgap_2 +16_NO_KP_deepks_bandgap_3 +17_NO_GO_deepks_vdelta_1 +18_NO_GO_deepks_vdelta_2 +19_NO_KP_deepks_vdelta_1 +20_NO_KP_deepks_vdelta_2 +21_NO_GO_deepks_vdelta_r_1 +22_NO_GO_deepks_vdelta_r_2 +23_NO_KP_deepks_vdelta_r_1 +24_NO_KP_deepks_vdelta_r_2 +25_NO_GO_deepks_out_freq_elec +26_NO_KP_deepks_out_freq_elec +27_NO_GO_deepks_out_2 +28_NO_KP_deepks_out_2 From 234aa3d0594f11c8ec5ee3d3db6bed8bc80c37be Mon Sep 17 00:00:00 2001 From: mohanchen Date: Tue, 2 Dec 2025 16:54:17 +0800 Subject: [PATCH 29/36] add of_print_info in ofdft directory and delete the function in esolver_of --- source/source_esolver/esolver_of.h | 3 - source/source_esolver/esolver_of_tool.cpp | 137 +----------------- .../source_pw/module_ofdft/of_print_info.cpp | 134 +++++++++++++++++ source/source_pw/module_ofdft/of_print_info.h | 13 ++ 4 files changed, 152 insertions(+), 135 deletions(-) create mode 100644 source/source_pw/module_ofdft/of_print_info.cpp create mode 100644 source/source_pw/module_ofdft/of_print_info.h diff --git a/source/source_esolver/esolver_of.h b/source/source_esolver/esolver_of.h index f35808cf1b..b94019d5fe 100644 --- a/source/source_esolver/esolver_of.h +++ b/source/source_esolver/esolver_of.h @@ -98,9 +98,6 @@ class ESolver_OF : public ESolver_FP void check_direction(double* dEdtheta, double** ptemp_phi, UnitCell& ucell); void test_direction(double* dEdtheta, double** ptemp_phi, UnitCell& ucell); - // --------------------- output the necessary information ----------- - void print_info(const bool conv_esolver); - // --------------------- interface to blas -------------------------- double inner_product(double* pa, double* pb, int length, double dV = 1) { diff --git a/source/source_esolver/esolver_of_tool.cpp b/source/source_esolver/esolver_of_tool.cpp index ab5b033e34..cd29bc448f 100644 --- a/source/source_esolver/esolver_of_tool.cpp +++ b/source/source_esolver/esolver_of_tool.cpp @@ -379,140 +379,13 @@ void ESolver_OF::test_direction(double* dEdtheta, double** ptemp_phi, UnitCell& Parallel_Reduce::reduce_all(pseudopot_energy); temp_energy += kinetic_energy + pseudopot_energy; GlobalV::ofs_warning << i << " " << dEdtheta[0] << " " << temp_energy << std::endl; - if (this->theta_[0] == 0) { - std::cout << "dEdtheta " << dEdtheta[0] << std::endl; -} - } + if (this->theta_[0] == 0) + { + std::cout << "dEdtheta " << dEdtheta[0] << std::endl; + } + } exit(0); } } -/** - * @brief Print nessecary information to the screen, - * and write the components of the total energy into running_log. - */ -void ESolver_OF::print_info(const bool conv_esolver) -{ - if (this->iter_ == 0) - { - std::cout << " ============================= Running OFDFT " - "==============================" - << std::endl; - std::cout << " ITER ETOT/eV EDIFF/eV EFERMI/eV POTNORM TIME/s" - << std::endl; - } - - std::map prefix_map = { - {"cg1", "CG"}, - {"cg2", "CG"}, - {"tn", "TN"} - }; - std::string iteration = prefix_map[PARAM.inp.of_method] + std::to_string(this->iter_); -#ifdef __MPI - double duration = (double)(MPI_Wtime() - this->iter_time); -#else - double duration - = (std::chrono::duration_cast(std::chrono::system_clock::now() - this->iter_time)).count() - / static_cast(1e6); -#endif - std::cout << " " << std::setw(8) << iteration - << std::setw(18) << std::scientific << std::setprecision(8) << this->energy_current_ * ModuleBase::Ry_to_eV - << std::setw(18) << (this->energy_current_ - this->energy_last_) * ModuleBase::Ry_to_eV - << std::setw(13) << std::setprecision(4) << this->pelec->eferm.get_efval(0) * ModuleBase::Ry_to_eV - << std::setw(13) << std::setprecision(4) << this->normdLdphi_ - << std::setw(6) << std::fixed << std::setprecision(2) << duration << std::endl; - - GlobalV::ofs_running << std::setprecision(12); - GlobalV::ofs_running << std::setiosflags(std::ios::right); - - GlobalV::ofs_running << "\nIter" << this->iter_ << ": the norm of potential is " << this->normdLdphi_ << std::endl; - - std::vector titles; - std::vector energies_Ry; - std::vector energies_eV; - if ((PARAM.inp.out_band[0] > 0 && - ((this->iter_ + 1) % PARAM.inp.out_band[0] == 0 || - conv_esolver || - this->iter_ == PARAM.inp.scf_nmax)) || - PARAM.inp.init_chg == "file") - { - titles.push_back("E_Total"); - energies_Ry.push_back(this->pelec->f_en.etot); - titles.push_back("E_Kinetic"); - energies_Ry.push_back(this->pelec->f_en.ekinetic); - titles.push_back("E_Hartree"); - energies_Ry.push_back(this->pelec->f_en.hartree_energy); - titles.push_back("E_xc"); - energies_Ry.push_back(this->pelec->f_en.etxc - this->pelec->f_en.etxcc); - titles.push_back("E_LocalPP"); - energies_Ry.push_back(this->pelec->f_en.e_local_pp); - titles.push_back("E_Ewald"); - energies_Ry.push_back(this->pelec->f_en.ewald_energy); - - this->kedf_manager_->record_energy(titles, energies_Ry); - - std::string vdw_method = PARAM.inp.vdw_method; - if (vdw_method == "d2") // Peize Lin add 2014-04, update 2021-03-09 - { - titles.push_back("E_vdwD2"); - energies_Ry.push_back(this->pelec->f_en.evdw); - } - else if (vdw_method == "d3_0" || vdw_method == "d3_bj") // jiyy add 2019-05, update 2021-05-02 - { - titles.push_back("E_vdwD3"); - energies_Ry.push_back(this->pelec->f_en.evdw); - } - if (PARAM.inp.imp_sol) - { - titles.push_back("E_sol_el"); - energies_Ry.push_back(this->pelec->f_en.esol_el); - titles.push_back("E_sol_cav"); - energies_Ry.push_back(this->pelec->f_en.esol_cav); - } - if (PARAM.inp.efield_flag) - { - titles.push_back("E_efield"); - energies_Ry.push_back(elecstate::Efield::etotefield); - } - if (PARAM.inp.gate_flag) - { - titles.push_back("E_gatefield"); - energies_Ry.push_back(elecstate::Gatefield::etotgatefield); - } - } - else - { - titles.push_back("E_Total"); - energies_Ry.push_back(this->pelec->f_en.etot); - } - - if (PARAM.globalv.two_fermi) - { - titles.push_back("E_Fermi_up"); - energies_Ry.push_back(this->pelec->eferm.get_efval(0)); - titles.push_back("E_Fermi_dw"); - energies_Ry.push_back(this->pelec->eferm.get_efval(1)); - } - else - { - titles.push_back("E_Fermi"); - energies_Ry.push_back(this->pelec->eferm.get_efval(0)); - } - energies_eV.resize(energies_Ry.size()); - std::transform(energies_Ry.begin(), energies_Ry.end(), energies_eV.begin(), [](double energy) { - return energy * ModuleBase::Ry_to_eV; - }); - FmtTable table(/*titles=*/{"Energy", "Rydberg", "eV"}, - /*nrows=*/titles.size(), - /*formats=*/{"%20s", "%20.12f", "%20.12f"}, 0); - table << titles << energies_Ry << energies_eV; - GlobalV::ofs_running << table.str() << std::endl; - - // reset the iter_time for the next iteration -#ifdef __MPI - this->iter_time = MPI_Wtime(); -#else - this->iter_time = std::chrono::system_clock::now(); -#endif -} } // namespace ModuleESolver diff --git a/source/source_pw/module_ofdft/of_print_info.cpp b/source/source_pw/module_ofdft/of_print_info.cpp new file mode 100644 index 0000000000..062bbfb85f --- /dev/null +++ b/source/source_pw/module_ofdft/of_print_info.cpp @@ -0,0 +1,134 @@ +#include "source_pw/module_ofdft/of_print_info.h" + +/** + * @brief Print nessecary information to the screen, + * and write the components of the total energy into running_log. + */ +void print_info(const int iter, + double &iter_time, + const double &energy_current, + const double &energy_last, + const bool conv_esolver) +{ + if (iter == 0) + { + std::cout << " ============================= Running OFDFT " + "==============================" + << std::endl; + std::cout << " ITER ETOT/eV EDIFF/eV EFERMI/eV POTNORM TIME/s" + << std::endl; + } + + std::map prefix_map = { + {"cg1", "CG"}, + {"cg2", "CG"}, + {"tn", "TN"} + }; + std::string iteration = prefix_map[PARAM.inp.of_method] + std::to_string(iter); +#ifdef __MPI + double duration = (double)(MPI_Wtime() - iter_time); +#else + double duration + = (std::chrono::duration_cast(std::chrono::system_clock::now() - iter_time)).count() + / static_cast(1e6); +#endif + std::cout << " " << std::setw(8) << iteration + << std::setw(18) << std::scientific << std::setprecision(8) << energy_current * ModuleBase::Ry_to_eV + << std::setw(18) << (energy_current - energy_last) * ModuleBase::Ry_to_eV + << std::setw(13) << std::setprecision(4) << this->pelec->eferm.get_efval(0) * ModuleBase::Ry_to_eV + << std::setw(13) << std::setprecision(4) << this->normdLdphi_ + << std::setw(6) << std::fixed << std::setprecision(2) << duration << std::endl; + + GlobalV::ofs_running << std::setprecision(12); + GlobalV::ofs_running << std::setiosflags(std::ios::right); + + GlobalV::ofs_running << "\nIter" << iter << ": the norm of potential is " << this->normdLdphi_ << std::endl; + + std::vector titles; + std::vector energies_Ry; + std::vector energies_eV; + if ((PARAM.inp.out_band[0] > 0 && + ((iter + 1) % PARAM.inp.out_band[0] == 0 || + conv_esolver || + iter == PARAM.inp.scf_nmax)) || + PARAM.inp.init_chg == "file") + { + titles.push_back("E_Total"); + energies_Ry.push_back(this->pelec->f_en.etot); + titles.push_back("E_Kinetic"); + energies_Ry.push_back(this->pelec->f_en.ekinetic); + titles.push_back("E_Hartree"); + energies_Ry.push_back(this->pelec->f_en.hartree_energy); + titles.push_back("E_xc"); + energies_Ry.push_back(this->pelec->f_en.etxc - this->pelec->f_en.etxcc); + titles.push_back("E_LocalPP"); + energies_Ry.push_back(this->pelec->f_en.e_local_pp); + titles.push_back("E_Ewald"); + energies_Ry.push_back(this->pelec->f_en.ewald_energy); + + this->kedf_manager_->record_energy(titles, energies_Ry); + + std::string vdw_method = PARAM.inp.vdw_method; + if (vdw_method == "d2") // Peize Lin add 2014-04, update 2021-03-09 + { + titles.push_back("E_vdwD2"); + energies_Ry.push_back(this->pelec->f_en.evdw); + } + else if (vdw_method == "d3_0" || vdw_method == "d3_bj") // jiyy add 2019-05, update 2021-05-02 + { + titles.push_back("E_vdwD3"); + energies_Ry.push_back(this->pelec->f_en.evdw); + } + if (PARAM.inp.imp_sol) + { + titles.push_back("E_sol_el"); + energies_Ry.push_back(this->pelec->f_en.esol_el); + titles.push_back("E_sol_cav"); + energies_Ry.push_back(this->pelec->f_en.esol_cav); + } + if (PARAM.inp.efield_flag) + { + titles.push_back("E_efield"); + energies_Ry.push_back(elecstate::Efield::etotefield); + } + if (PARAM.inp.gate_flag) + { + titles.push_back("E_gatefield"); + energies_Ry.push_back(elecstate::Gatefield::etotgatefield); + } + } + else + { + titles.push_back("E_Total"); + energies_Ry.push_back(this->pelec->f_en.etot); + } + + if (PARAM.globalv.two_fermi) + { + titles.push_back("E_Fermi_up"); + energies_Ry.push_back(this->pelec->eferm.get_efval(0)); + titles.push_back("E_Fermi_dw"); + energies_Ry.push_back(this->pelec->eferm.get_efval(1)); + } + else + { + titles.push_back("E_Fermi"); + energies_Ry.push_back(this->pelec->eferm.get_efval(0)); + } + energies_eV.resize(energies_Ry.size()); + std::transform(energies_Ry.begin(), energies_Ry.end(), energies_eV.begin(), [](double energy) { + return energy * ModuleBase::Ry_to_eV; + }); + FmtTable table(/*titles=*/{"Energy", "Rydberg", "eV"}, + /*nrows=*/titles.size(), + /*formats=*/{"%20s", "%20.12f", "%20.12f"}, 0); + table << titles << energies_Ry << energies_eV; + GlobalV::ofs_running << table.str() << std::endl; + + // reset the iter_time for the next iteration +#ifdef __MPI + iter_time = MPI_Wtime(); +#else + iter_time = std::chrono::system_clock::now(); +#endif +} diff --git a/source/source_pw/module_ofdft/of_print_info.h b/source/source_pw/module_ofdft/of_print_info.h new file mode 100644 index 0000000000..c4e59b3582 --- /dev/null +++ b/source/source_pw/module_ofdft/of_print_info.h @@ -0,0 +1,13 @@ +#ifndef OF_PRINT_INFO_H +#define OF_PRINT_INFO_H + +namespace OFDFT +{ + + void print_info(const bool conv_esolver); + +} + +#endif + + From 24cacd9086aed6fa7823bb0580f20facc9ee9870 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Tue, 2 Dec 2025 21:01:35 +0800 Subject: [PATCH 30/36] move ofdft print_info to module_ofdft --- source/Makefile.Objects | 1 + source/source_esolver/esolver_of.cpp | 5 +- source/source_pw/module_ofdft/CMakeLists.txt | 3 +- .../source_pw/module_ofdft/of_print_info.cpp | 52 +++++++++++-------- source/source_pw/module_ofdft/of_print_info.h | 13 ++++- 5 files changed, 48 insertions(+), 26 deletions(-) diff --git a/source/Makefile.Objects b/source/Makefile.Objects index 75ea579cdd..0b294c53b8 100644 --- a/source/Makefile.Objects +++ b/source/Makefile.Objects @@ -737,6 +737,7 @@ OBJS_SRCPW=H_Ewald_pw.o\ stress_func_onsite.o\ stress_pw.o\ of_stress_pw.o\ + of_print_info.o\ symmetry_rho.o\ symmetry_rhog.o\ setup_psi_pw.o\ diff --git a/source/source_esolver/esolver_of.cpp b/source/source_esolver/esolver_of.cpp index d36ed867f8..5077ee8f2c 100644 --- a/source/source_esolver/esolver_of.cpp +++ b/source/source_esolver/esolver_of.cpp @@ -13,6 +13,8 @@ #include "source_estate/cal_ux.h" #include "source_pw/module_pwdft/forces.h" #include "source_pw/module_ofdft/of_stress_pw.h" +// mohan add +#include "source_pw/module_ofdft/of_print_info.h" namespace ModuleESolver { @@ -430,7 +432,8 @@ bool ESolver_OF::check_exit(bool& conv_esolver) conv_esolver = (this->of_conv_ == "energy" && energyConv) || (this->of_conv_ == "potential" && potConv) || (this->of_conv_ == "both" && potConv && energyConv); - this->print_info(conv_esolver); + OFDFT::print_info(this->iter_, this->iter_time, this->energy_current_, this->energy_last_, + this->normdLdphi_, this->pelec, this->kedf_manager_, conv_esolver); if (conv_esolver || this->iter_ >= this->max_iter_) { diff --git a/source/source_pw/module_ofdft/CMakeLists.txt b/source/source_pw/module_ofdft/CMakeLists.txt index 7465b47a98..2b0ff7a363 100644 --- a/source/source_pw/module_ofdft/CMakeLists.txt +++ b/source/source_pw/module_ofdft/CMakeLists.txt @@ -6,6 +6,7 @@ list(APPEND hamilt_ofdft_srcs kedf_lkt.cpp kedf_manager.cpp of_stress_pw.cpp + of_print_info.cpp evolve_ofdft.cpp ) @@ -36,4 +37,4 @@ if(ENABLE_MLALGO) if(ENABLE_COVERAGE) add_coverage(hamilt_mlkedf) endif() -endif() \ No newline at end of file +endif() diff --git a/source/source_pw/module_ofdft/of_print_info.cpp b/source/source_pw/module_ofdft/of_print_info.cpp index 062bbfb85f..5ca5bb135f 100644 --- a/source/source_pw/module_ofdft/of_print_info.cpp +++ b/source/source_pw/module_ofdft/of_print_info.cpp @@ -1,14 +1,20 @@ #include "source_pw/module_ofdft/of_print_info.h" +#include "source_estate/module_pot/efield.h" +#include "source_estate/module_pot/gatefield.h" +#include "source_base/formatter.h" /** * @brief Print nessecary information to the screen, * and write the components of the total energy into running_log. */ -void print_info(const int iter, - double &iter_time, - const double &energy_current, - const double &energy_last, - const bool conv_esolver) +void OFDFT::print_info(const int iter, + double &iter_time, + const double &energy_current, + const double &energy_last, + const double &normdLdphi, + const elecstate::ElecState *pelec, + KEDF_Manager *kedf_manager, + const bool conv_esolver) { if (iter == 0) { @@ -35,14 +41,14 @@ void print_info(const int iter, std::cout << " " << std::setw(8) << iteration << std::setw(18) << std::scientific << std::setprecision(8) << energy_current * ModuleBase::Ry_to_eV << std::setw(18) << (energy_current - energy_last) * ModuleBase::Ry_to_eV - << std::setw(13) << std::setprecision(4) << this->pelec->eferm.get_efval(0) * ModuleBase::Ry_to_eV - << std::setw(13) << std::setprecision(4) << this->normdLdphi_ + << std::setw(13) << std::setprecision(4) << pelec->eferm.get_efval(0) * ModuleBase::Ry_to_eV + << std::setw(13) << std::setprecision(4) << normdLdphi << std::setw(6) << std::fixed << std::setprecision(2) << duration << std::endl; GlobalV::ofs_running << std::setprecision(12); GlobalV::ofs_running << std::setiosflags(std::ios::right); - GlobalV::ofs_running << "\nIter" << iter << ": the norm of potential is " << this->normdLdphi_ << std::endl; + GlobalV::ofs_running << "\nIter" << iter << ": the norm of potential is " << normdLdphi << std::endl; std::vector titles; std::vector energies_Ry; @@ -54,37 +60,37 @@ void print_info(const int iter, PARAM.inp.init_chg == "file") { titles.push_back("E_Total"); - energies_Ry.push_back(this->pelec->f_en.etot); + energies_Ry.push_back(pelec->f_en.etot); titles.push_back("E_Kinetic"); - energies_Ry.push_back(this->pelec->f_en.ekinetic); + energies_Ry.push_back(pelec->f_en.ekinetic); titles.push_back("E_Hartree"); - energies_Ry.push_back(this->pelec->f_en.hartree_energy); + energies_Ry.push_back(pelec->f_en.hartree_energy); titles.push_back("E_xc"); - energies_Ry.push_back(this->pelec->f_en.etxc - this->pelec->f_en.etxcc); + energies_Ry.push_back(pelec->f_en.etxc - pelec->f_en.etxcc); titles.push_back("E_LocalPP"); - energies_Ry.push_back(this->pelec->f_en.e_local_pp); + energies_Ry.push_back(pelec->f_en.e_local_pp); titles.push_back("E_Ewald"); - energies_Ry.push_back(this->pelec->f_en.ewald_energy); + energies_Ry.push_back(pelec->f_en.ewald_energy); - this->kedf_manager_->record_energy(titles, energies_Ry); + kedf_manager->record_energy(titles, energies_Ry); std::string vdw_method = PARAM.inp.vdw_method; if (vdw_method == "d2") // Peize Lin add 2014-04, update 2021-03-09 { titles.push_back("E_vdwD2"); - energies_Ry.push_back(this->pelec->f_en.evdw); + energies_Ry.push_back(pelec->f_en.evdw); } else if (vdw_method == "d3_0" || vdw_method == "d3_bj") // jiyy add 2019-05, update 2021-05-02 { titles.push_back("E_vdwD3"); - energies_Ry.push_back(this->pelec->f_en.evdw); + energies_Ry.push_back(pelec->f_en.evdw); } if (PARAM.inp.imp_sol) { titles.push_back("E_sol_el"); - energies_Ry.push_back(this->pelec->f_en.esol_el); + energies_Ry.push_back(pelec->f_en.esol_el); titles.push_back("E_sol_cav"); - energies_Ry.push_back(this->pelec->f_en.esol_cav); + energies_Ry.push_back(pelec->f_en.esol_cav); } if (PARAM.inp.efield_flag) { @@ -100,20 +106,20 @@ void print_info(const int iter, else { titles.push_back("E_Total"); - energies_Ry.push_back(this->pelec->f_en.etot); + energies_Ry.push_back(pelec->f_en.etot); } if (PARAM.globalv.two_fermi) { titles.push_back("E_Fermi_up"); - energies_Ry.push_back(this->pelec->eferm.get_efval(0)); + energies_Ry.push_back(pelec->eferm.get_efval(0)); titles.push_back("E_Fermi_dw"); - energies_Ry.push_back(this->pelec->eferm.get_efval(1)); + energies_Ry.push_back(pelec->eferm.get_efval(1)); } else { titles.push_back("E_Fermi"); - energies_Ry.push_back(this->pelec->eferm.get_efval(0)); + energies_Ry.push_back(pelec->eferm.get_efval(0)); } energies_eV.resize(energies_Ry.size()); std::transform(energies_Ry.begin(), energies_Ry.end(), energies_eV.begin(), [](double energy) { diff --git a/source/source_pw/module_ofdft/of_print_info.h b/source/source_pw/module_ofdft/of_print_info.h index c4e59b3582..6735de6c0d 100644 --- a/source/source_pw/module_ofdft/of_print_info.h +++ b/source/source_pw/module_ofdft/of_print_info.h @@ -1,10 +1,21 @@ #ifndef OF_PRINT_INFO_H #define OF_PRINT_INFO_H +#include "source_estate/elecstate.h" // electronic states +#include "source_pw/module_ofdft/kedf_manager.h" + + namespace OFDFT { - void print_info(const bool conv_esolver); +void print_info(const int iter, + double &iter_time, + const double &energy_current, + const double &energy_last, + const double &normdLdphi, + const elecstate::ElecState *pelec, + KEDF_Manager *kedf_manager, + const bool conv_esolver); } From 06c4263cd2ab01f09ca369442eb5948646c5a3ad Mon Sep 17 00:00:00 2001 From: mohanchen Date: Wed, 3 Dec 2025 09:24:46 +0800 Subject: [PATCH 31/36] fix bugs in tests --- source/source_estate/test/charge_test.cpp | 17 +++++++++++------ .../source_estate/test/elecstate_base_test.cpp | 4 ++-- source/source_estate/test/elecstate_pw_test.cpp | 2 +- .../source_estate/test/potential_new_test.cpp | 4 ++-- .../test/hsolver_supplementary_mock.h | 3 +-- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/source/source_estate/test/charge_test.cpp b/source/source_estate/test/charge_test.cpp index de28a5848c..261bcc5e3e 100644 --- a/source/source_estate/test/charge_test.cpp +++ b/source/source_estate/test/charge_test.cpp @@ -117,10 +117,11 @@ TEST_F(ChargeTest, Allocate) XC_Functional::ked_flag = true; charge->set_rhopw(rhopw); EXPECT_FALSE(charge->allocate_rho); - charge->allocate(PARAM.input.nspin); + const bool kin_den = charge->kin_density(); + charge->allocate(PARAM.input.nspin, kin_den); EXPECT_TRUE(charge->allocate_rho); // test if Charge::allocate() be called twice - EXPECT_NO_THROW(charge->allocate(PARAM.input.nspin)); + EXPECT_NO_THROW(charge->allocate(PARAM.input.nspin, kin_den)); EXPECT_TRUE(charge->allocate_rho); } @@ -128,7 +129,8 @@ TEST_F(ChargeTest, SumRho) { charge->set_rhopw(rhopw); EXPECT_FALSE(charge->allocate_rho); - charge->allocate(PARAM.input.nspin); + const bool kin_den = charge->kin_density(); + charge->allocate(PARAM.input.nspin, kin_den); EXPECT_TRUE(charge->allocate_rho); int nspin = (PARAM.input.nspin == 2) ? 2 : 1; for (int is = 0; is < nspin; is++) @@ -146,7 +148,8 @@ TEST_F(ChargeTest, RenormalizeRho) { charge->set_rhopw(rhopw); EXPECT_FALSE(charge->allocate_rho); - charge->allocate(PARAM.input.nspin); + const bool kin_den = charge->kin_density(); + charge->allocate(PARAM.input.nspin, kin_den); EXPECT_TRUE(charge->allocate_rho); int nspin = (PARAM.input.nspin == 2) ? 2 : 1; for (int is = 0; is < nspin; is++) @@ -166,7 +169,8 @@ TEST_F(ChargeTest, CheckNe) { charge->set_rhopw(rhopw); EXPECT_FALSE(charge->allocate_rho); - charge->allocate(PARAM.input.nspin); + const bool kin_den = charge->kin_density(); + charge->allocate(PARAM.input.nspin, kin_den); EXPECT_TRUE(charge->allocate_rho); int nspin = (PARAM.input.nspin == 2) ? 2 : 1; for (int is = 0; is < nspin; is++) @@ -187,7 +191,8 @@ TEST_F(ChargeTest, SaveRhoBeforeSumBand) { charge->set_rhopw(rhopw); EXPECT_FALSE(charge->allocate_rho); - charge->allocate(PARAM.input.nspin); + const bool kin_den = charge->kin_density(); + charge->allocate(PARAM.input.nspin, kin_den); EXPECT_TRUE(charge->allocate_rho); int nspin = (PARAM.input.nspin == 2) ? 2 : 1; for (int is = 0; is < nspin; is++) diff --git a/source/source_estate/test/elecstate_base_test.cpp b/source/source_estate/test/elecstate_base_test.cpp index 8cc19b63b4..e0d63df822 100644 --- a/source/source_estate/test/elecstate_base_test.cpp +++ b/source/source_estate/test/elecstate_base_test.cpp @@ -14,7 +14,7 @@ // Mock functions for testing elecstate.cpp namespace elecstate { -void Potential::init_pot(int, Charge const*) +void Potential::init_pot(Charge const*) { } void Potential::cal_v_eff(const Charge* chg, const UnitCell* ucell, ModuleBase::matrix& v_eff) @@ -263,7 +263,7 @@ TEST_F(ElecStateTest, InitSCF) ModuleBase::ComplexMatrix strucfac; elecstate->eferm = efermi; ModuleSymmetry::Symmetry symm; - EXPECT_NO_THROW(elecstate->init_scf(istep, ucell, pgrid, strucfac, nullptr, symm)); + EXPECT_NO_THROW(elecstate->init_scf(ucell, pgrid, strucfac, nullptr, symm)); // delete elecstate->pot is done in the destructor of elecstate delete charge; } diff --git a/source/source_estate/test/elecstate_pw_test.cpp b/source/source_estate/test/elecstate_pw_test.cpp index 72fa56375b..27b9bea73a 100644 --- a/source/source_estate/test/elecstate_pw_test.cpp +++ b/source/source_estate/test/elecstate_pw_test.cpp @@ -12,7 +12,7 @@ int XC_Functional::func_type = 1; namespace elecstate { -void Potential::init_pot(int, Charge const*) +void Potential::init_pot(Charge const*) { } void Potential::cal_v_eff(const Charge* chg, const UnitCell* ucell, ModuleBase::matrix& v_eff) diff --git a/source/source_estate/test/potential_new_test.cpp b/source/source_estate/test/potential_new_test.cpp index ea260d248b..f91f473efa 100644 --- a/source/source_estate/test/potential_new_test.cpp +++ b/source/source_estate/test/potential_new_test.cpp @@ -88,7 +88,7 @@ void Set_GlobalV_Default() * - UpdateFromCharge: elecstate::Potential::update_from_charge() * - calls cal_fixed_v and cal_v_eff to update v_effective from rho * - InitPot: elecstate::Potential::init_pot() - * - using istep and update_from_charge to initialize v_effective + * - using update_from_charge to initialize v_effective * - GetVnew: elecstate::Potential::get_vnew() * - used later for scf correction to the forces * - GetEffective: elecstate::Potential::get_effective_v() @@ -377,7 +377,7 @@ TEST_F(PotentialNewTest, InitPot) } Charge* chg = new Charge; EXPECT_FALSE(pot->fixed_done); - pot->init_pot(1,chg); + pot->init_pot(chg); EXPECT_TRUE(pot->fixed_done); delete chg; } diff --git a/source/source_hsolver/test/hsolver_supplementary_mock.h b/source/source_hsolver/test/hsolver_supplementary_mock.h index 3c3c500194..87155ecd5a 100644 --- a/source/source_hsolver/test/hsolver_supplementary_mock.h +++ b/source/source_hsolver/test/hsolver_supplementary_mock.h @@ -19,8 +19,7 @@ void ElecState::init_nelec_spin() -void ElecState::init_scf(const int istep, - const UnitCell& ucell, +void ElecState::init_scf(const UnitCell& ucell, const Parallel_Grid& pgrid, const ModuleBase::ComplexMatrix& strucfac, const bool*, From 67cce259ee1219b1bde20468429f265e4f1ec6a0 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Wed, 3 Dec 2025 09:43:07 +0800 Subject: [PATCH 32/36] add header --- source/source_pw/module_ofdft/of_print_info.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/source_pw/module_ofdft/of_print_info.cpp b/source/source_pw/module_ofdft/of_print_info.cpp index 5ca5bb135f..c941312d6e 100644 --- a/source/source_pw/module_ofdft/of_print_info.cpp +++ b/source/source_pw/module_ofdft/of_print_info.cpp @@ -2,6 +2,7 @@ #include "source_estate/module_pot/efield.h" #include "source_estate/module_pot/gatefield.h" #include "source_base/formatter.h" +#include /** * @brief Print nessecary information to the screen, From 6dd242dacd0890c6da3553befa06ab47c2c7cdd3 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Wed, 3 Dec 2025 11:02:33 +0800 Subject: [PATCH 33/36] small update of timer in ofdft --- source/source_pw/module_ofdft/of_print_info.cpp | 12 +++++++----- source/source_pw/module_ofdft/of_print_info.h | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/source/source_pw/module_ofdft/of_print_info.cpp b/source/source_pw/module_ofdft/of_print_info.cpp index c941312d6e..2f3017a590 100644 --- a/source/source_pw/module_ofdft/of_print_info.cpp +++ b/source/source_pw/module_ofdft/of_print_info.cpp @@ -2,7 +2,7 @@ #include "source_estate/module_pot/efield.h" #include "source_estate/module_pot/gatefield.h" #include "source_base/formatter.h" -#include +//#include /** * @brief Print nessecary information to the screen, @@ -35,9 +35,10 @@ void OFDFT::print_info(const int iter, #ifdef __MPI double duration = (double)(MPI_Wtime() - iter_time); #else - double duration - = (std::chrono::duration_cast(std::chrono::system_clock::now() - iter_time)).count() - / static_cast(1e6); +// will recover this part later, 2025-12-03 mohan +// double duration +// = (std::chrono::duration_cast(std::chrono::system_clock::now() - iter_time)).count() +// / static_cast(1e6); #endif std::cout << " " << std::setw(8) << iteration << std::setw(18) << std::scientific << std::setprecision(8) << energy_current * ModuleBase::Ry_to_eV @@ -136,6 +137,7 @@ void OFDFT::print_info(const int iter, #ifdef __MPI iter_time = MPI_Wtime(); #else - iter_time = std::chrono::system_clock::now(); +// will recover this part later, 2025-12-03 mohan +// iter_time = std::chrono::system_clock::now(); #endif } diff --git a/source/source_pw/module_ofdft/of_print_info.h b/source/source_pw/module_ofdft/of_print_info.h index 6735de6c0d..8245ef88c7 100644 --- a/source/source_pw/module_ofdft/of_print_info.h +++ b/source/source_pw/module_ofdft/of_print_info.h @@ -4,6 +4,8 @@ #include "source_estate/elecstate.h" // electronic states #include "source_pw/module_ofdft/kedf_manager.h" +#include + namespace OFDFT { From 74f489572d381655079331620477db9c90188e78 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Wed, 3 Dec 2025 11:15:44 +0800 Subject: [PATCH 34/36] fix a bug related to timer --- source/source_pw/module_ofdft/of_print_info.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/source_pw/module_ofdft/of_print_info.cpp b/source/source_pw/module_ofdft/of_print_info.cpp index 2f3017a590..3bd9d7af00 100644 --- a/source/source_pw/module_ofdft/of_print_info.cpp +++ b/source/source_pw/module_ofdft/of_print_info.cpp @@ -35,6 +35,7 @@ void OFDFT::print_info(const int iter, #ifdef __MPI double duration = (double)(MPI_Wtime() - iter_time); #else + double duration = 0.0; // will recover this part later, 2025-12-03 mohan // double duration // = (std::chrono::duration_cast(std::chrono::system_clock::now() - iter_time)).count() From 9eadc4b9f9f0a9a53ec7faade6ea68be4d273bc4 Mon Sep 17 00:00:00 2001 From: mohanchen Date: Wed, 3 Dec 2025 11:25:12 +0800 Subject: [PATCH 35/36] update --- source/source_pw/module_ofdft/of_print_info.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/source_pw/module_ofdft/of_print_info.h b/source/source_pw/module_ofdft/of_print_info.h index 8245ef88c7..c323ed87e6 100644 --- a/source/source_pw/module_ofdft/of_print_info.h +++ b/source/source_pw/module_ofdft/of_print_info.h @@ -4,7 +4,7 @@ #include "source_estate/elecstate.h" // electronic states #include "source_pw/module_ofdft/kedf_manager.h" -#include +//#include namespace OFDFT From 1342c54c157fc54ad9e67f068cee0305d170633d Mon Sep 17 00:00:00 2001 From: mohanchen Date: Wed, 3 Dec 2025 11:38:14 +0800 Subject: [PATCH 36/36] update --- .../source_pw/module_ofdft/of_print_info.cpp | 18 +++++++++--------- source/source_pw/module_ofdft/of_print_info.h | 8 ++++++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/source/source_pw/module_ofdft/of_print_info.cpp b/source/source_pw/module_ofdft/of_print_info.cpp index 3bd9d7af00..bdfb72133d 100644 --- a/source/source_pw/module_ofdft/of_print_info.cpp +++ b/source/source_pw/module_ofdft/of_print_info.cpp @@ -2,14 +2,17 @@ #include "source_estate/module_pot/efield.h" #include "source_estate/module_pot/gatefield.h" #include "source_base/formatter.h" -//#include /** * @brief Print nessecary information to the screen, * and write the components of the total energy into running_log. */ void OFDFT::print_info(const int iter, - double &iter_time, + #ifdef __MPI + double &iter_time, + #else + std::chrono::system_clock::time_point &iter_time, + #endif const double &energy_current, const double &energy_last, const double &normdLdphi, @@ -35,11 +38,9 @@ void OFDFT::print_info(const int iter, #ifdef __MPI double duration = (double)(MPI_Wtime() - iter_time); #else - double duration = 0.0; -// will recover this part later, 2025-12-03 mohan -// double duration -// = (std::chrono::duration_cast(std::chrono::system_clock::now() - iter_time)).count() -// / static_cast(1e6); + double duration + = (std::chrono::duration_cast(std::chrono::system_clock::now() - iter_time)).count() + / static_cast(1e6); #endif std::cout << " " << std::setw(8) << iteration << std::setw(18) << std::scientific << std::setprecision(8) << energy_current * ModuleBase::Ry_to_eV @@ -138,7 +139,6 @@ void OFDFT::print_info(const int iter, #ifdef __MPI iter_time = MPI_Wtime(); #else -// will recover this part later, 2025-12-03 mohan -// iter_time = std::chrono::system_clock::now(); + iter_time = std::chrono::system_clock::now(); #endif } diff --git a/source/source_pw/module_ofdft/of_print_info.h b/source/source_pw/module_ofdft/of_print_info.h index c323ed87e6..b60eeb69db 100644 --- a/source/source_pw/module_ofdft/of_print_info.h +++ b/source/source_pw/module_ofdft/of_print_info.h @@ -4,14 +4,18 @@ #include "source_estate/elecstate.h" // electronic states #include "source_pw/module_ofdft/kedf_manager.h" -//#include +#include namespace OFDFT { void print_info(const int iter, - double &iter_time, + #ifdef __MPI + double &iter_time, + #else + std::chrono::system_clock::time_point &iter_time, + #endif const double &energy_current, const double &energy_last, const double &normdLdphi,