From b69c08538fa2cf11bb42b3d0e9a3c2b35fcae5af Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Fri, 23 Jan 2026 20:25:54 +0800 Subject: [PATCH 01/54] Refactor: Encapsulate timer functionality in timer_wrapper.h --- source/source_base/timer_wrapper.h | 56 +++++++++++++++++++ source/source_esolver/esolver_fp.h | 10 +--- source/source_esolver/esolver_ks.cpp | 15 +---- source/source_esolver/esolver_of.cpp | 14 ++--- source/source_esolver/esolver_of_tddft.cpp | 6 +- .../source_pw/module_ofdft/of_print_info.cpp | 32 +++-------- source/source_pw/module_ofdft/of_print_info.h | 20 +++---- 7 files changed, 84 insertions(+), 69 deletions(-) create mode 100644 source/source_base/timer_wrapper.h diff --git a/source/source_base/timer_wrapper.h b/source/source_base/timer_wrapper.h new file mode 100644 index 00000000000..6da3f391e37 --- /dev/null +++ b/source/source_base/timer_wrapper.h @@ -0,0 +1,56 @@ +#ifndef TIMER_WRAPPER_H +#define TIMER_WRAPPER_H + +#include + +#ifdef __MPI +#include +#endif + +namespace ModuleBase { + +/** + * @brief Time point type that works in both MPI and non-MPI environments + */ +typedef double TimePoint; + +/** + * @brief Get current time as a TimePoint + * + * @return TimePoint Current time + */ +inline TimePoint get_time() +{ +#ifdef __MPI + int is_initialized = 0; + MPI_Initialized(&is_initialized); + if (is_initialized) + { + return MPI_Wtime(); + } + else + { + return std::chrono::duration_cast( + std::chrono::system_clock::now().time_since_epoch()).count() / 1e6; + } +#else + return std::chrono::duration_cast( + std::chrono::system_clock::now().time_since_epoch()).count() / 1e6; +#endif +} + +/** + * @brief Calculate duration between two TimePoints in seconds + * + * @param start Start time point + * @param end End time point + * @return double Duration in seconds + */ +inline double get_duration(const TimePoint& start, const TimePoint& end) +{ + return end - start; +} + +} + +#endif // TIMER_WRAPPER_H \ No newline at end of file diff --git a/source/source_esolver/esolver_fp.h b/source/source_esolver/esolver_fp.h index b2bb8f065e2..94faa31e74a 100644 --- a/source/source_esolver/esolver_fp.h +++ b/source/source_esolver/esolver_fp.h @@ -3,9 +3,7 @@ #include "esolver.h" -#ifndef __MPI -#include -#endif +#include "source_base/timer_wrapper.h" #include "source_basis/module_pw/pw_basis.h" // plane wave basis #include "source_cell/module_symmetry/symmetry.h" // symmetry analysis @@ -83,11 +81,7 @@ class ESolver_FP: public ESolver bool pw_rho_flag = false; ///< flag for pw_rho, 0: not initialized, 1: initialized //! the start time of scf iteration - #ifdef __MPI - double iter_time; - #else - std::chrono::system_clock::time_point iter_time; - #endif + ModuleBase::TimePoint iter_time; }; } // namespace ModuleESolver diff --git a/source/source_esolver/esolver_ks.cpp b/source/source_esolver/esolver_ks.cpp index 166e7b3fb9d..8c0c6511726 100644 --- a/source/source_esolver/esolver_ks.cpp +++ b/source/source_esolver/esolver_ks.cpp @@ -1,4 +1,5 @@ #include "esolver_ks.h" +#include "source_base/timer_wrapper.h" // for jason output information #include "source_io/json_output/init_info.h" @@ -190,11 +191,7 @@ void ESolver_KS::iter_init(UnitCell& ucell, const int istep, const in ModuleIO::write_head(GlobalV::ofs_running, istep, iter, this->basisname); } -#ifdef __MPI - iter_time = MPI_Wtime(); -#else - iter_time = std::chrono::system_clock::now(); -#endif + iter_time = ModuleBase::get_time(); if (PARAM.inp.esolver_type == "ksdft") { @@ -281,13 +278,7 @@ void ESolver_KS::iter_finish(UnitCell& ucell, const int istep, int& i // the end, print time -#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 + double duration = ModuleBase::get_duration(iter_time, ModuleBase::get_time()); // print energies elecstate::print_etot(ucell.magnet, *pelec, conv_esolver, iter, drho, diff --git a/source/source_esolver/esolver_of.cpp b/source/source_esolver/esolver_of.cpp index 4debfde4d59..b17cf6fb9df 100644 --- a/source/source_esolver/esolver_of.cpp +++ b/source/source_esolver/esolver_of.cpp @@ -27,10 +27,10 @@ ESolver_OF::ESolver_OF() ESolver_OF::~ESolver_OF() { - //**************************************************** - // do not add any codes in this deconstructor funcion - //**************************************************** - delete psi_; + //**************************************************** + // do not add any codes in this deconstructor funcion + //**************************************************** + delete psi_; delete[] this->pphi_; for (int i = 0; i < PARAM.inp.nspin; ++i) @@ -137,11 +137,7 @@ void ESolver_OF::runner(UnitCell& ucell, const int istep) this->iter_ = 0; bool conv_esolver = false; // this conv_esolver is added by mohan 20250302 -#ifdef __MPI - this->iter_time = MPI_Wtime(); -#else - this->iter_time = std::chrono::system_clock::now(); -#endif + this->iter_time = ModuleBase::get_time(); while (true) { diff --git a/source/source_esolver/esolver_of_tddft.cpp b/source/source_esolver/esolver_of_tddft.cpp index daeda628cbe..12a398a2f74 100644 --- a/source/source_esolver/esolver_of_tddft.cpp +++ b/source/source_esolver/esolver_of_tddft.cpp @@ -41,11 +41,7 @@ void ESolver_OF_TDDFT::runner(UnitCell& ucell, const int istep) this->iter_ = 0; bool conv_esolver = false; // this conv_esolver is added by mohan 20250302 -#ifdef __MPI - this->iter_time = MPI_Wtime(); -#else - this->iter_time = std::chrono::system_clock::now(); -#endif + this->iter_time = ModuleBase::get_time(); if (this->phi_td.empty()) { diff --git a/source/source_pw/module_ofdft/of_print_info.cpp b/source/source_pw/module_ofdft/of_print_info.cpp index ea411bcb1b7..fa19083dcdc 100644 --- a/source/source_pw/module_ofdft/of_print_info.cpp +++ b/source/source_pw/module_ofdft/of_print_info.cpp @@ -8,17 +8,13 @@ * and write the components of the total energy into running_log. */ void OFDFT::print_info(const int iter, - #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, - const elecstate::ElecState *pelec, - KEDF_Manager *kedf_manager, - const bool conv_esolver) + ModuleBase::TimePoint &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,13 +31,7 @@ void OFDFT::print_info(const int iter, {"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 + double duration = ModuleBase::get_duration(iter_time, ModuleBase::get_time()); 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 @@ -141,9 +131,5 @@ void OFDFT::print_info(const int iter, 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 + iter_time = ModuleBase::get_time(); } diff --git a/source/source_pw/module_ofdft/of_print_info.h b/source/source_pw/module_ofdft/of_print_info.h index b60eeb69db6..dd45e6bbc6d 100644 --- a/source/source_pw/module_ofdft/of_print_info.h +++ b/source/source_pw/module_ofdft/of_print_info.h @@ -4,24 +4,20 @@ #include "source_estate/elecstate.h" // electronic states #include "source_pw/module_ofdft/kedf_manager.h" -#include +#include "source_base/timer_wrapper.h" namespace OFDFT { void print_info(const int iter, - #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, - const elecstate::ElecState *pelec, - KEDF_Manager *kedf_manager, - const bool conv_esolver); + ModuleBase::TimePoint &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 382926887a20b868df74a8eefef3b299c232fb1a Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Fri, 23 Jan 2026 20:54:14 +0800 Subject: [PATCH 02/54] Refactor timer code and clean_esolver function 1. Remove #ifdef __MPI from timer code, encapsulate in timer_wrapper.h 2. Move ESolver clean logic to after_all_runners method 3. Replace clean_esolver calls with direct delete p_esolver 4. Remove #ifdef __MPI from delete p_esolver 5. Add Cblacs_exit(1) in after_all_runners for LCAO calculations --- source/source_esolver/esolver.cpp | 51 ++++++++--------------- source/source_esolver/esolver.h | 2 +- source/source_esolver/esolver_ks_lcao.cpp | 28 ++++++++----- source/source_main/driver_run.cpp | 8 +--- 4 files changed, 39 insertions(+), 50 deletions(-) diff --git a/source/source_esolver/esolver.cpp b/source/source_esolver/esolver.cpp index 2d896733137..4809c6df776 100644 --- a/source/source_esolver/esolver.cpp +++ b/source/source_esolver/esolver.cpp @@ -311,23 +311,23 @@ ESolver* init_esolver(const Input_para& inp, UnitCell& ucell) // of LR-TDDFT is implemented. std::cout << " PREPARING FOR EXCITED STATES." << std::endl; // initialize the 2nd ESolver_LR at the temporary pointer - ModuleESolver::ESolver* p_esolver_lr = nullptr; - if (PARAM.globalv.gamma_only_local) - { - p_esolver_lr = new LR::ESolver_LR( - std::move(*dynamic_cast*>(p_esolver)), - inp, - ucell); - } - else - { - p_esolver_lr = new LR::ESolver_LR, double>( - std::move(*dynamic_cast, double>*>(p_esolver)), - inp, - ucell); - } - // clean the 1st ESolver_KS and swap the pointer - ModuleESolver::clean_esolver(p_esolver, false); // do not call Cblacs_exit, remain it for the 2nd ESolver + ModuleESolver::ESolver* p_esolver_lr = nullptr; + if (PARAM.globalv.gamma_only_local) + { + p_esolver_lr = new LR::ESolver_LR( + std::move(*dynamic_cast*>(p_esolver)), + inp, + ucell); + } + else + { + p_esolver_lr = new LR::ESolver_LR, double>( + std::move(*dynamic_cast, double>*>(p_esolver)), + inp, + ucell); + } + // clean the 1st ESolver_KS and swap the pointer + delete p_esolver; return p_esolver_lr; } #endif @@ -355,20 +355,5 @@ ESolver* init_esolver(const Input_para& inp, UnitCell& ucell) + " line " + std::to_string(__LINE__)); } -void clean_esolver(ESolver*& pesolver, const bool lcao_cblacs_exit) -{ -// Zhang Xiaoyang modified in 2024/7/6: -// Note: because of the init method of serial lcao hsolver -// it needs no release step for it, or this [delete] will cause Segmentation Fault -// Probably it will be modified later. -#ifdef __MPI - delete pesolver; -#ifdef __LCAO - if (lcao_cblacs_exit) - { - Cblacs_exit(1); - } -#endif -#endif -} + } // namespace ModuleESolver diff --git a/source/source_esolver/esolver.h b/source/source_esolver/esolver.h index 6716ea0c965..dd621cfe155 100644 --- a/source/source_esolver/esolver.h +++ b/source/source_esolver/esolver.h @@ -69,7 +69,7 @@ std::string determine_type(); */ ESolver* init_esolver(const Input_para& inp, UnitCell& ucell); -void clean_esolver(ESolver*& pesolver, const bool lcao_cblacs_exit = false); + } // namespace ModuleESolver diff --git a/source/source_esolver/esolver_ks_lcao.cpp b/source/source_esolver/esolver_ks_lcao.cpp index 3a2fb57496b..47b66489549 100644 --- a/source/source_esolver/esolver_ks_lcao.cpp +++ b/source/source_esolver/esolver_ks_lcao.cpp @@ -293,17 +293,25 @@ void ESolver_KS_LCAO::after_all_runners(UnitCell& ucell) ESolver_KS::after_all_runners(ucell); auto* hamilt_lcao = dynamic_cast*>(this->p_hamilt); - if(!hamilt_lcao) - { - ModuleBase::WARNING_QUIT("ESolver_KS_LCAO::after_all_runners","p_hamilt does not exist"); - } + if(!hamilt_lcao) + { + ModuleBase::WARNING_QUIT("ESolver_KS_LCAO::after_all_runners","p_hamilt does not exist"); + } - ModuleIO::ctrl_runner_lcao(ucell, - PARAM.inp, this->kv, this->pelec, this->dmat, this->pv, this->Pgrid, - this->gd, this->psi, this->chr, hamilt_lcao, - this->two_center_bundle_, - this->orb_, this->pw_rho, this->pw_rhod, - this->sf, this->locpp.vloc, this->exx_nao, this->solvent); + ModuleIO::ctrl_runner_lcao(ucell, + PARAM.inp, this->kv, this->pelec, this->dmat, this->pv, this->Pgrid, + this->gd, this->psi, this->chr, hamilt_lcao, + this->two_center_bundle_, + this->orb_, this->pw_rho, this->pw_rhod, + this->sf, this->locpp.vloc, this->exx_nao, this->solvent); + + +#ifdef __MPI +#ifdef __LCAO + // Exit BLACS environment for LCAO calculations + Cblacs_exit(1); +#endif +#endif ModuleBase::timer::tick("ESolver_KS_LCAO", "after_all_runners"); } diff --git a/source/source_main/driver_run.cpp b/source/source_main/driver_run.cpp index 990aa56751e..895b06bf577 100644 --- a/source/source_main/driver_run.cpp +++ b/source/source_main/driver_run.cpp @@ -90,11 +90,6 @@ void Driver::driver_run() else if (cal == "get_pchg" || cal == "get_wf" || cal == "gen_bessel" || cal == "gen_opt_abfs" || cal == "test_memory" || cal == "test_neighbour") { - //! supported "other" functions: - //! get_pchg(LCAO), - //! test_memory(PW,LCAO), - //! test_neighbour(LCAO), - //! gen_bessel(PW), et al. const int istep = 0; p_esolver->others(ucell, istep); } @@ -106,7 +101,8 @@ void Driver::driver_run() //! 5: clean up esolver p_esolver->after_all_runners(ucell); - ModuleESolver::clean_esolver(p_esolver); + delete p_esolver; + this->finalize_hardware(); //! 6: output the json file From c2767b78c88a10def49984fe5aef60ae86b87067 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sat, 24 Jan 2026 16:45:52 +0800 Subject: [PATCH 03/54] Refactor: Move heterogeneous parallel code to source_base/module_device --- .../source_base/module_device/device_check.h | 182 ++++++++++++++++ source/source_pw/module_pwdft/global.h | 196 +----------------- 2 files changed, 183 insertions(+), 195 deletions(-) create mode 100644 source/source_base/module_device/device_check.h diff --git a/source/source_base/module_device/device_check.h b/source/source_base/module_device/device_check.h new file mode 100644 index 00000000000..a708cc1d7f9 --- /dev/null +++ b/source/source_base/module_device/device_check.h @@ -0,0 +1,182 @@ +#ifndef DEVICE_CHECK_H +#define DEVICE_CHECK_H + +#include + +#ifdef __CUDA +#include "cublas_v2.h" +#include "cufft.h" +#include "source_base/module_device/cuda_compat.h" + +static const char* _cublasGetErrorString(cublasStatus_t error) +{ + switch (error) + { + case CUBLAS_STATUS_SUCCESS: + return "CUBLAS_STATUS_SUCCESS"; + case CUBLAS_STATUS_NOT_INITIALIZED: + return "CUBLAS_STATUS_NOT_INITIALIZED"; + case CUBLAS_STATUS_ALLOC_FAILED: + return "CUBLAS_STATUS_ALLOC_FAILED"; + case CUBLAS_STATUS_INVALID_VALUE: + return "CUBLAS_STATUS_INVALID_VALUE"; + case CUBLAS_STATUS_ARCH_MISMATCH: + return "CUBLAS_STATUS_ARCH_MISMATCH"; + case CUBLAS_STATUS_MAPPING_ERROR: + return "CUBLAS_STATUS_MAPPING_ERROR"; + case CUBLAS_STATUS_EXECUTION_FAILED: + return "CUBLAS_STATUS_EXECUTION_FAILED"; + case CUBLAS_STATUS_INTERNAL_ERROR: + return "CUBLAS_STATUS_INTERNAL_ERROR"; + } + return ""; +} + +#define CHECK_CUDA(func) \ + { \ + cudaError_t status = (func); \ + if (status != cudaSuccess) \ + { \ + printf("In File %s : CUDA API failed at line %d with error: %s (%d)\n", __FILE__, __LINE__, \ + cudaGetErrorString(status), status); \ + } \ + } + +#define CHECK_CUBLAS(func) \ + { \ + cublasStatus_t status = (func); \ + if (status != CUBLAS_STATUS_SUCCESS) \ + { \ + printf("In File %s : CUBLAS API failed at line %d with error: %s (%d)\n", __FILE__, __LINE__, \ + _cublasGetErrorString(status), status); \ + } \ + } + +#define CHECK_CUSOLVER(func) \ + { \ + cusolverStatus_t status = (func); \ + if (status != CUSOLVER_STATUS_SUCCESS) \ + { \ + printf("In File %s : CUSOLVER API failed at line %d with error: %s (%d)\n", __FILE__, __LINE__, \ + _cusolverGetErrorString(status), status); \ + } \ + } + +#define CHECK_CUFFT(func) \ + { \ + cufftResult_t status = (func); \ + if (status != CUFFT_SUCCESS) \ + { \ + printf("In File %s : CUFFT API failed at line %d with error: %s (%d)\n", __FILE__, __LINE__, \ + ModuleBase::cuda_compat::cufftGetErrorStringCompat(status), status); \ + } \ + } +#endif // __CUDA + +#ifdef __ROCM +#include +#include +#include + +static const char* _hipblasGetErrorString(hipblasStatus_t error) +{ + switch (error) + { + case HIPBLAS_STATUS_SUCCESS: + return "HIPBLAS_STATUS_SUCCESS"; + case HIPBLAS_STATUS_NOT_INITIALIZED: + return "HIPBLAS_STATUS_NOT_INITIALIZED"; + case HIPBLAS_STATUS_ALLOC_FAILED: + return "HIPBLAS_STATUS_ALLOC_FAILED"; + case HIPBLAS_STATUS_INVALID_VALUE: + return "HIPBLAS_STATUS_INVALID_VALUE"; + case HIPBLAS_STATUS_ARCH_MISMATCH: + return "HIPBLAS_STATUS_ARCH_MISMATCH"; + case HIPBLAS_STATUS_MAPPING_ERROR: + return "HIPBLAS_STATUS_MAPPING_ERROR"; + case HIPBLAS_STATUS_EXECUTION_FAILED: + return "HIPBLAS_STATUS_EXECUTION_FAILED"; + case HIPBLAS_STATUS_INTERNAL_ERROR: + return "HIPBLAS_STATUS_INTERNAL_ERROR"; + case HIPBLAS_STATUS_NOT_SUPPORTED: + return "HIPBLAS_STATUS_NOT_SUPPORTED"; + case HIPBLAS_STATUS_HANDLE_IS_NULLPTR: + return "HIPBLAS_STATUS_HANDLE_IS_NULLPTR"; + default: + return ""; + } + return ""; +} + +static const char* _hipfftGetErrorString(hipfftResult_t error) +{ + switch (error) + { + case HIPFFT_SUCCESS: + return "HIPFFT_SUCCESS"; + case HIPFFT_INVALID_PLAN: + return "HIPFFT_INVALID_PLAN"; + case HIPFFT_ALLOC_FAILED: + return "HIPFFT_ALLOC_FAILED"; + case HIPFFT_INVALID_TYPE: + return "HIPFFT_INVALID_TYPE"; + case HIPFFT_INVALID_VALUE: + return "HIPFFT_INVALID_VALUE"; + case HIPFFT_INTERNAL_ERROR: + return "HIPFFT_INTERNAL_ERROR"; + case HIPFFT_EXEC_FAILED: + return "HIPFFT_EXEC_FAILED"; + case HIPFFT_SETUP_FAILED: + return "HIPFFT_SETUP_FAILED"; + case HIPFFT_INVALID_SIZE: + return "HIPFFT_INVALID_SIZE"; + case HIPFFT_UNALIGNED_DATA: + return "HIPFFT_UNALIGNED_DATA"; + case HIPFFT_INCOMPLETE_PARAMETER_LIST: + return "HIPFFT_INCOMPLETE_PARAMETER_LIST"; + case HIPFFT_INVALID_DEVICE: + return "HIPFFT_INVALID_DEVICE"; + case HIPFFT_PARSE_ERROR: + return "HIPFFT_PARSE_ERROR"; + case HIPFFT_NO_WORKSPACE: + return "HIPFFT_NO_WORKSPACE"; + case HIPFFT_NOT_IMPLEMENTED: + return "HIPFFT_NOT_IMPLEMENTED"; + case HIPFFT_NOT_SUPPORTED: + return "HIPFFT_NOT_SUPPORTED"; + } + return ""; +} + +#define CHECK_CUDA(func) \ + { \ + hipError_t status = (func); \ + if (status != hipSuccess) \ + { \ + printf("In File %s : HIP API failed at line %d with error: %s (%d)\n", __FILE__, __LINE__, \ + hipGetErrorString(status), status); \ + } \ + } + +#define CHECK_CUBLAS(func) \ + { \ + hipblasStatus_t status = (func); \ + if (status != HIPBLAS_STATUS_SUCCESS) \ + { \ + printf("In File %s : HIPBLAS API failed at line %d with error: %s (%d)\n", __FILE__, __LINE__, \ + _hipblasGetErrorString(status), status); \ + } \ + } + +#define CHECK_CUFFT(func) \ + { \ + hipfftResult_t status = (func); \ + if (status != HIPFFT_SUCCESS) \ + { \ + printf("In File %s : HIPFFT API failed at line %d with error: %s (%d)\n", __FILE__, __LINE__, \ + _hipfftGetErrorString(status), status); \ + } \ + } +#endif // __ROCM + +#endif // DEVICE_CHECK_H \ No newline at end of file diff --git a/source/source_pw/module_pwdft/global.h b/source/source_pw/module_pwdft/global.h index bea93a93311..c8190386b9b 100644 --- a/source/source_pw/module_pwdft/global.h +++ b/source/source_pw/module_pwdft/global.h @@ -13,201 +13,7 @@ #endif #include "source_estate/magnetism.h" #include "source_hamilt/module_xc/xc_functional.h" -#ifdef __CUDA -#include "cublas_v2.h" -#include "cufft.h" -#include "source_base/module_device/cuda_compat.h" - -static const char* _cublasGetErrorString(cublasStatus_t error) -{ - switch (error) - { - case CUBLAS_STATUS_SUCCESS: - return "CUBLAS_STATUS_SUCCESS"; - case CUBLAS_STATUS_NOT_INITIALIZED: - return "CUBLAS_STATUS_NOT_INITIALIZED"; - case CUBLAS_STATUS_ALLOC_FAILED: - return "CUBLAS_STATUS_ALLOC_FAILED"; - case CUBLAS_STATUS_INVALID_VALUE: - return "CUBLAS_STATUS_INVALID_VALUE"; - case CUBLAS_STATUS_ARCH_MISMATCH: - return "CUBLAS_STATUS_ARCH_MISMATCH"; - case CUBLAS_STATUS_MAPPING_ERROR: - return "CUBLAS_STATUS_MAPPING_ERROR"; - case CUBLAS_STATUS_EXECUTION_FAILED: - return "CUBLAS_STATUS_EXECUTION_FAILED"; - case CUBLAS_STATUS_INTERNAL_ERROR: - return "CUBLAS_STATUS_INTERNAL_ERROR"; - } - return ""; -} - -#define CHECK_CUDA(func) \ - { \ - cudaError_t status = (func); \ - if (status != cudaSuccess) \ - { \ - printf("In File %s : CUDA API failed at line %d with error: %s (%d)\n", __FILE__, __LINE__, \ - cudaGetErrorString(status), status); \ - } \ - } - -#define CHECK_CUBLAS(func) \ - { \ - cublasStatus_t status = (func); \ - if (status != CUBLAS_STATUS_SUCCESS) \ - { \ - printf("In File %s : CUBLAS API failed at line %d with error: %s (%d)\n", __FILE__, __LINE__, \ - _cublasGetErrorString(status), status); \ - } \ - } - -#define CHECK_CUSOLVER(func) \ - { \ - cusolverStatus_t status = (func); \ - if (status != CUSOLVER_STATUS_SUCCESS) \ - { \ - printf("In File %s : CUSOLVER API failed at line %d with error: %s (%d)\n", __FILE__, __LINE__, \ - _cusolverGetErrorString(status), status); \ - } \ - } - -#define CHECK_CUFFT(func) \ - { \ - cufftResult_t status = (func); \ - if (status != CUFFT_SUCCESS) \ - { \ - printf("In File %s : CUFFT API failed at line %d with error: %s (%d)\n", __FILE__, __LINE__, \ - ModuleBase::cuda_compat::cufftGetErrorStringCompat(status), status); \ - } \ - } -#endif // __CUDA - -#ifdef __ROCM -#include -#include -#include - -static const char* _hipblasGetErrorString(hipblasStatus_t error) -{ - switch (error) - { - case HIPBLAS_STATUS_SUCCESS: - return "HIPBLAS_STATUS_SUCCESS"; - case HIPBLAS_STATUS_NOT_INITIALIZED: - return "HIPBLAS_STATUS_NOT_INITIALIZED"; - case HIPBLAS_STATUS_ALLOC_FAILED: - return "HIPBLAS_STATUS_ALLOC_FAILED"; - case HIPBLAS_STATUS_INVALID_VALUE: - return "HIPBLAS_STATUS_INVALID_VALUE"; - case HIPBLAS_STATUS_ARCH_MISMATCH: - return "HIPBLAS_STATUS_ARCH_MISMATCH"; - case HIPBLAS_STATUS_MAPPING_ERROR: - return "HIPBLAS_STATUS_MAPPING_ERROR"; - case HIPBLAS_STATUS_EXECUTION_FAILED: - return "HIPBLAS_STATUS_EXECUTION_FAILED"; - case HIPBLAS_STATUS_INTERNAL_ERROR: - return "HIPBLAS_STATUS_INTERNAL_ERROR"; - case HIPBLAS_STATUS_NOT_SUPPORTED: - return "HIPBLAS_STATUS_NOT_SUPPORTED"; - case HIPBLAS_STATUS_HANDLE_IS_NULLPTR: - return "HIPBLAS_STATUS_HANDLE_IS_NULLPTR"; - default: - return ""; - } - return ""; -} - -// static const char *_rocsolverGetErrorString(rocsolver_status error) -// { -// switch (error) -// { -// // case ROCSOLVER_STATUS_SUCCESS: -// // return "CUSOLVER_STATUS_SUCCESS"; -// } -// return ""; -// } - -static const char* _hipfftGetErrorString(hipfftResult_t error) -{ - switch (error) - { - case HIPFFT_SUCCESS: - return "HIPFFT_SUCCESS"; - case HIPFFT_INVALID_PLAN: - return "HIPFFT_INVALID_PLAN"; - case HIPFFT_ALLOC_FAILED: - return "HIPFFT_ALLOC_FAILED"; - case HIPFFT_INVALID_TYPE: - return "HIPFFT_INVALID_TYPE"; - case HIPFFT_INVALID_VALUE: - return "HIPFFT_INVALID_VALUE"; - case HIPFFT_INTERNAL_ERROR: - return "HIPFFT_INTERNAL_ERROR"; - case HIPFFT_EXEC_FAILED: - return "HIPFFT_EXEC_FAILED"; - case HIPFFT_SETUP_FAILED: - return "HIPFFT_SETUP_FAILED"; - case HIPFFT_INVALID_SIZE: - return "HIPFFT_INVALID_SIZE"; - case HIPFFT_UNALIGNED_DATA: - return "HIPFFT_UNALIGNED_DATA"; - case HIPFFT_INCOMPLETE_PARAMETER_LIST: - return "HIPFFT_INCOMPLETE_PARAMETER_LIST"; - case HIPFFT_INVALID_DEVICE: - return "HIPFFT_INVALID_DEVICE"; - case HIPFFT_PARSE_ERROR: - return "HIPFFT_PARSE_ERROR"; - case HIPFFT_NO_WORKSPACE: - return "HIPFFT_NO_WORKSPACE"; - case HIPFFT_NOT_IMPLEMENTED: - return "HIPFFT_NOT_IMPLEMENTED"; - case HIPFFT_NOT_SUPPORTED: - return "HIPFFT_NOT_SUPPORTED"; - } - return ""; -} - -#define CHECK_CUDA(func) \ - { \ - hipError_t status = (func); \ - if (status != hipSuccess) \ - { \ - printf("In File %s : HIP API failed at line %d with error: %s (%d)\n", __FILE__, __LINE__, \ - hipGetErrorString(status), status); \ - } \ - } - -#define CHECK_CUBLAS(func) \ - { \ - hipblasStatus_t status = (func); \ - if (status != HIPBLAS_STATUS_SUCCESS) \ - { \ - printf("In File %s : HIPBLAS API failed at line %d with error: %s (%d)\n", __FILE__, __LINE__, \ - _hipblasGetErrorString(status), status); \ - } \ - } - -// #define CHECK_CUSOLVER(func)\ -// {\ -// rocsolver_status status = (func);\ -// if(status != CUSOLVER_STATUS_SUCCESS)\ -// {\ -// printf("In File %s : CUSOLVER API failed at line %d with error: %s (%d)\n",\ -// __FILE__, __LINE__, _rocsolverGetErrorString(status), status);\ -// }\ -// } - -#define CHECK_CUFFT(func) \ - { \ - hipfftResult_t status = (func); \ - if (status != HIPFFT_SUCCESS) \ - { \ - printf("In File %s : HIPFFT API failed at line %d with error: %s (%d)\n", __FILE__, __LINE__, \ - _hipfftGetErrorString(status), status); \ - } \ - } -#endif // __ROCM +#include "source_base/module_device/device_check.h" //========================================================== // EXPLAIN : define "GLOBAL CLASS" From 4a99dde90eef4b099bd035ae0a6653cdd439c9bf Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sat, 24 Jan 2026 21:10:46 +0800 Subject: [PATCH 04/54] Refactor heterogeneous parallel code and migrate exx_info to module_xc 1. Refactor global.h: - Removed heterogeneous parallel code (CUDA/ROCm error checking macros) - Added include for source_base/module_device/device_check.h - Removed GlobalC::exx_info declaration 2. Migrate exx_info: - Added GlobalC::exx_info declaration to exx_info.h - Created exx_info.cpp with GlobalC::exx_info definition - Removed exx_info definition from global.cpp - Removed duplicate exx_info definition from exx_helper.cpp 3. Update build system: - Added exx_info.cpp to xc_ library in CMakeLists.txt - Added exx_info.o to OBJS_XC in Makefile.Objects - Fixed formatting in Makefile.Objects 4. Ensure compatibility: - Verify pure PW compilation works with exx_info.cpp - Verify GPU compilation works with refactored code This refactoring improves code modularity by separating heterogeneous parallel functionality from global variables and moving EXX-related global variables to their own module. --- source/Makefile.Objects | 1 + source/source_hamilt/module_xc/CMakeLists.txt | 1 + source/source_hamilt/module_xc/exx_info.cpp | 9 +++++++++ source/source_hamilt/module_xc/exx_info.h | 8 ++++++++ source/source_pw/module_pwdft/global.cpp | 3 --- source/source_pw/module_pwdft/global.h | 6 ------ .../module_pwdft/module_exx_helper/exx_helper.cpp | 7 ------- 7 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 source/source_hamilt/module_xc/exx_info.cpp diff --git a/source/Makefile.Objects b/source/Makefile.Objects index 4b8288b5f55..6d310cf9753 100644 --- a/source/Makefile.Objects +++ b/source/Makefile.Objects @@ -510,6 +510,7 @@ OBJS_XC=xc_functional.o\ xc_funct_exch_gga.o\ xc_funct_corr_gga.o\ xc_funct_hcth.o\ + exx_info.o\ OBJS_IO=input_conv.o\ berryphase.o\ diff --git a/source/source_hamilt/module_xc/CMakeLists.txt b/source/source_hamilt/module_xc/CMakeLists.txt index 4db1ef083d7..9d38b59fa2a 100644 --- a/source/source_hamilt/module_xc/CMakeLists.txt +++ b/source/source_hamilt/module_xc/CMakeLists.txt @@ -17,6 +17,7 @@ add_library( xc_functional_libxc_wrapper_xc.cpp xc_functional_libxc_wrapper_gcxc.cpp xc_functional_libxc_wrapper_tauxc.cpp + exx_info.cpp ) if(ENABLE_COVERAGE) diff --git a/source/source_hamilt/module_xc/exx_info.cpp b/source/source_hamilt/module_xc/exx_info.cpp new file mode 100644 index 00000000000..84168910529 --- /dev/null +++ b/source/source_hamilt/module_xc/exx_info.cpp @@ -0,0 +1,9 @@ +#include "exx_info.h" + +//---------------------------------------------------------- +// init "GLOBAL CLASS" object +//---------------------------------------------------------- +namespace GlobalC +{ + Exx_Info exx_info; +} \ No newline at end of file diff --git a/source/source_hamilt/module_xc/exx_info.h b/source/source_hamilt/module_xc/exx_info.h index 5cca433b94b..55ae60668f2 100644 --- a/source/source_hamilt/module_xc/exx_info.h +++ b/source/source_hamilt/module_xc/exx_info.h @@ -95,4 +95,12 @@ struct Exx_Info } }; +//========================================================== +// EXPLAIN : define "GLOBAL CLASS" +//========================================================== +namespace GlobalC +{ + extern Exx_Info exx_info; +} // namespace GlobalC + #endif diff --git a/source/source_pw/module_pwdft/global.cpp b/source/source_pw/module_pwdft/global.cpp index f483101fe28..fd2195162dc 100644 --- a/source/source_pw/module_pwdft/global.cpp +++ b/source/source_pw/module_pwdft/global.cpp @@ -4,9 +4,6 @@ //---------------------------------------------------------- namespace GlobalC { -#ifdef __EXX - Exx_Info exx_info; -#endif Restart restart; // Peize Lin add 2020.04.04 } diff --git a/source/source_pw/module_pwdft/global.h b/source/source_pw/module_pwdft/global.h index c8190386b9b..d25b26ef9fc 100644 --- a/source/source_pw/module_pwdft/global.h +++ b/source/source_pw/module_pwdft/global.h @@ -18,12 +18,6 @@ //========================================================== // EXPLAIN : define "GLOBAL CLASS" //========================================================== -namespace GlobalC -{ -//#ifdef __EXX - extern Exx_Info exx_info; -//#endif -} // namespace GlobalC #include "source_cell/parallel_kpoints.h" #include "source_cell/unitcell.h" diff --git a/source/source_pw/module_pwdft/module_exx_helper/exx_helper.cpp b/source/source_pw/module_pwdft/module_exx_helper/exx_helper.cpp index 1b41163967b..db0a2aa49ab 100644 --- a/source/source_pw/module_pwdft/module_exx_helper/exx_helper.cpp +++ b/source/source_pw/module_pwdft/module_exx_helper/exx_helper.cpp @@ -57,10 +57,3 @@ template class Exx_Helper, base_device::DEVICE_GPU>; template class Exx_Helper, base_device::DEVICE_GPU>; #endif -#ifndef __EXX -#include "source_hamilt/module_xc/exx_info.h" -namespace GlobalC -{ - Exx_Info exx_info; -} -#endif \ No newline at end of file From ce6f894f450f0f519ecf4da8242f575a44dd9543 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sat, 24 Jan 2026 21:25:31 +0800 Subject: [PATCH 05/54] Move GlobalC::restart to source_io/restart 1. Move GlobalC::restart declaration from global.h to restart.h 2. Move GlobalC::restart definition from global.cpp to restart.cpp 3. Keep the same functionality and usage 4. Improve code modularity by centralizing restart-related code in source_io module 5. Ensure compatibility with both pure PW and GPU compilation modes --- source/source_io/restart.cpp | 5 +++++ source/source_io/restart.h | 5 +++++ source/source_pw/module_pwdft/global.cpp | 4 ---- source/source_pw/module_pwdft/global.h | 5 ----- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/source/source_io/restart.cpp b/source/source_io/restart.cpp index 1841f3bb376..c960215a2a6 100644 --- a/source/source_io/restart.cpp +++ b/source/source_io/restart.cpp @@ -42,6 +42,11 @@ bool Restart::write_file2(const std::string& file_name, const void* const ptr, c return true; } +namespace GlobalC +{ +Restart restart; // Peize Lin add 2020.04.04 +} // namespace GlobalC + bool Restart::read_file2(const std::string& file_name, void* const ptr, const size_t size, const bool error_quit) const { const int file = open(file_name.c_str(), O_RDONLY); diff --git a/source/source_io/restart.h b/source/source_io/restart.h index d3cf0cf2df2..8908c9d8022 100644 --- a/source/source_io/restart.h +++ b/source/source_io/restart.h @@ -55,4 +55,9 @@ class Restart bool read_file2(const std::string& file_name, void* const ptr, const size_t size, const bool error_quit = true) const; }; +namespace GlobalC +{ +extern Restart restart; // Peize Lin add 2020.04.04 +} // namespace GlobalC + #endif diff --git a/source/source_pw/module_pwdft/global.cpp b/source/source_pw/module_pwdft/global.cpp index fd2195162dc..5d126675ea6 100644 --- a/source/source_pw/module_pwdft/global.cpp +++ b/source/source_pw/module_pwdft/global.cpp @@ -2,9 +2,5 @@ //---------------------------------------------------------- // init "GLOBAL CLASS" object //---------------------------------------------------------- -namespace GlobalC -{ -Restart restart; // Peize Lin add 2020.04.04 -} //Magnetism mag; diff --git a/source/source_pw/module_pwdft/global.h b/source/source_pw/module_pwdft/global.h index d25b26ef9fc..fe682aa564a 100644 --- a/source/source_pw/module_pwdft/global.h +++ b/source/source_pw/module_pwdft/global.h @@ -21,11 +21,6 @@ #include "source_cell/parallel_kpoints.h" #include "source_cell/unitcell.h" -namespace GlobalC -{ -extern Restart restart; // Peize Lin add 2020.04.04 -} // namespace GlobalC - // extern Magnetism mag; #endif From 2421709447e136326d61c7b63a8647d31460aeb5 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 09:10:30 +0800 Subject: [PATCH 06/54] Remove unnecessary global.h includes and fix line_search.cpp compilation error --- .../module_operator_lcao/meta_lcao.cpp | 1 - source/source_pw/module_pwdft/forces.cpp | 1 - source/source_pw/module_stodft/sto_forces.cpp | 1 - source/source_relax/bfgs.cpp | 1 - source/source_relax/lbfgs.cpp | 1 - source/source_relax/line_search.cpp | 58 +++++++++++-------- source/source_relax/relax_driver.cpp | 1 - 7 files changed, 34 insertions(+), 30 deletions(-) diff --git a/source/source_lcao/module_operator_lcao/meta_lcao.cpp b/source/source_lcao/module_operator_lcao/meta_lcao.cpp index f5db5e939ae..c6384af94f1 100644 --- a/source/source_lcao/module_operator_lcao/meta_lcao.cpp +++ b/source/source_lcao/module_operator_lcao/meta_lcao.cpp @@ -1,7 +1,6 @@ #include "meta_lcao.h" #include "source_base/timer.h" #include "source_base/tool_title.h" -#include "source_pw/module_pwdft/global.h" namespace hamilt { diff --git a/source/source_pw/module_pwdft/forces.cpp b/source/source_pw/module_pwdft/forces.cpp index 819f0cdf232..255b8e23a2c 100644 --- a/source/source_pw/module_pwdft/forces.cpp +++ b/source/source_pw/module_pwdft/forces.cpp @@ -1,7 +1,6 @@ #include "forces.h" #include "source_io/module_parameter/parameter.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/output_log.h" // new #include "source_base/complexmatrix.h" diff --git a/source/source_pw/module_stodft/sto_forces.cpp b/source/source_pw/module_stodft/sto_forces.cpp index 35ed90a80b4..3fb761d85c6 100644 --- a/source/source_pw/module_stodft/sto_forces.cpp +++ b/source/source_pw/module_stodft/sto_forces.cpp @@ -5,7 +5,6 @@ #include "source_estate/elecstate.h" #include "source_estate/module_pot/efield.h" #include "source_estate/module_pot/gatefield.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/output_log.h" #include "source_io/module_parameter/parameter.h" #include "source_pw/module_pwdft/fs_nonlocal_tools.h" diff --git a/source/source_relax/bfgs.cpp b/source/source_relax/bfgs.cpp index d105dc2791f..078a5122f9c 100644 --- a/source/source_relax/bfgs.cpp +++ b/source/source_relax/bfgs.cpp @@ -1,5 +1,4 @@ #include "bfgs.h" -#include "source_pw/module_pwdft/global.h" #include "source_base/module_external/lapack_connector.h" #include "source_io/module_parameter/parameter.h" #include "ions_move_basic.h" diff --git a/source/source_relax/lbfgs.cpp b/source/source_relax/lbfgs.cpp index 31eaa2116a2..b347fe86fb8 100644 --- a/source/source_relax/lbfgs.cpp +++ b/source/source_relax/lbfgs.cpp @@ -1,5 +1,4 @@ #include "lbfgs.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/module_parameter/parameter.h" #include "ions_move_basic.h" #include "source_cell/update_cell.h" diff --git a/source/source_relax/line_search.cpp b/source/source_relax/line_search.cpp index bbf308f638e..1c07a59c3d4 100644 --- a/source/source_relax/line_search.cpp +++ b/source/source_relax/line_search.cpp @@ -1,9 +1,10 @@ #include "line_search.h" -#include "source_pw/module_pwdft/global.h" - +#include "source_base/global_function.h" +#include "source_base/global_variable.h" #include #include +#include bool Line_Search::line_search(const bool restart, const double x, // current point @@ -12,9 +13,10 @@ bool Line_Search::line_search(const bool restart, double& xnew, // the next point that we want to try const double conv_thr) { - if (restart) { - ls_step = 0; -} + if (restart) + { + ls_step = 0; + } if (ls_step == 0) // first point: make a trial step into trial direction { @@ -100,10 +102,11 @@ bool Line_Search::third_order(const double x, const double y, const double f, do } dmoveh = -fa / (fab - fa) / 2.0; - if (dmoveh < 0) { + if (dmoveh < 0) + { dmoveh = 4.0; -} - + } + if (dmove > 2.0 * dmoveh || dmoveh > 2.0 * dmove || (fa * fb > 0 && dmove < 1.0) || (fa * fb < 0 && dmove > 1.0)) { @@ -111,15 +114,17 @@ bool Line_Search::third_order(const double x, const double y, const double f, do } } // end anharmonic case - if (dmove > 4.0) { - dmove = 4.0; -} + if (dmove > 4.0) + { + dmove = 4.0; + } xnew = dmove + xa; double dy = (fb + (fab - fb) / (xa - xb) * (dmove - xb)) * (dmove - xb); - if (std::abs(dy) < conv_thr) { + if (std::abs(dy) < conv_thr) + { return true; -} + } ls_step++; return false; @@ -137,9 +142,10 @@ void Line_Search::init_brent(const double x, const double y, const double f) xb = x; yb = y; fb = f; - if (fa * fb > 0) { + if (fa * fb > 0) + { bracked = false; -} + } fstart = fa; } else // x < b @@ -233,9 +239,10 @@ bool Line_Search::brent(const double x, const double y, const double f, double& p = s * (2.0 * xm * qq * (qq - r) - (xb - xa) * (r - 1.0)); qq = (qq - 1.0) * (r - 1.0) * (s - 1.0); } - if (p > 0.0) { + if (p > 0.0) + { qq = -qq; -} + } p = std::abs(p); if (p < std::min(2.0 * (xb - xa) * qq - std::abs(tol1 * qq), std::abs(xe * qq) / 2.0)) @@ -273,9 +280,10 @@ bool Line_Search::brent(const double x, const double y, const double f, double& } xnew = xb; - if (std::abs(dy) < conv_thr) { + if (std::abs(dy) < conv_thr) + { return true; -} + } if (ls_step == 4) // I'm not sure if this is a good choice, but the idea is there should not be so many line // search steps I feel if the line search does not converge, we'd better change the direction // and restart line search @@ -335,9 +343,10 @@ bool Line_Search::brent(const double x, const double y, const double f, double& p = s * (2.0 * xm * qq * (qq - r) - (xb - xa) * (r - 1.0)); qq = (qq - 1.0) * (r - 1.0) * (s - 1.0); } - if (p > 0.0) { + if (p > 0.0) + { qq = -qq; -} + } p = std::abs(p); if (2.0 * p < std::min(3.0 * xm * qq - std::abs(tol1 * qq), std::abs(xe * qq))) @@ -381,9 +390,10 @@ bool Line_Search::brent(const double x, const double y, const double f, double& } xnew = xb; - if (std::abs(dy) < conv_thr) { + if (std::abs(dy) < conv_thr) + { return true; -} + } if (ls_step == 4) { GlobalV::ofs_running << "Too many Brent steps, let's do next CG step" << std::endl; @@ -392,4 +402,4 @@ bool Line_Search::brent(const double x, const double y, const double f, double& } return false; } // end ibrack -} \ No newline at end of file +} diff --git a/source/source_relax/relax_driver.cpp b/source/source_relax/relax_driver.cpp index 9b5217d77c7..434015e5ca5 100644 --- a/source/source_relax/relax_driver.cpp +++ b/source/source_relax/relax_driver.cpp @@ -1,7 +1,6 @@ #include "relax_driver.h" #include "source_base/global_file.h" -#include "source_pw/module_pwdft/global.h" // use chr. #include "source_io/cif_io.h" #include "source_io/json_output/output_info.h" #include "source_io/output_log.h" From 5552c1a192505db1427c26fe06150761d9aac9da Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 09:12:59 +0800 Subject: [PATCH 07/54] update global.h --- source/source_pw/module_pwdft/global.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/source/source_pw/module_pwdft/global.h b/source/source_pw/module_pwdft/global.h index fe682aa564a..cc92d58bce8 100644 --- a/source/source_pw/module_pwdft/global.h +++ b/source/source_pw/module_pwdft/global.h @@ -4,7 +4,6 @@ #include "source_base/global_function.h" #include "source_base/global_variable.h" #include "source_estate/module_charge/charge_mixing.h" -#include "source_pw/module_pwdft/VNL_in_pw.h" #include "source_io/restart.h" #include "source_relax/relax_driver.h" #ifdef __EXX @@ -14,13 +13,7 @@ #include "source_estate/magnetism.h" #include "source_hamilt/module_xc/xc_functional.h" #include "source_base/module_device/device_check.h" - -//========================================================== -// EXPLAIN : define "GLOBAL CLASS" -//========================================================== - #include "source_cell/parallel_kpoints.h" #include "source_cell/unitcell.h" -// extern Magnetism mag; #endif From 7ba39717004d185a0a2893eade9502f95cb8a8de Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 09:14:59 +0800 Subject: [PATCH 08/54] update global.h --- source/source_pw/module_pwdft/global.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/source/source_pw/module_pwdft/global.h b/source/source_pw/module_pwdft/global.h index cc92d58bce8..1e1abd07221 100644 --- a/source/source_pw/module_pwdft/global.h +++ b/source/source_pw/module_pwdft/global.h @@ -3,17 +3,14 @@ #include "source_base/global_function.h" #include "source_base/global_variable.h" -#include "source_estate/module_charge/charge_mixing.h" #include "source_io/restart.h" #include "source_relax/relax_driver.h" #ifdef __EXX #include "source_hamilt/module_xc/exx_info.h" #include "source_lcao/module_ri/exx_lip.h" #endif -#include "source_estate/magnetism.h" #include "source_hamilt/module_xc/xc_functional.h" #include "source_base/module_device/device_check.h" -#include "source_cell/parallel_kpoints.h" #include "source_cell/unitcell.h" #endif From e53bff95f93bf575dc1e59f603343b3f8386acfe Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 09:25:02 +0800 Subject: [PATCH 09/54] update global.h --- source/source_main/driver_run.cpp | 2 +- source/source_pw/module_pwdft/global.h | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/source/source_main/driver_run.cpp b/source/source_main/driver_run.cpp index 895b06bf577..fa0d0291262 100644 --- a/source/source_main/driver_run.cpp +++ b/source/source_main/driver_run.cpp @@ -1,7 +1,7 @@ #include "source_main/driver.h" #include "source_cell/check_atomic_stru.h" #include "source_cell/module_neighbor/sltk_atom_arrange.h" -#include "source_pw/module_pwdft/global.h" +#include "source_relax/relax_driver.h" #include "source_io/module_parameter/parameter.h" #include "source_io/para_json.h" #include "source_io/print_info.h" diff --git a/source/source_pw/module_pwdft/global.h b/source/source_pw/module_pwdft/global.h index 1e1abd07221..a41c0cfd3f4 100644 --- a/source/source_pw/module_pwdft/global.h +++ b/source/source_pw/module_pwdft/global.h @@ -4,13 +4,23 @@ #include "source_base/global_function.h" #include "source_base/global_variable.h" #include "source_io/restart.h" -#include "source_relax/relax_driver.h" + + +#include "source_cell/unitcell.h" +#include "source_esolver/esolver.h" +#include "source_esolver/esolver_ks.h" +#include "source_relax/relax_sync.h" +#include "source_relax/relax_nsync.h" +#include "source_relax/bfgs.h" +#include "source_io/module_parameter/input_parameter.h" + + +#include "source_io/module_parameter/parameter.h" #ifdef __EXX #include "source_hamilt/module_xc/exx_info.h" #include "source_lcao/module_ri/exx_lip.h" #endif #include "source_hamilt/module_xc/xc_functional.h" #include "source_base/module_device/device_check.h" -#include "source_cell/unitcell.h" #endif From 3a3898a7790760e4888daa16191b7600e7fec710 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 09:33:17 +0800 Subject: [PATCH 10/54] update global.h --- source/source_pw/module_pwdft/global.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/source/source_pw/module_pwdft/global.h b/source/source_pw/module_pwdft/global.h index a41c0cfd3f4..53258d870b8 100644 --- a/source/source_pw/module_pwdft/global.h +++ b/source/source_pw/module_pwdft/global.h @@ -5,21 +5,17 @@ #include "source_base/global_variable.h" #include "source_io/restart.h" - +#include "source_relax/ions_move_methods.h" +#include "source_relax/lattice_change_methods.h" #include "source_cell/unitcell.h" -#include "source_esolver/esolver.h" -#include "source_esolver/esolver_ks.h" -#include "source_relax/relax_sync.h" -#include "source_relax/relax_nsync.h" #include "source_relax/bfgs.h" #include "source_io/module_parameter/input_parameter.h" - -#include "source_io/module_parameter/parameter.h" #ifdef __EXX #include "source_hamilt/module_xc/exx_info.h" #include "source_lcao/module_ri/exx_lip.h" #endif + #include "source_hamilt/module_xc/xc_functional.h" #include "source_base/module_device/device_check.h" From 86dc68ecb9762369a2d5c8a970159f7a498caacd Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 09:42:01 +0800 Subject: [PATCH 11/54] update stress_pw.cpp --- source/source_pw/module_pwdft/global.cpp | 6 ------ source/source_pw/module_pwdft/stress_pw.cpp | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/source/source_pw/module_pwdft/global.cpp b/source/source_pw/module_pwdft/global.cpp index 5d126675ea6..e69de29bb2d 100644 --- a/source/source_pw/module_pwdft/global.cpp +++ b/source/source_pw/module_pwdft/global.cpp @@ -1,6 +0,0 @@ -#include "global.h" -//---------------------------------------------------------- -// init "GLOBAL CLASS" object -//---------------------------------------------------------- - -//Magnetism mag; diff --git a/source/source_pw/module_pwdft/stress_pw.cpp b/source/source_pw/module_pwdft/stress_pw.cpp index f79bd6349c7..919d1288bfe 100644 --- a/source/source_pw/module_pwdft/stress_pw.cpp +++ b/source/source_pw/module_pwdft/stress_pw.cpp @@ -2,8 +2,8 @@ #include "source_base/timer.h" #include "source_hamilt/module_vdw/vdw.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/output_log.h" +#include "source_hamilt/module_xc/xc_functional.h" template void Stress_PW::cal_stress(ModuleBase::matrix& sigmatot, From 08816372001d4850f520ac477c0279ddae2e8702 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 09:46:29 +0800 Subject: [PATCH 12/54] update global.h --- source/source_lcao/wavefunc_in_pw.cpp | 3 +-- .../source_pw/module_pwdft/stress_func_cc.cpp | 1 - .../module_pwdft/stress_func_har.cpp | 1 - .../module_pwdft/stress_func_kin.cpp | 1 - .../module_pwdft/stress_func_loc.cpp | 19 +++++++++---------- .../module_pwdft/stress_func_mgga.cpp | 1 - .../source_pw/module_pwdft/stress_func_nl.cpp | 1 - 7 files changed, 10 insertions(+), 17 deletions(-) diff --git a/source/source_lcao/wavefunc_in_pw.cpp b/source/source_lcao/wavefunc_in_pw.cpp index 064a93c0d02..701f0f42a47 100644 --- a/source/source_lcao/wavefunc_in_pw.cpp +++ b/source/source_lcao/wavefunc_in_pw.cpp @@ -1,7 +1,6 @@ +#include // Peize Lin fix bug about strcmp 2016-08-02 #include "wavefunc_in_pw.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/module_parameter/parameter.h" -#include // Peize Lin fix bug about strcmp 2016-08-02 #include "source_base/math_integral.h" #include "source_base/math_sphbes.h" #include "source_base/math_polyint.h" diff --git a/source/source_pw/module_pwdft/stress_func_cc.cpp b/source/source_pw/module_pwdft/stress_func_cc.cpp index 81b2767d51e..211d5a4bda9 100644 --- a/source/source_pw/module_pwdft/stress_func_cc.cpp +++ b/source/source_pw/module_pwdft/stress_func_cc.cpp @@ -3,7 +3,6 @@ #include "source_io/module_parameter/parameter.h" #include "source_base/math_integral.h" #include "source_base/timer.h" -#include "source_pw/module_pwdft/global.h" #include "source_estate/cal_ux.h" #ifdef USE_LIBXC diff --git a/source/source_pw/module_pwdft/stress_func_har.cpp b/source/source_pw/module_pwdft/stress_func_har.cpp index b99ee7fb041..90d80bc4dc8 100644 --- a/source/source_pw/module_pwdft/stress_func_har.cpp +++ b/source/source_pw/module_pwdft/stress_func_har.cpp @@ -2,7 +2,6 @@ #include "source_estate/module_pot/H_Hartree_pw.h" #include "source_io/module_parameter/parameter.h" #include "source_base/timer.h" -#include "source_pw/module_pwdft/global.h" //calculate the Hartree part in PW or LCAO base template diff --git a/source/source_pw/module_pwdft/stress_func_kin.cpp b/source/source_pw/module_pwdft/stress_func_kin.cpp index 1336be5c093..83d6617ffe2 100644 --- a/source/source_pw/module_pwdft/stress_func_kin.cpp +++ b/source/source_pw/module_pwdft/stress_func_kin.cpp @@ -1,5 +1,4 @@ #include "stress_func.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/module_parameter/parameter.h" #include "source_base/timer.h" #include "source_pw/module_pwdft/fs_kin_tools.h" diff --git a/source/source_pw/module_pwdft/stress_func_loc.cpp b/source/source_pw/module_pwdft/stress_func_loc.cpp index fe4d85e1be8..11c414f4dcd 100644 --- a/source/source_pw/module_pwdft/stress_func_loc.cpp +++ b/source/source_pw/module_pwdft/stress_func_loc.cpp @@ -4,23 +4,22 @@ #include "source_base/tool_threading.h" #include "source_base/timer.h" #include "source_base/libm/libm.h" -#include "source_pw/module_pwdft/global.h" //calculate local pseudopotential stress in PW or VL_dVL stress in LCAO template void Stress_Func::stress_loc(const UnitCell& ucell, - ModuleBase::matrix& sigma, - ModulePW::PW_Basis* rho_basis, - const ModuleBase::matrix& vloc, - const Structure_Factor* p_sf, - const bool is_pw, - const Charge* const chr) + ModuleBase::matrix& sigma, + ModulePW::PW_Basis* rho_basis, + const ModuleBase::matrix& vloc, + const Structure_Factor* p_sf, + const bool is_pw, + const Charge* const chr) { - ModuleBase::TITLE("Stress","stress_loc"); - ModuleBase::timer::tick("Stress","stress_loc"); + ModuleBase::TITLE("Stress","stress_loc"); + ModuleBase::timer::tick("Stress","stress_loc"); std::vector dvloc(rho_basis->npw); - FPTYPE evloc=0.0; + FPTYPE evloc=0.0; FPTYPE fact=1.0; const int nspin_rho = (PARAM.inp.nspin == 2) ? 2 : 1; diff --git a/source/source_pw/module_pwdft/stress_func_mgga.cpp b/source/source_pw/module_pwdft/stress_func_mgga.cpp index b2d9ffe841b..35201b51bb6 100644 --- a/source/source_pw/module_pwdft/stress_func_mgga.cpp +++ b/source/source_pw/module_pwdft/stress_func_mgga.cpp @@ -1,7 +1,6 @@ #include "source_base/timer.h" #include "source_hamilt/module_xc/xc_functional.h" #include "source_io/module_parameter/parameter.h" -#include "source_pw/module_pwdft/global.h" #include "stress_func.h" #include diff --git a/source/source_pw/module_pwdft/stress_func_nl.cpp b/source/source_pw/module_pwdft/stress_func_nl.cpp index b5bc6530743..3f825cc6500 100644 --- a/source/source_pw/module_pwdft/stress_func_nl.cpp +++ b/source/source_pw/module_pwdft/stress_func_nl.cpp @@ -5,7 +5,6 @@ #include "source_base/module_device/device.h" #include "source_base/timer.h" #include "source_pw/module_pwdft/fs_nonlocal_tools.h" -#include "source_pw/module_pwdft/global.h" #include "source_pw/module_pwdft/nonlocal_maths.hpp" #include "stress_func.h" // calculate the nonlocal pseudopotential stress in PW From cf3d4ea8bfc04956954033013e17f3c885819021 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 09:52:07 +0800 Subject: [PATCH 13/54] update global.h in module_pwdft --- source/source_pw/module_pwdft/VL_in_pw.cpp | 1 - source/source_pw/module_pwdft/VNL_grad_pw.cpp | 4 ++-- source/source_pw/module_pwdft/VNL_in_pw.cpp | 3 ++- source/source_pw/module_pwdft/stress_func_ewa.cpp | 1 - source/source_pw/module_pwdft/stress_func_gga.cpp | 1 - source/source_pw/module_pwdft/structure_factor.cpp | 1 - 6 files changed, 4 insertions(+), 7 deletions(-) diff --git a/source/source_pw/module_pwdft/VL_in_pw.cpp b/source/source_pw/module_pwdft/VL_in_pw.cpp index 87e14dcced7..66c0b595bbe 100644 --- a/source/source_pw/module_pwdft/VL_in_pw.cpp +++ b/source/source_pw/module_pwdft/VL_in_pw.cpp @@ -3,7 +3,6 @@ #include "source_base/libm/libm.h" #include "source_base/math_integral.h" #include "source_base/timer.h" -#include "source_pw/module_pwdft/global.h" pseudopot_cell_vl::pseudopot_cell_vl() { diff --git a/source/source_pw/module_pwdft/VNL_grad_pw.cpp b/source/source_pw/module_pwdft/VNL_grad_pw.cpp index 34009da0828..0cc37eccdb7 100644 --- a/source/source_pw/module_pwdft/VNL_grad_pw.cpp +++ b/source/source_pw/module_pwdft/VNL_grad_pw.cpp @@ -5,7 +5,7 @@ #include "source_base/math_ylmreal.h" #include "source_base/math_integral.h" #include "source_base/math_polyint.h" -#include "source_pw/module_pwdft/global.h" + void pseudopot_cell_vnl::initgradq_vnl(const UnitCell &cell) { const int nbrx = 10; @@ -183,4 +183,4 @@ void pseudopot_cell_vnl::getgradq_vnl(const UnitCell& ucell, ModuleBase::timer::tick("pp_cell_vnl","getvnl"); return; -} \ No newline at end of file +} diff --git a/source/source_pw/module_pwdft/VNL_in_pw.cpp b/source/source_pw/module_pwdft/VNL_in_pw.cpp index 438358c4aeb..3b63c28f3d6 100644 --- a/source/source_pw/module_pwdft/VNL_in_pw.cpp +++ b/source/source_pw/module_pwdft/VNL_in_pw.cpp @@ -11,9 +11,10 @@ #include "source_base/memory.h" #include "source_base/module_device/device.h" #include "source_base/timer.h" -#include "source_pw/module_pwdft/global.h" #include "source_pw/module_pwdft/kernels/vnl_op.h" +#include "source_base/parallel_comm.h" // use POOL_WORLD + pseudopot_cell_vnl::pseudopot_cell_vnl() { diff --git a/source/source_pw/module_pwdft/stress_func_ewa.cpp b/source/source_pw/module_pwdft/stress_func_ewa.cpp index 48887c07b24..20f107581c4 100644 --- a/source/source_pw/module_pwdft/stress_func_ewa.cpp +++ b/source/source_pw/module_pwdft/stress_func_ewa.cpp @@ -3,7 +3,6 @@ #include "source_base/timer.h" #include "source_base/tool_threading.h" #include "source_base/libm/libm.h" -#include "source_pw/module_pwdft/global.h" #ifdef _OPENMP #include diff --git a/source/source_pw/module_pwdft/stress_func_gga.cpp b/source/source_pw/module_pwdft/stress_func_gga.cpp index 9d9bbf5ebd5..f5eb5eaa1c9 100644 --- a/source/source_pw/module_pwdft/stress_func_gga.cpp +++ b/source/source_pw/module_pwdft/stress_func_gga.cpp @@ -1,7 +1,6 @@ #include "stress_func.h" #include "source_hamilt/module_xc/xc_functional.h" #include "source_base/timer.h" -#include "source_pw/module_pwdft/global.h" //calculate the GGA stress correction in PW and LCAO template diff --git a/source/source_pw/module_pwdft/structure_factor.cpp b/source/source_pw/module_pwdft/structure_factor.cpp index 2823d11e36d..44484f59d2b 100644 --- a/source/source_pw/module_pwdft/structure_factor.cpp +++ b/source/source_pw/module_pwdft/structure_factor.cpp @@ -3,7 +3,6 @@ #include "source_io/module_parameter/parameter.h" #include "structure_factor.h" #include "source_base/constants.h" -#include "source_pw/module_pwdft/global.h" #include "source_base/math_bspline.h" #include "source_base/memory.h" #include "source_base/timer.h" From 3495500a1e1b5aa56a5192bb1035566d1166aec6 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 10:00:06 +0800 Subject: [PATCH 14/54] update global.h --- source/source_pw/module_pwdft/hamilt_pw.cpp | 3 --- source/source_pw/module_pwdft/parallel_grid.cpp | 6 ++++-- source/source_pw/module_pwdft/stress_func_exx.cpp | 2 +- source/source_pw/module_pwdft/structure_factor_k.cpp | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/source/source_pw/module_pwdft/hamilt_pw.cpp b/source/source_pw/module_pwdft/hamilt_pw.cpp index 6af572142bb..9acb7787aef 100644 --- a/source/source_pw/module_pwdft/hamilt_pw.cpp +++ b/source/source_pw/module_pwdft/hamilt_pw.cpp @@ -3,7 +3,6 @@ #include "source_io/module_parameter/parameter.h" #include "source_base/global_function.h" #include "source_base/global_variable.h" -#include "source_pw/module_pwdft/global.h" #include "operator_pw/veff_pw.h" #include "operator_pw/ekinetic_pw.h" @@ -12,8 +11,6 @@ #include "operator_pw/onsite_proj_pw.h" #include "operator_pw/op_exx_pw.h" - - namespace hamilt { diff --git a/source/source_pw/module_pwdft/parallel_grid.cpp b/source/source_pw/module_pwdft/parallel_grid.cpp index 2f05218cd26..77aaca8b52c 100644 --- a/source/source_pw/module_pwdft/parallel_grid.cpp +++ b/source/source_pw/module_pwdft/parallel_grid.cpp @@ -1,7 +1,9 @@ #include "parallel_grid.h" - -#include "source_base/parallel_global.h" +#include "source_base/parallel_comm.h" // use POOL_WORLD #include "source_io/module_parameter/parameter.h" + +#include + Parallel_Grid::Parallel_Grid() { this->allocate = false; diff --git a/source/source_pw/module_pwdft/stress_func_exx.cpp b/source/source_pw/module_pwdft/stress_func_exx.cpp index dd2c6570a00..cf0bf2af88e 100644 --- a/source/source_pw/module_pwdft/stress_func_exx.cpp +++ b/source/source_pw/module_pwdft/stress_func_exx.cpp @@ -1,4 +1,4 @@ -#include "global.h" +#include "source_hamilt/module_xc/exx_info.h" #include "operator_pw/op_exx_pw.h" #include "source_base/parallel_common.h" #include "stress_pw.h" diff --git a/source/source_pw/module_pwdft/structure_factor_k.cpp b/source/source_pw/module_pwdft/structure_factor_k.cpp index ea071cd4094..52dc3265458 100644 --- a/source/source_pw/module_pwdft/structure_factor_k.cpp +++ b/source/source_pw/module_pwdft/structure_factor_k.cpp @@ -1,9 +1,9 @@ #include "source_base/memory.h" #include "source_base/timer.h" -#include "source_pw/module_pwdft/global.h" #include "source_pw/module_pwdft/kernels/wf_op.h" #include "source_base/module_device/device.h" #include "structure_factor.h" + std::complex* Structure_Factor::get_sk(const int ik, const int it, const int ia, @@ -179,4 +179,4 @@ template void Structure_Factor::get_sk(base_dev int, const ModulePW::PW_Basis_K*, std::complex*) const; -#endif \ No newline at end of file +#endif From bb426f7c22d71fafae081a3af86178b40f8b984c Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 10:04:39 +0800 Subject: [PATCH 15/54] update module_stodft --- source/source_pw/module_stodft/sto_iter.cpp | 1 - source/source_pw/module_stodft/sto_stress_pw.cpp | 1 - source/source_pw/module_stodft/sto_wf.cpp | 4 +--- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/source/source_pw/module_stodft/sto_iter.cpp b/source/source_pw/module_stodft/sto_iter.cpp index aa9990a4150..cd00e2f6f23 100644 --- a/source/source_pw/module_stodft/sto_iter.cpp +++ b/source/source_pw/module_stodft/sto_iter.cpp @@ -8,7 +8,6 @@ #include "source_base/tool_title.h" #include "source_estate/kernels/elecstate_op.h" #include "source_estate/occupy.h" -#include "source_pw/module_pwdft/global.h" #include "source_hsolver/para_linear_transform.h" #include "source_io/module_parameter/parameter.h" diff --git a/source/source_pw/module_stodft/sto_stress_pw.cpp b/source/source_pw/module_stodft/sto_stress_pw.cpp index d83bd9d4416..8fbe01dc89e 100644 --- a/source/source_pw/module_stodft/sto_stress_pw.cpp +++ b/source/source_pw/module_stodft/sto_stress_pw.cpp @@ -3,7 +3,6 @@ #include "source_base/timer.h" #include "source_pw/module_pwdft/fs_kin_tools.h" #include "source_pw/module_pwdft/fs_nonlocal_tools.h" -#include "source_pw/module_pwdft/global.h" #include "source_pw/module_pwdft/structure_factor.h" #include "source_io/output_log.h" #include "source_io/module_parameter/parameter.h" diff --git a/source/source_pw/module_stodft/sto_wf.cpp b/source/source_pw/module_stodft/sto_wf.cpp index e844503a11f..de9a4559e19 100644 --- a/source/source_pw/module_stodft/sto_wf.cpp +++ b/source/source_pw/module_stodft/sto_wf.cpp @@ -1,4 +1,5 @@ #include "sto_wf.h" +#include "source_base/parallel_comm.h" // use POOL_WORLD #include "source_base/memory.h" #include "source_io/module_parameter/parameter.h" @@ -6,10 +7,7 @@ #include #include -//---------Temporary------------------------------------ #include "source_base/global_function.h" -#include "source_pw/module_pwdft/global.h" -//------------------------------------------------------ template Stochastic_WF::Stochastic_WF() From c5b5c5e6dbf93f16f0c1a85d646089d9463ee813 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 10:09:45 +0800 Subject: [PATCH 16/54] delete global.h in source_io --- source/source_io/numerical_basis.cpp | 1 - source/source_io/numerical_descriptor.cpp | 1 - source/source_io/read_wf2rho_pw.cpp | 1 - source/source_io/td_current_io.cpp | 1 - source/source_io/to_wannier90.cpp | 3 +-- source/source_io/to_wannier90_lcao.cpp | 1 - source/source_io/to_wannier90_lcao.h | 1 - source/source_io/to_wannier90_pw.cpp | 2 +- source/source_io/write_HS.hpp | 1 - source/source_io/write_HS_sparse.cpp | 1 - source/source_io/write_dipole.cpp | 1 - source/source_io/write_dmr.cpp | 1 - source/source_io/write_elecstat_pot.cpp | 1 - source/source_io/write_elf.cpp | 1 - 14 files changed, 2 insertions(+), 15 deletions(-) diff --git a/source/source_io/numerical_basis.cpp b/source/source_io/numerical_basis.cpp index aab51006f9a..b8833348927 100644 --- a/source/source_io/numerical_basis.cpp +++ b/source/source_io/numerical_basis.cpp @@ -9,7 +9,6 @@ #include "source_base/timer.h" #include "source_base/vector3.h" #include "source_cell/module_symmetry/symmetry.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/numerical_basis_jyjy.h" #include diff --git a/source/source_io/numerical_descriptor.cpp b/source/source_io/numerical_descriptor.cpp index 5ccf46cb6e3..6a3004416be 100644 --- a/source/source_io/numerical_descriptor.cpp +++ b/source/source_io/numerical_descriptor.cpp @@ -1,5 +1,4 @@ #include "numerical_descriptor.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/module_parameter/parameter.h" #include "source_cell/module_symmetry/symmetry.h" #include "source_base/math_ylmreal.h" diff --git a/source/source_io/read_wf2rho_pw.cpp b/source/source_io/read_wf2rho_pw.cpp index 1be65a268ca..37d732956ca 100644 --- a/source/source_io/read_wf2rho_pw.cpp +++ b/source/source_io/read_wf2rho_pw.cpp @@ -2,7 +2,6 @@ #include "read_wfc_pw.h" #include "source_base/timer.h" -#include "source_pw/module_pwdft/global.h" #include "source_estate/module_charge/symmetry_rho.h" #include "source_io/module_parameter/parameter.h" #include "source_estate/kernels/elecstate_op.h" diff --git a/source/source_io/td_current_io.cpp b/source/source_io/td_current_io.cpp index bce3a96809a..75166e368e8 100644 --- a/source/source_io/td_current_io.cpp +++ b/source/source_io/td_current_io.cpp @@ -11,7 +11,6 @@ #include "source_estate/module_pot/H_TDDFT_pw.h" #include "source_lcao/LCAO_domain.h" #include "source_lcao/module_rt/td_info.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/module_parameter/parameter.h" #ifdef __LCAO diff --git a/source/source_io/to_wannier90.cpp b/source/source_io/to_wannier90.cpp index 47241c0789f..a3b814ed82b 100644 --- a/source/source_io/to_wannier90.cpp +++ b/source/source_io/to_wannier90.cpp @@ -5,7 +5,6 @@ #include "source_base/math_polyint.h" #include "source_base/math_sphbes.h" #include "source_base/math_ylmreal.h" -#include "source_pw/module_pwdft/global.h" toWannier90::toWannier90() { @@ -514,4 +513,4 @@ bool toWannier90::try_read_nnkp(const UnitCell& ucell, const K_Vectors& kv) } return true; -} \ No newline at end of file +} diff --git a/source/source_io/to_wannier90_lcao.cpp b/source/source_io/to_wannier90_lcao.cpp index 911a42100e5..8c1b8288d94 100644 --- a/source/source_io/to_wannier90_lcao.cpp +++ b/source/source_io/to_wannier90_lcao.cpp @@ -9,7 +9,6 @@ #include "source_base/parallel_reduce.h" #include "source_base/module_external/scalapack_connector.h" #include "source_lcao/module_hcontainer/atom_pair.h" -#include "source_pw/module_pwdft/global.h" #include #include diff --git a/source/source_io/to_wannier90_lcao.h b/source/source_io/to_wannier90_lcao.h index fa75293d9b5..e41a7755f76 100644 --- a/source/source_io/to_wannier90_lcao.h +++ b/source/source_io/to_wannier90_lcao.h @@ -22,7 +22,6 @@ #include "source_lcao/center2_orb-orb21.h" #include "source_lcao/center2_orb.h" #include "source_lcao/wavefunc_in_pw.h" -#include "source_pw/module_pwdft/global.h" #include "source_psi/psi.h" #include "single_R_io.h" #include "to_wannier90.h" diff --git a/source/source_io/to_wannier90_pw.cpp b/source/source_io/to_wannier90_pw.cpp index 9c33cf49761..555e3be32d5 100644 --- a/source/source_io/to_wannier90_pw.cpp +++ b/source/source_io/to_wannier90_pw.cpp @@ -1,7 +1,7 @@ #include "to_wannier90_pw.h" +#include "source_base/parallel_comm.h" // use POOL_WORLD #include "source_io/module_parameter/parameter.h" -#include "source_pw/module_pwdft/global.h" #include "source_base/math_integral.h" #include "source_base/math_polyint.h" #include "source_base/math_sphbes.h" diff --git a/source/source_io/write_HS.hpp b/source/source_io/write_HS.hpp index 111e8d11b3e..e7ed39728dc 100644 --- a/source/source_io/write_HS.hpp +++ b/source/source_io/write_HS.hpp @@ -4,7 +4,6 @@ #include "source_base/parallel_reduce.h" #include "source_base/timer.h" #include "source_cell/module_neighbor/sltk_grid_driver.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/filename.h" // use filename_output function diff --git a/source/source_io/write_HS_sparse.cpp b/source/source_io/write_HS_sparse.cpp index 8abd808cbad..382ece5a03b 100644 --- a/source/source_io/write_HS_sparse.cpp +++ b/source/source_io/write_HS_sparse.cpp @@ -4,7 +4,6 @@ #include "source_base/parallel_reduce.h" #include "source_base/timer.h" #include "source_lcao/module_rt/td_info.h" -#include "source_pw/module_pwdft/global.h" #include "single_R_io.h" void ModuleIO::save_HSR_sparse(const int& istep, diff --git a/source/source_io/write_dipole.cpp b/source/source_io/write_dipole.cpp index 2b9ee8124a5..29d26e518d3 100644 --- a/source/source_io/write_dipole.cpp +++ b/source/source_io/write_dipole.cpp @@ -2,7 +2,6 @@ #include "source_estate/module_charge/charge.h" #include "source_io/dipole_io.h" #include "source_lcao/module_rt/evolve_elec.h" -#include "source_pw/module_pwdft/global.h" // fuxiang add 2017-03-15 void ModuleIO::write_dipole(const UnitCell& ucell, diff --git a/source/source_io/write_dmr.cpp b/source/source_io/write_dmr.cpp index ed1288cfa7f..0cb040b1d3e 100644 --- a/source/source_io/write_dmr.cpp +++ b/source/source_io/write_dmr.cpp @@ -3,7 +3,6 @@ #include "source_io/module_parameter/parameter.h" #include "source_lcao/module_hcontainer/hcontainer_funcs.h" #include "source_lcao/module_hcontainer/output_hcontainer.h" -#include "source_pw/module_pwdft/global.h" #include diff --git a/source/source_io/write_elecstat_pot.cpp b/source/source_io/write_elecstat_pot.cpp index e70ba045255..0fff6825683 100644 --- a/source/source_io/write_elecstat_pot.cpp +++ b/source/source_io/write_elecstat_pot.cpp @@ -3,7 +3,6 @@ #include "source_io/module_parameter/parameter.h" #include "source_estate/module_pot/H_Hartree_pw.h" #include "source_estate/module_pot/efield.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/cube_io.h" #include "source_io/output_log.h" #include "write_elecstat_pot.h" diff --git a/source/source_io/write_elf.cpp b/source/source_io/write_elf.cpp index e3c72596fac..6c34a087734 100644 --- a/source/source_io/write_elf.cpp +++ b/source/source_io/write_elf.cpp @@ -1,6 +1,5 @@ #include "write_elf.h" #include "source_io/cube_io.h" -#include "source_pw/module_pwdft/global.h" namespace ModuleIO { From 8d7335d08fa16800172afe004f0c2885ac293097 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 10:16:19 +0800 Subject: [PATCH 17/54] fix source_io --- source/source_io/bessel_basis.cpp | 1 - source/source_io/cal_pdos_gamma.cpp | 4 ++-- source/source_io/cal_pdos_multik.cpp | 3 +-- source/source_io/cal_r_overlap_R.cpp | 1 - source/source_io/cal_test.cpp | 1 - source/source_io/ctrl_iter_lcao.cpp | 1 - source/source_io/ctrl_iter_lcao.h | 1 + source/source_io/unk_overlap_lcao.cpp | 3 +-- source/source_io/unk_overlap_pw.cpp | 3 +-- 9 files changed, 6 insertions(+), 12 deletions(-) diff --git a/source/source_io/bessel_basis.cpp b/source/source_io/bessel_basis.cpp index 8c98d3aca0f..5768f411e08 100644 --- a/source/source_io/bessel_basis.cpp +++ b/source/source_io/bessel_basis.cpp @@ -5,7 +5,6 @@ #include "source_base/math_sphbes.h" #include "source_base/parallel_common.h" #include "source_base/timer.h" -#include "source_pw/module_pwdft/global.h" #include Bessel_Basis::Bessel_Basis() diff --git a/source/source_io/cal_pdos_gamma.cpp b/source/source_io/cal_pdos_gamma.cpp index c51519207e6..1b8faa2eef3 100644 --- a/source/source_io/cal_pdos_gamma.cpp +++ b/source/source_io/cal_pdos_gamma.cpp @@ -1,14 +1,14 @@ #include "cal_pdos_gamma.h" - +#include "source_io/module_parameter/parameter.h" // use PARAM #include "source_base/parallel_reduce.h" #include "source_base/module_external/blas_connector.h" #include "source_base/module_external/scalapack_connector.h" #include "write_orb_info.h" #include "source_base/global_function.h" #include "source_base/global_variable.h" -#include "source_pw/module_pwdft/global.h" #include "source_lcao/hamilt_lcao.h" + void ModuleIO::cal_pdos( const psi::Psi* psi, hamilt::Hamilt* p_ham, diff --git a/source/source_io/cal_pdos_multik.cpp b/source/source_io/cal_pdos_multik.cpp index d16b517f3fa..3bdae54db59 100644 --- a/source/source_io/cal_pdos_multik.cpp +++ b/source/source_io/cal_pdos_multik.cpp @@ -1,12 +1,11 @@ #include "cal_pdos_multik.h" - +#include "source_io/module_parameter/parameter.h" // use PARAM #include "source_base/parallel_reduce.h" #include "source_base/module_external/blas_connector.h" #include "source_base/module_external/scalapack_connector.h" #include "write_orb_info.h" #include "source_base/global_function.h" #include "source_base/global_variable.h" -#include "source_pw/module_pwdft/global.h" #include "source_lcao/hamilt_lcao.h" void ModuleIO::cal_pdos( diff --git a/source/source_io/cal_r_overlap_R.cpp b/source/source_io/cal_r_overlap_R.cpp index f7512699e07..8ea658c3db9 100644 --- a/source/source_io/cal_r_overlap_R.cpp +++ b/source/source_io/cal_r_overlap_R.cpp @@ -4,7 +4,6 @@ #include "source_base/parallel_reduce.h" #include "source_base/timer.h" #include "source_cell/module_neighbor/sltk_grid_driver.h" -#include "source_pw/module_pwdft/global.h" #include "source_base/mathzone_add1.h" cal_r_overlap_R::cal_r_overlap_R() diff --git a/source/source_io/cal_test.cpp b/source/source_io/cal_test.cpp index 3009d5852db..d162bb7137b 100644 --- a/source/source_io/cal_test.cpp +++ b/source/source_io/cal_test.cpp @@ -1,4 +1,3 @@ -#include "source_pw/module_pwdft/global.h" #include "source_base/global_function.h" #define private public #include "source_io/module_parameter/parameter.h" diff --git a/source/source_io/ctrl_iter_lcao.cpp b/source/source_io/ctrl_iter_lcao.cpp index c772d162e6e..ef7b2d42d67 100644 --- a/source/source_io/ctrl_iter_lcao.cpp +++ b/source/source_io/ctrl_iter_lcao.cpp @@ -1,5 +1,4 @@ #include "source_io/ctrl_iter_lcao.h" // use ctrl_iter_lcao() -#include "source_pw/module_pwdft/global.h" // use GlobalC::restart #ifdef __MLALGO #include "source_lcao/module_deepks/LCAO_deepks.h" diff --git a/source/source_io/ctrl_iter_lcao.h b/source/source_io/ctrl_iter_lcao.h index 6297d4f1d03..04ca83c7227 100644 --- a/source/source_io/ctrl_iter_lcao.h +++ b/source/source_io/ctrl_iter_lcao.h @@ -10,6 +10,7 @@ #include "source_lcao/hamilt_lcao.h" // use hamilt::HamiltLCAO #include "source_lcao/setup_exx.h" // mohan add 20251008 #include "source_lcao/setup_deepks.h" // mohan add 20251010 +#include "source_io/restart.h" namespace ModuleIO { diff --git a/source/source_io/unk_overlap_lcao.cpp b/source/source_io/unk_overlap_lcao.cpp index c4badd40ada..eaab367041e 100644 --- a/source/source_io/unk_overlap_lcao.cpp +++ b/source/source_io/unk_overlap_lcao.cpp @@ -1,10 +1,9 @@ #include "unk_overlap_lcao.h" - +#include "source_base/parallel_comm.h" // use POOL_WORLD, etc. #include "source_io/module_parameter/parameter.h" #include "ctime" #include "source_base/module_external/scalapack_connector.h" #include "source_cell/module_neighbor/sltk_grid_driver.h" -#include "source_pw/module_pwdft/global.h" unkOverlap_lcao::unkOverlap_lcao() { diff --git a/source/source_io/unk_overlap_pw.cpp b/source/source_io/unk_overlap_pw.cpp index 0c87b1f6fb8..fab92428378 100644 --- a/source/source_io/unk_overlap_pw.cpp +++ b/source/source_io/unk_overlap_pw.cpp @@ -1,6 +1,5 @@ #include "unk_overlap_pw.h" - -#include "source_pw/module_pwdft/global.h" +#include "source_base/parallel_comm.h" // use POOL_WORLD, etc. #include "source_io/module_parameter/parameter.h" unkOverlap_pw::unkOverlap_pw() From c4e01bc52c4d23578fb1aa4680f1d9feaea6c64c Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 10:27:09 +0800 Subject: [PATCH 18/54] delete inclusion of global.h in source_io --- source/source_io/berryphase.cpp | 1 - source/source_io/cal_mlkedf_descriptors.cpp | 2 +- source/source_io/cal_mlkedf_descriptors.h | 7 +++++-- source/source_io/to_wannier90_lcao_in_pw.cpp | 1 - source/source_io/to_wannier90_lcao_in_pw.h | 1 - source/source_io/write_HS_R.h | 1 - 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/source/source_io/berryphase.cpp b/source/source_io/berryphase.cpp index c98913b35d1..08067e2c8aa 100644 --- a/source/source_io/berryphase.cpp +++ b/source/source_io/berryphase.cpp @@ -4,7 +4,6 @@ #include "source_io/module_parameter/parameter.h" #include "source_cell/klist.h" -#include "source_pw/module_pwdft/global.h" bool berryphase::berry_phase_flag = false; diff --git a/source/source_io/cal_mlkedf_descriptors.cpp b/source/source_io/cal_mlkedf_descriptors.cpp index eb16730a0e3..7e88cddfdec 100644 --- a/source/source_io/cal_mlkedf_descriptors.cpp +++ b/source/source_io/cal_mlkedf_descriptors.cpp @@ -517,4 +517,4 @@ void Cal_MLKEDF_Descriptors::getNablaRho(const double * const *prho, const Modul delete[] recipNablaRho; } -} \ No newline at end of file +} diff --git a/source/source_io/cal_mlkedf_descriptors.h b/source/source_io/cal_mlkedf_descriptors.h index d110d5bd9b9..9c28763da5a 100644 --- a/source/source_io/cal_mlkedf_descriptors.h +++ b/source/source_io/cal_mlkedf_descriptors.h @@ -3,8 +3,11 @@ #include #include "source_base/global_function.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/module_parameter/parameter.h" +#include "source_basis/module_pw/pw_basis.h" +#include "source_cell/unitcell.h" +#include "source_psi/psi.h" +#include "source_estate/elecstate_pw.h" namespace ModuleIO { @@ -106,4 +109,4 @@ class Cal_MLKEDF_Descriptors } // namespace ModuleIO -#endif \ No newline at end of file +#endif diff --git a/source/source_io/to_wannier90_lcao_in_pw.cpp b/source/source_io/to_wannier90_lcao_in_pw.cpp index 1f0019241cc..0f241a2bac5 100644 --- a/source/source_io/to_wannier90_lcao_in_pw.cpp +++ b/source/source_io/to_wannier90_lcao_in_pw.cpp @@ -1,7 +1,6 @@ #include "to_wannier90_lcao_in_pw.h" #include "source_io/module_parameter/parameter.h" -#include "source_pw/module_pwdft/global.h" #include "source_base/math_integral.h" #include "source_base/math_polyint.h" #include "source_base/math_sphbes.h" diff --git a/source/source_io/to_wannier90_lcao_in_pw.h b/source/source_io/to_wannier90_lcao_in_pw.h index cf6d5fc9151..3b75e6c736b 100644 --- a/source/source_io/to_wannier90_lcao_in_pw.h +++ b/source/source_io/to_wannier90_lcao_in_pw.h @@ -16,7 +16,6 @@ #include "source_basis/module_ao/ORB_read.h" #include "source_cell/klist.h" #include "source_cell/module_neighbor/sltk_grid_driver.h" -#include "source_pw/module_pwdft/global.h" #include "source_psi/psi.h" #include "single_R_io.h" #include "to_wannier90.h" diff --git a/source/source_io/write_HS_R.h b/source/source_io/write_HS_R.h index 87da54a2931..8732ae0224c 100644 --- a/source/source_io/write_HS_R.h +++ b/source/source_io/write_HS_R.h @@ -6,7 +6,6 @@ #include "source_cell/klist.h" #include "source_hamilt/hamilt.h" #include "source_lcao/LCAO_HS_arrays.hpp" -#include "source_pw/module_pwdft/global.h" #include "source_lcao/module_dftu/dftu.h" // mohan add 20251107 namespace ModuleIO From 3d8a6db0e8a18931c76eb719b31dca4a3ee2f732 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 10:35:36 +0800 Subject: [PATCH 19/54] Refactor: Remove unnecessary includes and clean up global.h references --- source/source_io/input_conv.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/source/source_io/input_conv.cpp b/source/source_io/input_conv.cpp index 8e3fb560ca3..ee5d86c4286 100644 --- a/source/source_io/input_conv.cpp +++ b/source/source_io/input_conv.cpp @@ -6,7 +6,6 @@ #include "source_cell/unitcell.h" #include "source_estate/occupy.h" #include "source_hamilt/module_surchem/surchem.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/berryphase.h" #include "source_io/module_parameter/parameter.h" #include "source_relax/ions_move_basic.h" From 8dd74b1f35f70a7a79362a24f5bde8069a689c73 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 10:57:56 +0800 Subject: [PATCH 20/54] delete global.h in source_lcao --- source/source_io/write_HS.h | 1 + source/source_lcao/FORCE_gamma.cpp | 1 - source/source_lcao/record_adj.cpp | 3 +-- source/source_lcao/setup_dm.cpp | 4 ---- source/source_lcao/spar_dh.h | 1 - source/source_lcao/spar_st.cpp | 3 +-- source/source_lcao/spar_u.cpp | 1 - source/source_lcao/spar_u.h | 3 +-- 8 files changed, 4 insertions(+), 13 deletions(-) diff --git a/source/source_io/write_HS.h b/source/source_io/write_HS.h index dae3f8ef11f..43cd65b6d85 100644 --- a/source/source_io/write_HS.h +++ b/source/source_io/write_HS.h @@ -7,6 +7,7 @@ //#include "source_base/global_function.h" //#include "source_base/global_variable.h" #include "source_basis/module_ao/parallel_orbitals.h" // use Parallel_Orbitals +#include "source_hamilt/hamilt.h" // mohan add this file 2010-09-10 diff --git a/source/source_lcao/FORCE_gamma.cpp b/source/source_lcao/FORCE_gamma.cpp index 4f7bcb89abf..eabfde14368 100644 --- a/source/source_lcao/FORCE_gamma.cpp +++ b/source/source_lcao/FORCE_gamma.cpp @@ -3,7 +3,6 @@ #include "source_base/parallel_reduce.h" #include "source_base/timer.h" #include "source_cell/module_neighbor/sltk_grid_driver.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/module_parameter/parameter.h" #ifdef __MLALGO #include "source_lcao/module_deepks/LCAO_deepks.h" //caoyu add for deepks on 20210813 diff --git a/source/source_lcao/record_adj.cpp b/source/source_lcao/record_adj.cpp index 47118496a51..9f0aee0e155 100644 --- a/source/source_lcao/record_adj.cpp +++ b/source/source_lcao/record_adj.cpp @@ -1,9 +1,8 @@ #include "record_adj.h" - #include "source_base/timer.h" #include "source_cell/module_neighbor/sltk_grid_driver.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/module_parameter/parameter.h" + Record_adj::Record_adj() { } diff --git a/source/source_lcao/setup_dm.cpp b/source/source_lcao/setup_dm.cpp index a91b43ab96a..edb774ea58a 100644 --- a/source/source_lcao/setup_dm.cpp +++ b/source/source_lcao/setup_dm.cpp @@ -1,15 +1,11 @@ #include "source_lcao/setup_dm.h" - #include "source_estate/cal_dm.h" #include "source_base/timer.h" #include "source_estate/module_dm/cal_dm_psi.h" #include "source_hamilt/module_xc/xc_functional.h" #include "source_lcao/module_deltaspin/spin_constrain.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/module_parameter/parameter.h" - #include "source_lcao/module_gint/gint_interface.h" - #include namespace LCAO_domain diff --git a/source/source_lcao/spar_dh.h b/source/source_lcao/spar_dh.h index 9af4fd6009c..c176096e516 100644 --- a/source/source_lcao/spar_dh.h +++ b/source/source_lcao/spar_dh.h @@ -6,7 +6,6 @@ #include "source_lcao/LCAO_HS_arrays.hpp" #include "source_lcao/force_stress_arrays.h" #include "source_lcao/hamilt_lcao.h" -#include "source_pw/module_pwdft/global.h" #include namespace sparse_format diff --git a/source/source_lcao/spar_st.cpp b/source/source_lcao/spar_st.cpp index c3352b7c8aa..b3f7b4a2f2f 100644 --- a/source/source_lcao/spar_st.cpp +++ b/source/source_lcao/spar_st.cpp @@ -3,7 +3,6 @@ #include "force_stress_arrays.h" #include "source_io/module_parameter/parameter.h" #include "source_lcao/LCAO_domain.h" -#include "source_pw/module_pwdft/global.h" // only for INPUT #include "spar_dh.h" #include "spar_hsr.h" @@ -224,4 +223,4 @@ template void sparse_format::cal_SR>( std::map, std::map>>>& SR_soc_sparse, const Grid_Driver& grid, const double& sparse_thr, - hamilt::Hamilt>* p_ham); \ No newline at end of file + hamilt::Hamilt>* p_ham); diff --git a/source/source_lcao/spar_u.cpp b/source/source_lcao/spar_u.cpp index 6a7d48709a2..fe12fe1c60c 100644 --- a/source/source_lcao/spar_u.cpp +++ b/source/source_lcao/spar_u.cpp @@ -1,7 +1,6 @@ #include "spar_u.h" #include "source_base/parallel_reduce.h" #include "source_io/module_parameter/parameter.h" -#include "source_pw/module_pwdft/global.h" #include "source_base/timer.h" void sparse_format::cal_HR_dftu( diff --git a/source/source_lcao/spar_u.h b/source/source_lcao/spar_u.h index 972033b47d2..5ac5c8a3659 100644 --- a/source/source_lcao/spar_u.h +++ b/source/source_lcao/spar_u.h @@ -3,10 +3,9 @@ #include "source_cell/module_neighbor/sltk_atom_arrange.h" #include "source_cell/module_neighbor/sltk_grid_driver.h" -#include "source_pw/module_pwdft/global.h" #include "source_lcao/hamilt_lcao.h" #include "source_lcao/module_dftu/dftu.h" // mohan add 20251107 - +#include "source_base/abfs-vector3_order.h" namespace sparse_format { From 90a314d3934a21dce3429a4029f46331c30887e6 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 10:59:02 +0800 Subject: [PATCH 21/54] update --- source/source_lcao/FORCE_STRESS.cpp | 1 - source/source_lcao/FORCE_k.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/source/source_lcao/FORCE_STRESS.cpp b/source/source_lcao/FORCE_STRESS.cpp index 4a1a0e035a0..9b129793df2 100644 --- a/source/source_lcao/FORCE_STRESS.cpp +++ b/source/source_lcao/FORCE_STRESS.cpp @@ -1,7 +1,6 @@ #include "FORCE_STRESS.h" #include "source_lcao/module_dftu/dftu.h" //Quxin add for DFT+U on 20201029 -#include "source_pw/module_pwdft/global.h" #include "source_io/output_log.h" #include "source_io/module_parameter/parameter.h" // new diff --git a/source/source_lcao/FORCE_k.cpp b/source/source_lcao/FORCE_k.cpp index 276aab33602..78d8ffc6ac5 100644 --- a/source/source_lcao/FORCE_k.cpp +++ b/source/source_lcao/FORCE_k.cpp @@ -10,7 +10,6 @@ #include "source_estate/module_dm/cal_dm_psi.h" #include "source_lcao/LCAO_domain.h" #include "source_lcao/pulay_fs.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/write_HS.h" #include "source_io/module_parameter/parameter.h" From 68716bb20e9bbf374902c4d2867b2b670a5458ce Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 11:00:21 +0800 Subject: [PATCH 22/54] update --- source/source_lcao/LCAO_allocate.cpp | 1 - source/source_lcao/LCAO_init_basis.cpp | 4 +--- source/source_lcao/hamilt_lcao.cpp | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/source/source_lcao/LCAO_allocate.cpp b/source/source_lcao/LCAO_allocate.cpp index 0143727c7e0..adbe45c3c3e 100644 --- a/source/source_lcao/LCAO_allocate.cpp +++ b/source/source_lcao/LCAO_allocate.cpp @@ -1,7 +1,6 @@ #include "source_base/timer.h" #include "source_lcao/LCAO_domain.h" #include "source_lcao/module_deepks/LCAO_deepks.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/module_parameter/parameter.h" namespace LCAO_domain diff --git a/source/source_lcao/LCAO_init_basis.cpp b/source/source_lcao/LCAO_init_basis.cpp index 6d198a3a32f..d57ff4b112b 100644 --- a/source/source_lcao/LCAO_init_basis.cpp +++ b/source/source_lcao/LCAO_init_basis.cpp @@ -2,10 +2,8 @@ #include "source_io/module_parameter/parameter.h" #include "source_base/parallel_comm.h" -/// once the GlobalC::exx_info has been deleted, this include can be gone -/// mohan note 2024-07-21 #ifdef __EXX -#include "source_pw/module_pwdft/global.h" +//#include "source_pw/module_pwdft/global.h" #endif namespace LCAO_domain diff --git a/source/source_lcao/hamilt_lcao.cpp b/source/source_lcao/hamilt_lcao.cpp index fc1ce9e92b2..d474db3eba8 100644 --- a/source/source_lcao/hamilt_lcao.cpp +++ b/source/source_lcao/hamilt_lcao.cpp @@ -4,7 +4,6 @@ #include "source_base/memory.h" #include "source_base/timer.h" #include "source_lcao/module_dftu/dftu.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/module_parameter/parameter.h" #include From a6a9c17fb541de69a551a93836bc2c867428457a Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 11:06:29 +0800 Subject: [PATCH 23/54] fix --- source/source_pw/module_pwdft/parallel_grid.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/source_pw/module_pwdft/parallel_grid.cpp b/source/source_pw/module_pwdft/parallel_grid.cpp index 77aaca8b52c..73cbba225e9 100644 --- a/source/source_pw/module_pwdft/parallel_grid.cpp +++ b/source/source_pw/module_pwdft/parallel_grid.cpp @@ -1,8 +1,10 @@ #include "parallel_grid.h" -#include "source_base/parallel_comm.h" // use POOL_WORLD #include "source_io/module_parameter/parameter.h" +#ifdef __MPI +#include "source_base/parallel_comm.h" // use POOL_WORLD #include +#endif Parallel_Grid::Parallel_Grid() { From d82c5efbdefcc702a2789c50ff80f888baa5306b Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 11:10:39 +0800 Subject: [PATCH 24/54] update --- source/source_pw/module_ofdft/kedf_ml.cpp | 3 +-- source/source_pw/module_ofdft/of_stress_pw.cpp | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/source/source_pw/module_ofdft/kedf_ml.cpp b/source/source_pw/module_ofdft/kedf_ml.cpp index 159eeb45609..bf2423fb481 100644 --- a/source/source_pw/module_ofdft/kedf_ml.cpp +++ b/source/source_pw/module_ofdft/kedf_ml.cpp @@ -5,7 +5,6 @@ #include "npy.hpp" #include "source_base/parallel_reduce.h" #include "source_base/global_function.h" -#include "source_pw/module_pwdft/global.h" void KEDF_ML::set_para( const int nx, @@ -252,4 +251,4 @@ void KEDF_ML::localTest(const double * const *pprho, ModulePW::PW_Basis *pw_rho) this->dumpMatrix("potential-abacus.npy", potential); exit(0); } -#endif \ No newline at end of file +#endif diff --git a/source/source_pw/module_ofdft/of_stress_pw.cpp b/source/source_pw/module_ofdft/of_stress_pw.cpp index 02011e4284c..04d097851c4 100644 --- a/source/source_pw/module_ofdft/of_stress_pw.cpp +++ b/source/source_pw/module_ofdft/of_stress_pw.cpp @@ -2,7 +2,6 @@ #include "source_base/timer.h" #include "source_hamilt/module_vdw/vdw.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/output_log.h" // Since the kinetic stress of OFDFT is calculated by kinetic functionals in esolver_of.cpp, here we regard it as an From 976c570565b4eb3e776b43502210a9f9d840c4cc Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 11:12:00 +0800 Subject: [PATCH 25/54] fix --- source/source_io/input_conv.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/source_io/input_conv.cpp b/source/source_io/input_conv.cpp index ee5d86c4286..9b3c972710e 100644 --- a/source/source_io/input_conv.cpp +++ b/source/source_io/input_conv.cpp @@ -13,6 +13,7 @@ #include +#include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info #ifdef __EXX #include "source_lcao/module_ri/exx_abfs-jle.h" #endif From 9babf7031656794b5b92bf743d254ef7a792b7da Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 11:17:07 +0800 Subject: [PATCH 26/54] update source_cell --- source/source_cell/bcast_cell.cpp | 1 - source/source_cell/klist.cpp | 1 - source/source_cell/read_atom_species.cpp | 1 - source/source_cell/read_atoms.cpp | 1 - source/source_cell/setup_nonlocal.cpp | 1 - 5 files changed, 5 deletions(-) diff --git a/source/source_cell/bcast_cell.cpp b/source/source_cell/bcast_cell.cpp index 2f9b88955af..3b2de0d899f 100644 --- a/source/source_cell/bcast_cell.cpp +++ b/source/source_cell/bcast_cell.cpp @@ -3,7 +3,6 @@ #include "source_io/module_parameter/parameter.h" #ifdef __EXX #include "source_lcao/module_ri/serialization_cereal.h" -#include "source_pw/module_pwdft/global.h" #endif namespace unitcell { diff --git a/source/source_cell/klist.cpp b/source/source_cell/klist.cpp index cc358802253..b9ee8c4ebae 100644 --- a/source/source_cell/klist.cpp +++ b/source/source_cell/klist.cpp @@ -7,7 +7,6 @@ #include "source_base/parallel_global.h" #include "source_base/parallel_reduce.h" #include "source_cell/module_symmetry/symmetry.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/berryphase.h" #include "source_io/module_parameter/parameter.h" diff --git a/source/source_cell/read_atom_species.cpp b/source/source_cell/read_atom_species.cpp index b8cf4c57449..a63382f505b 100644 --- a/source/source_cell/read_atom_species.cpp +++ b/source/source_cell/read_atom_species.cpp @@ -3,7 +3,6 @@ #include "source_io/module_parameter/parameter.h" #include "source_base/tool_title.h" #ifdef __EXX -#include "source_pw/module_pwdft/global.h" #include "source_lcao/module_ri/serialization_cereal.h" #endif namespace unitcell diff --git a/source/source_cell/read_atoms.cpp b/source/source_cell/read_atoms.cpp index cdce715ce74..9e680a731c5 100644 --- a/source/source_cell/read_atoms.cpp +++ b/source/source_cell/read_atoms.cpp @@ -10,7 +10,6 @@ #include "source_estate/read_orb.h" #include "source_base/timer.h" #include "source_base/constants.h" -#include "source_pw/module_pwdft/global.h" #include "source_base/formatter.h" #include "source_base/mathzone.h" diff --git a/source/source_cell/setup_nonlocal.cpp b/source/source_cell/setup_nonlocal.cpp index ba3f915315f..74911595b6b 100644 --- a/source/source_cell/setup_nonlocal.cpp +++ b/source/source_cell/setup_nonlocal.cpp @@ -4,7 +4,6 @@ #include "source_io/module_parameter/parameter.h" #ifdef __LCAO -//#include "../source_pw/module_pwdft/global.h" #include "source_pw/module_pwdft/soc.h" // mohan add 2013-08-02 // In order to get rid of the read in file .NONLOCAL. From e7e8729abe7d4f247c767d5219f6ad4b92f15b09 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 11:18:48 +0800 Subject: [PATCH 27/54] update source_esolver --- source/source_esolver/esolver_of_tddft.cpp | 1 - source/source_esolver/esolver_of_tool.cpp | 1 - source/source_esolver/lcao_others.cpp | 2 -- 3 files changed, 4 deletions(-) diff --git a/source/source_esolver/esolver_of_tddft.cpp b/source/source_esolver/esolver_of_tddft.cpp index 12a398a2f74..3f7ce036a66 100644 --- a/source/source_esolver/esolver_of_tddft.cpp +++ b/source/source_esolver/esolver_of_tddft.cpp @@ -8,7 +8,6 @@ #include "source_base/global_function.h" #include "source_estate/module_charge/symmetry_rho.h" #include "source_hamilt/module_ewald/H_Ewald_pw.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/print_info.h" #include "source_estate/cal_ux.h" //-----force------------------- diff --git a/source/source_esolver/esolver_of_tool.cpp b/source/source_esolver/esolver_of_tool.cpp index 39de034d75a..b54f4de53af 100644 --- a/source/source_esolver/esolver_of_tool.cpp +++ b/source/source_esolver/esolver_of_tool.cpp @@ -3,7 +3,6 @@ #include "source_base/memory.h" #include "source_estate/module_pot/efield.h" #include "source_estate/module_pot/gatefield.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/module_parameter/parameter.h" #include "source_estate/cal_ux.h" diff --git a/source/source_esolver/lcao_others.cpp b/source/source_esolver/lcao_others.cpp index 337b8feacda..df4805d2de1 100644 --- a/source/source_esolver/lcao_others.cpp +++ b/source/source_esolver/lcao_others.cpp @@ -3,8 +3,6 @@ #include "source_estate/module_charge/symmetry_rho.h" #include "source_lcao/hamilt_lcao.h" #include "source_lcao/module_dftu/dftu.h" -#include "source_pw/module_pwdft/global.h" -// #include "source_base/formatter.h" #include "source_base/timer.h" #include "source_cell/module_neighbor/sltk_atom_arrange.h" From 8a7412db1f74984750de9a629af9b626cfc68592 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 11:21:06 +0800 Subject: [PATCH 28/54] update esolver --- source/source_esolver/esolver_ks_lcaopw.cpp | 1 - source/source_esolver/esolver_ks_pw.h | 1 - source/source_esolver/esolver_of.cpp | 4 ++-- source/source_esolver/esolver_of_interface.cpp | 1 - 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/source/source_esolver/esolver_ks_lcaopw.cpp b/source/source_esolver/esolver_ks_lcaopw.cpp index 7a6d78e3397..97823e7c1b2 100644 --- a/source/source_esolver/esolver_ks_lcaopw.cpp +++ b/source/source_esolver/esolver_ks_lcaopw.cpp @@ -10,7 +10,6 @@ #include "source_estate/module_charge/symmetry_rho.h" #include "source_estate/occupy.h" #include "source_hamilt/module_ewald/H_Ewald_pw.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/print_info.h" //-----force------------------- #include "source_pw/module_pwdft/forces.h" diff --git a/source/source_esolver/esolver_ks_pw.h b/source/source_esolver/esolver_ks_pw.h index 27eee6c564c..b6f48e18cdf 100644 --- a/source/source_esolver/esolver_ks_pw.h +++ b/source/source_esolver/esolver_ks_pw.h @@ -3,7 +3,6 @@ #include "./esolver_ks.h" #include "source_psi/setup_psi_pw.h" // mohan add 20251012 #include "source_pw/module_pwdft/VSep_in_pw.h" -#include "source_pw/module_pwdft/global.h" #include "source_pw/module_pwdft/module_exx_helper/exx_helper.h" #include "source_pw/module_pwdft/operator_pw/velocity_pw.h" diff --git a/source/source_esolver/esolver_of.cpp b/source/source_esolver/esolver_of.cpp index b17cf6fb9df..ca8ff72ef5c 100644 --- a/source/source_esolver/esolver_of.cpp +++ b/source/source_esolver/esolver_of.cpp @@ -8,13 +8,13 @@ #include "source_base/global_function.h" #include "source_estate/module_charge/symmetry_rho.h" #include "source_hamilt/module_ewald/H_Ewald_pw.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/print_info.h" #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" +#include "source_hamilt/module_xc/xc_functional.h" + namespace ModuleESolver { diff --git a/source/source_esolver/esolver_of_interface.cpp b/source/source_esolver/esolver_of_interface.cpp index 7051308a00e..d428b795069 100644 --- a/source/source_esolver/esolver_of_interface.cpp +++ b/source/source_esolver/esolver_of_interface.cpp @@ -1,5 +1,4 @@ #include "esolver_of.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/module_parameter/parameter.h" namespace ModuleESolver From b315be2d1468133341277399cf907fdbc99c4210 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 11:22:59 +0800 Subject: [PATCH 29/54] update --- source/source_estate/elecstate_exx.cpp | 5 +++-- source/source_estate/elecstate_lcao.cpp | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/source_estate/elecstate_exx.cpp b/source/source_estate/elecstate_exx.cpp index b8854de319a..addc7a03da0 100644 --- a/source/source_estate/elecstate_exx.cpp +++ b/source/source_estate/elecstate_exx.cpp @@ -1,4 +1,5 @@ -#include "source_pw/module_pwdft/global.h" +#include "source_estate/elecstate.h" +#include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info namespace elecstate { @@ -16,4 +17,4 @@ void ElecState::set_exx(const double& Eexx) return; } -} \ No newline at end of file +} diff --git a/source/source_estate/elecstate_lcao.cpp b/source/source_estate/elecstate_lcao.cpp index 7bd32542aed..ffe81901e73 100644 --- a/source/source_estate/elecstate_lcao.cpp +++ b/source/source_estate/elecstate_lcao.cpp @@ -4,7 +4,6 @@ #include "source_estate/module_dm/cal_dm_psi.h" #include "source_hamilt/module_xc/xc_functional.h" #include "source_lcao/module_deltaspin/spin_constrain.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/module_parameter/parameter.h" #include "source_lcao/module_gint/gint_interface.h" From caeddeffc0b0612f46cfd18025dad8956fc8dc86 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 11:28:59 +0800 Subject: [PATCH 30/54] update module_charge --- source/source_estate/module_charge/charge_init.cpp | 4 +++- source/source_estate/module_charge/charge_mixing.cpp | 2 +- .../module_charge/charge_mixing_preconditioner.cpp | 1 - source/source_estate/module_charge/charge_mixing_residual.cpp | 3 +-- source/source_estate/module_charge/charge_mixing_rho.cpp | 2 +- source/source_estate/module_charge/symmetry_rhog.cpp | 3 +-- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/source/source_estate/module_charge/charge_init.cpp b/source/source_estate/module_charge/charge_init.cpp index 95f675eb90b..3e86b42fffa 100644 --- a/source/source_estate/module_charge/charge_init.cpp +++ b/source/source_estate/module_charge/charge_init.cpp @@ -12,11 +12,13 @@ #include "source_base/timer.h" #include "source_base/tool_threading.h" #include "source_estate/magnetism.h" -#include "source_pw/module_pwdft/global.h" #include "source_pw/module_pwdft/parallel_grid.h" #include "source_io/cube_io.h" #include "source_io/rhog_io.h" #include "source_io/read_wf2rho_pw.h" +#include "source_io/restart.h" +#include "source_hamilt/module_xc/xc_functional.h" +#include "source_cell/klist.h" void Charge::init_rho(const UnitCell& ucell, const Parallel_Grid& pgrid, diff --git a/source/source_estate/module_charge/charge_mixing.cpp b/source/source_estate/module_charge/charge_mixing.cpp index 67e887a3447..320edc37efe 100644 --- a/source/source_estate/module_charge/charge_mixing.cpp +++ b/source/source_estate/module_charge/charge_mixing.cpp @@ -4,7 +4,7 @@ #include "source_base/module_mixing/broyden_mixing.h" #include "source_base/module_mixing/pulay_mixing.h" #include "source_base/timer.h" -#include "source_pw/module_pwdft/global.h" +#include "source_hamilt/module_xc/xc_functional.h" Charge_Mixing::Charge_Mixing() { diff --git a/source/source_estate/module_charge/charge_mixing_preconditioner.cpp b/source/source_estate/module_charge/charge_mixing_preconditioner.cpp index 333cfb59e49..a2fecdb91cd 100644 --- a/source/source_estate/module_charge/charge_mixing_preconditioner.cpp +++ b/source/source_estate/module_charge/charge_mixing_preconditioner.cpp @@ -2,7 +2,6 @@ #include "source_io/module_parameter/parameter.h" #include "source_base/timer.h" -#include "source_pw/module_pwdft/global.h" void Charge_Mixing::Kerker_screen_recip(std::complex* drhog) { diff --git a/source/source_estate/module_charge/charge_mixing_residual.cpp b/source/source_estate/module_charge/charge_mixing_residual.cpp index bbc7c7b6bee..9120ff4b35f 100644 --- a/source/source_estate/module_charge/charge_mixing_residual.cpp +++ b/source/source_estate/module_charge/charge_mixing_residual.cpp @@ -1,9 +1,8 @@ #include "charge_mixing.h" - #include "source_io/module_parameter/parameter.h" #include "source_base/timer.h" -#include "source_pw/module_pwdft/global.h" #include "source_base/parallel_reduce.h" +#include "source_hamilt/module_xc/xc_functional.h" double Charge_Mixing::get_drho(Charge* chr, const double nelec) { diff --git a/source/source_estate/module_charge/charge_mixing_rho.cpp b/source/source_estate/module_charge/charge_mixing_rho.cpp index 38cd679f949..3eb3e91d1a4 100644 --- a/source/source_estate/module_charge/charge_mixing_rho.cpp +++ b/source/source_estate/module_charge/charge_mixing_rho.cpp @@ -1,7 +1,7 @@ #include "charge_mixing.h" #include "source_io/module_parameter/parameter.h" #include "source_base/timer.h" -#include "source_pw/module_pwdft/global.h" +#include "source_hamilt/module_xc/xc_functional.h" void Charge_Mixing::mix_rho_recip(Charge* chr) { diff --git a/source/source_estate/module_charge/symmetry_rhog.cpp b/source/source_estate/module_charge/symmetry_rhog.cpp index aae2103b75b..b16ac8476cf 100644 --- a/source/source_estate/module_charge/symmetry_rhog.cpp +++ b/source/source_estate/module_charge/symmetry_rhog.cpp @@ -1,5 +1,4 @@ #include "symmetry_rho.h" -#include "source_pw/module_pwdft/global.h" #include "source_base/parallel_global.h" #include "source_hamilt/module_xc/xc_functional.h" @@ -234,4 +233,4 @@ void Symmetry_rho::get_ixyz2ipw(const ModulePW::PW_Basis *rho_basis, delete[] nstnz_start; delete[] ipsz2ipw; return; -} \ No newline at end of file +} From 339667c226ca341e5ba155a1976aeca08f153992 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 11:29:48 +0800 Subject: [PATCH 31/54] update module_pot --- source/source_estate/module_pot/H_TDDFT_pw.cpp | 3 +-- source/source_estate/module_pot/pot_ml_exx.cpp | 1 - source/source_estate/module_pot/pot_xc.cpp | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/source/source_estate/module_pot/H_TDDFT_pw.cpp b/source/source_estate/module_pot/H_TDDFT_pw.cpp index 3f6c8a7fcd7..92a652cbb5c 100644 --- a/source/source_estate/module_pot/H_TDDFT_pw.cpp +++ b/source/source_estate/module_pot/H_TDDFT_pw.cpp @@ -6,7 +6,6 @@ #include "source_io/input_conv.h" #include "source_io/module_parameter/parameter.h" #include "source_lcao/module_rt/evolve_elec.h" -#include "source_pw/module_pwdft/global.h" namespace elecstate { @@ -489,4 +488,4 @@ void H_TDDFT_pw::compute_force(const UnitCell& cell, ModuleBase::matrix& fe) } } -} // namespace elecstate \ No newline at end of file +} // namespace elecstate diff --git a/source/source_estate/module_pot/pot_ml_exx.cpp b/source/source_estate/module_pot/pot_ml_exx.cpp index dab2acf6188..4d1237276d3 100644 --- a/source/source_estate/module_pot/pot_ml_exx.cpp +++ b/source/source_estate/module_pot/pot_ml_exx.cpp @@ -5,7 +5,6 @@ #include "npy.hpp" #include "source_base/parallel_reduce.h" #include "source_base/global_function.h" -#include "source_pw/module_pwdft/global.h" namespace elecstate { diff --git a/source/source_estate/module_pot/pot_xc.cpp b/source/source_estate/module_pot/pot_xc.cpp index 09c4719a5c4..5bfccb118d9 100644 --- a/source/source_estate/module_pot/pot_xc.cpp +++ b/source/source_estate/module_pot/pot_xc.cpp @@ -1,7 +1,6 @@ #include "pot_xc.h" #include "source_base/timer.h" -#include "source_pw/module_pwdft/global.h" #ifdef USE_LIBXC #include "source_hamilt/module_xc/xc_functional_libxc.h" From b38e69fa08f78603f87a5921e53438e6e3e17020 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 11:31:44 +0800 Subject: [PATCH 32/54] continue --- source/source_hamilt/module_ewald/H_Ewald_pw.cpp | 1 - source/source_hamilt/module_surchem/cal_pseudo.cpp | 1 - source/source_hamilt/module_xc/xc_functional.cpp | 1 - source/source_hamilt/module_xc/xc_functional_libxc.cpp | 4 ++-- 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/source/source_hamilt/module_ewald/H_Ewald_pw.cpp b/source/source_hamilt/module_ewald/H_Ewald_pw.cpp index 20e6762cc0a..0a96c2058cc 100644 --- a/source/source_hamilt/module_ewald/H_Ewald_pw.cpp +++ b/source/source_hamilt/module_ewald/H_Ewald_pw.cpp @@ -6,7 +6,6 @@ #include "source_base/parallel_reduce.h" #include "source_base/constants.h" #include "source_base/timer.h" -#include "source_pw/module_pwdft/global.h" double H_Ewald_pw::alpha=0.0; int H_Ewald_pw::mxr = 200; diff --git a/source/source_hamilt/module_surchem/cal_pseudo.cpp b/source/source_hamilt/module_surchem/cal_pseudo.cpp index 9c3a8be429f..e58024d4414 100644 --- a/source/source_hamilt/module_surchem/cal_pseudo.cpp +++ b/source/source_hamilt/module_surchem/cal_pseudo.cpp @@ -1,4 +1,3 @@ -#include "source_pw/module_pwdft/global.h" #include "surchem.h" // atom_in surchem::GetAtom; diff --git a/source/source_hamilt/module_xc/xc_functional.cpp b/source/source_hamilt/module_xc/xc_functional.cpp index 5b669d2a7d4..5cb8394b729 100644 --- a/source/source_hamilt/module_xc/xc_functional.cpp +++ b/source/source_hamilt/module_xc/xc_functional.cpp @@ -1,5 +1,4 @@ #include "xc_functional.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/module_parameter/parameter.h" #include "source_base/global_function.h" diff --git a/source/source_hamilt/module_xc/xc_functional_libxc.cpp b/source/source_hamilt/module_xc/xc_functional_libxc.cpp index 1eb15e7a270..3b1595a3a50 100644 --- a/source/source_hamilt/module_xc/xc_functional_libxc.cpp +++ b/source/source_hamilt/module_xc/xc_functional_libxc.cpp @@ -6,7 +6,7 @@ #include "source_base/formatter.h" #ifdef __EXX -#include "source_pw/module_pwdft/global.h" // just for GlobalC::exx_info +#include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info #endif #include @@ -293,4 +293,4 @@ void XC_Functional_Libxc::finish_func(std::vector &funcs) } } -#endif \ No newline at end of file +#endif From 985e01ff479a7a24100d48c811214a09a5b483a9 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 11:36:53 +0800 Subject: [PATCH 33/54] update fix --- source/source_hsolver/diago_lapack.cpp | 3 +-- source/source_hsolver/hsolver_lcaopw.cpp | 1 - source/source_io/input_conv.cpp | 4 ++++ source/source_relax/bfgs.h | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/source/source_hsolver/diago_lapack.cpp b/source/source_hsolver/diago_lapack.cpp index 4888a1159ac..7ebfe55850a 100644 --- a/source/source_hsolver/diago_lapack.cpp +++ b/source/source_hsolver/diago_lapack.cpp @@ -8,7 +8,6 @@ #include "source_base/module_external/lapack_connector.h" #include "source_base/timer.h" #include "source_base/tool_quit.h" -#include "source_pw/module_pwdft/global.h" typedef hamilt::MatrixBlock matd; typedef hamilt::MatrixBlock> matcd; @@ -410,4 +409,4 @@ void DiagoLapack::post_processing(const int info, const std::vector& vec throw std::runtime_error(str_info_FILE); } } -} // namespace hsolver \ No newline at end of file +} // namespace hsolver diff --git a/source/source_hsolver/hsolver_lcaopw.cpp b/source/source_hsolver/hsolver_lcaopw.cpp index 10c80c4481a..2167330705d 100644 --- a/source/source_hsolver/hsolver_lcaopw.cpp +++ b/source/source_hsolver/hsolver_lcaopw.cpp @@ -5,7 +5,6 @@ #include "source_base/timer.h" #include "source_base/tool_quit.h" #include "source_estate/elecstate_pw.h" -#include "source_pw/module_pwdft/global.h" #include "source_pw/module_pwdft/hamilt_pw.h" #include "source_hsolver/diago_iter_assist.h" #include "source_io/module_parameter/parameter.h" diff --git a/source/source_io/input_conv.cpp b/source/source_io/input_conv.cpp index 9b3c972710e..d174cefeae9 100644 --- a/source/source_io/input_conv.cpp +++ b/source/source_io/input_conv.cpp @@ -45,6 +45,10 @@ #include "source_lcao/module_dftu/dftu.h" // mohan add 20251107 +#include "source_io/restart.h" +#include "source_relax/bfgs_basic.h" +#include "source_relax/ions_move_cg.h" + #ifdef __LCAO std::vector Input_Conv::convert_units(std::string params, double c) { std::vector params_ori; diff --git a/source/source_relax/bfgs.h b/source/source_relax/bfgs.h index b8872c979fa..97367ae9f29 100644 --- a/source/source_relax/bfgs.h +++ b/source/source_relax/bfgs.h @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include "source_base/matrix.h" #include "source_base/matrix3.h" #include "source_cell/unitcell.h" From 79ba152fe95346ed95444aebae1357a48134141e Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 11:56:25 +0800 Subject: [PATCH 34/54] fix --- source/source_cell/bcast_cell.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/source_cell/bcast_cell.cpp b/source/source_cell/bcast_cell.cpp index 3b2de0d899f..8f2dcd3300e 100644 --- a/source/source_cell/bcast_cell.cpp +++ b/source/source_cell/bcast_cell.cpp @@ -4,6 +4,8 @@ #ifdef __EXX #include "source_lcao/module_ri/serialization_cereal.h" #endif +#include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info + namespace unitcell { void bcast_atoms_tau(Atom* atoms, From 2f13f1135b48332e6fcf775ffbc71a3cc7a9af88 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 12:04:21 +0800 Subject: [PATCH 35/54] update dftu --- source/source_lcao/module_dftu/dftu.cpp | 1 - source/source_lcao/module_dftu/dftu_folding.cpp | 1 - source/source_lcao/module_dftu/dftu_force.cpp | 1 - source/source_lcao/module_dftu/dftu_hamilt.cpp | 1 - source/source_lcao/module_dftu/dftu_io.cpp | 1 - source/source_lcao/module_dftu/dftu_occup.cpp | 1 - source/source_lcao/module_dftu/dftu_tools.cpp | 2 -- source/source_lcao/module_dftu/dftu_yukawa.cpp | 1 - 8 files changed, 9 deletions(-) diff --git a/source/source_lcao/module_dftu/dftu.cpp b/source/source_lcao/module_dftu/dftu.cpp index 8c990379fd4..92686ce4e33 100644 --- a/source/source_lcao/module_dftu/dftu.cpp +++ b/source/source_lcao/module_dftu/dftu.cpp @@ -8,7 +8,6 @@ #include "source_base/timer.h" #include "source_estate/magnetism.h" #include "source_estate/module_charge/charge.h" -#include "source_pw/module_pwdft/global.h" #include #include diff --git a/source/source_lcao/module_dftu/dftu_folding.cpp b/source/source_lcao/module_dftu/dftu_folding.cpp index bd2c8ad44a5..b67db9fcb40 100644 --- a/source/source_lcao/module_dftu/dftu_folding.cpp +++ b/source/source_lcao/module_dftu/dftu_folding.cpp @@ -2,7 +2,6 @@ #include "dftu.h" #include "source_base/timer.h" #include "source_io/module_parameter/parameter.h" -#include "source_pw/module_pwdft/global.h" #include "source_cell/module_neighbor/sltk_grid_driver.h" #include "source_lcao/hamilt_lcao.h" #include "source_lcao/module_hcontainer/hcontainer.h" diff --git a/source/source_lcao/module_dftu/dftu_force.cpp b/source/source_lcao/module_dftu/dftu_force.cpp index 02bfdff5a89..ae588ae15aa 100644 --- a/source/source_lcao/module_dftu/dftu_force.cpp +++ b/source/source_lcao/module_dftu/dftu_force.cpp @@ -11,7 +11,6 @@ #include "source_estate/elecstate_lcao.h" #include "source_estate/magnetism.h" #include "source_estate/module_charge/charge.h" -#include "source_pw/module_pwdft/global.h" #include #include diff --git a/source/source_lcao/module_dftu/dftu_hamilt.cpp b/source/source_lcao/module_dftu/dftu_hamilt.cpp index f4d1b79a32a..6da3b584a11 100644 --- a/source/source_lcao/module_dftu/dftu_hamilt.cpp +++ b/source/source_lcao/module_dftu/dftu_hamilt.cpp @@ -2,7 +2,6 @@ #include "source_base/module_external/scalapack_connector.h" #include "source_io/module_parameter/parameter.h" #include "source_base/timer.h" -#include "source_pw/module_pwdft/global.h" #ifdef __LCAO diff --git a/source/source_lcao/module_dftu/dftu_io.cpp b/source/source_lcao/module_dftu/dftu_io.cpp index f7ae8c2f628..33a3aceac18 100644 --- a/source/source_lcao/module_dftu/dftu_io.cpp +++ b/source/source_lcao/module_dftu/dftu_io.cpp @@ -1,7 +1,6 @@ #include "dftu.h" #include "source_base/timer.h" #include "source_io/module_parameter/parameter.h" -#include "source_pw/module_pwdft/global.h" void Plus_U::output(const UnitCell &ucell) diff --git a/source/source_lcao/module_dftu/dftu_occup.cpp b/source/source_lcao/module_dftu/dftu_occup.cpp index aaabbb81ac9..d6409e86e5a 100644 --- a/source/source_lcao/module_dftu/dftu_occup.cpp +++ b/source/source_lcao/module_dftu/dftu_occup.cpp @@ -1,7 +1,6 @@ #include "dftu.h" #include "source_base/timer.h" #include "source_io/module_parameter/parameter.h" -#include "source_pw/module_pwdft/global.h" #ifdef __LCAO #include "source_lcao/hamilt_lcao.h" #endif diff --git a/source/source_lcao/module_dftu/dftu_tools.cpp b/source/source_lcao/module_dftu/dftu_tools.cpp index 3ceece7ae0d..1ae144a8c28 100644 --- a/source/source_lcao/module_dftu/dftu_tools.cpp +++ b/source/source_lcao/module_dftu/dftu_tools.cpp @@ -1,8 +1,6 @@ #include "dftu.h" #include "source_base/timer.h" #include "source_io/module_parameter/parameter.h" -#include "source_pw/module_pwdft/global.h" - #ifdef __LCAO void Plus_U::cal_VU_pot_mat_complex(const int spin, const bool newlocale, std::complex* VU) diff --git a/source/source_lcao/module_dftu/dftu_yukawa.cpp b/source/source_lcao/module_dftu/dftu_yukawa.cpp index 5f77388a75b..c05e8acfee5 100644 --- a/source/source_lcao/module_dftu/dftu_yukawa.cpp +++ b/source/source_lcao/module_dftu/dftu_yukawa.cpp @@ -2,7 +2,6 @@ #include "source_io/module_parameter/parameter.h" #include "source_base/constants.h" #include "source_base/global_function.h" -#include "source_pw/module_pwdft/global.h" #include "dftu.h" #include From d0f8bbed9ee1cd1d68f01712c055badbade11166 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 12:04:40 +0800 Subject: [PATCH 36/54] update deepks --- source/source_lcao/module_deepks/LCAO_deepks.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/source/source_lcao/module_deepks/LCAO_deepks.cpp b/source/source_lcao/module_deepks/LCAO_deepks.cpp index f51f7ffa388..2cbc04680ce 100644 --- a/source/source_lcao/module_deepks/LCAO_deepks.cpp +++ b/source/source_lcao/module_deepks/LCAO_deepks.cpp @@ -14,7 +14,6 @@ #include "LCAO_deepks.h" #include "deepks_iterate.h" -#include "source_pw/module_pwdft/global.h" // Constructor of the class template From dacafacff1b21d506a962b2912170aba805b160d Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 12:05:45 +0800 Subject: [PATCH 37/54] ifx --- source/source_cell/read_atom_species.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/source_cell/read_atom_species.cpp b/source/source_cell/read_atom_species.cpp index a63382f505b..cd3bdfa124b 100644 --- a/source/source_cell/read_atom_species.cpp +++ b/source/source_cell/read_atom_species.cpp @@ -5,6 +5,8 @@ #ifdef __EXX #include "source_lcao/module_ri/serialization_cereal.h" #endif +#include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info + namespace unitcell { bool read_atom_species(std::ifstream& ifa, From 308b862d048527447700a80d217e227eebd64237 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 12:13:18 +0800 Subject: [PATCH 38/54] delete globalc.h in module_ri --- source/source_lcao/module_ri/Exx_LRI_interface.hpp | 1 + source/source_lcao/module_ri/LRI_CV.hpp | 2 +- source/source_lcao/module_ri/LRI_CV_Tools.hpp | 1 - source/source_lcao/module_ri/Matrix_Orbs11.cpp | 1 - source/source_lcao/module_ri/Matrix_Orbs11.hpp | 1 - source/source_lcao/module_ri/Matrix_Orbs21.cpp | 1 - source/source_lcao/module_ri/Matrix_Orbs21.hpp | 1 - source/source_lcao/module_ri/Matrix_Orbs22.cpp | 1 - source/source_lcao/module_ri/Matrix_Orbs22.hpp | 1 - source/source_lcao/module_ri/RI_2D_Comm.cpp | 3 +-- source/source_lcao/module_ri/RI_2D_Comm.hpp | 3 +-- source/source_lcao/module_ri/RI_Util.hpp | 3 +-- source/source_lcao/module_ri/RPA_LRI.h | 1 + source/source_lcao/module_ri/RPA_LRI.hpp | 1 + source/source_lcao/module_ri/conv_coulomb_pot_k.cpp | 1 - source/source_lcao/module_ri/exx_abfs-construct_orbs.cpp | 1 - source/source_lcao/module_ri/exx_abfs-io.cpp | 1 - source/source_lcao/module_ri/exx_lip.hpp | 4 ++-- source/source_lcao/module_ri/exx_opt_orb-print.cpp | 1 - source/source_lcao/module_ri/exx_opt_orb.cpp | 1 - 20 files changed, 9 insertions(+), 21 deletions(-) diff --git a/source/source_lcao/module_ri/Exx_LRI_interface.hpp b/source/source_lcao/module_ri/Exx_LRI_interface.hpp index 06e0845da84..f7b22fef075 100644 --- a/source/source_lcao/module_ri/Exx_LRI_interface.hpp +++ b/source/source_lcao/module_ri/Exx_LRI_interface.hpp @@ -11,6 +11,7 @@ #include "source_io/csr_reader.h" #include "source_io/write_HS_sparse.h" #include "source_estate/elecstate_lcao.h" +#include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info #include #include diff --git a/source/source_lcao/module_ri/LRI_CV.hpp b/source/source_lcao/module_ri/LRI_CV.hpp index b343d4d20dd..b07ad881d2a 100644 --- a/source/source_lcao/module_ri/LRI_CV.hpp +++ b/source/source_lcao/module_ri/LRI_CV.hpp @@ -13,7 +13,7 @@ #include "../../source_basis/module_ao/element_basis_index-ORB.h" #include "../../source_base/tool_title.h" #include "../../source_base/timer.h" -#include "../../source_pw/module_pwdft/global.h" +#include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info #include #include diff --git a/source/source_lcao/module_ri/LRI_CV_Tools.hpp b/source/source_lcao/module_ri/LRI_CV_Tools.hpp index 42567d58e0e..110db1bf806 100644 --- a/source/source_lcao/module_ri/LRI_CV_Tools.hpp +++ b/source/source_lcao/module_ri/LRI_CV_Tools.hpp @@ -13,7 +13,6 @@ #include #include -#include "../../source_pw/module_pwdft/global.h" template RI::Tensor LRI_CV_Tools::cal_I(const RI::Tensor& m, diff --git a/source/source_lcao/module_ri/Matrix_Orbs11.cpp b/source/source_lcao/module_ri/Matrix_Orbs11.cpp index 31d7a87dcec..7f3a5ad63ab 100644 --- a/source/source_lcao/module_ri/Matrix_Orbs11.cpp +++ b/source/source_lcao/module_ri/Matrix_Orbs11.cpp @@ -8,7 +8,6 @@ #include "exx_abfs-construct_orbs.h" #include "source_base/timer.h" #include "source_base/tool_title.h" -#include "source_pw/module_pwdft/global.h" void Matrix_Orbs11::init( const std::vector>>& orb_A, diff --git a/source/source_lcao/module_ri/Matrix_Orbs11.hpp b/source/source_lcao/module_ri/Matrix_Orbs11.hpp index 0d5ab1ba913..7b139203a10 100644 --- a/source/source_lcao/module_ri/Matrix_Orbs11.hpp +++ b/source/source_lcao/module_ri/Matrix_Orbs11.hpp @@ -8,7 +8,6 @@ #include "Matrix_Orbs11.h" #include "RI_Util.h" -#include "source_pw/module_pwdft/global.h" template RI::Tensor Matrix_Orbs11::cal_overlap_matrix( diff --git a/source/source_lcao/module_ri/Matrix_Orbs21.cpp b/source/source_lcao/module_ri/Matrix_Orbs21.cpp index 9317e9dbd88..1bbade7e4ca 100644 --- a/source/source_lcao/module_ri/Matrix_Orbs21.cpp +++ b/source/source_lcao/module_ri/Matrix_Orbs21.cpp @@ -8,7 +8,6 @@ #include "exx_abfs-construct_orbs.h" #include "source_base/timer.h" #include "source_base/tool_title.h" -#include "source_pw/module_pwdft/global.h" void Matrix_Orbs21::init( const std::vector>>& orb_A1, diff --git a/source/source_lcao/module_ri/Matrix_Orbs21.hpp b/source/source_lcao/module_ri/Matrix_Orbs21.hpp index 28766ad2f2e..af92d7aeddc 100644 --- a/source/source_lcao/module_ri/Matrix_Orbs21.hpp +++ b/source/source_lcao/module_ri/Matrix_Orbs21.hpp @@ -8,7 +8,6 @@ #include "Matrix_Orbs21.h" #include "RI_Util.h" -#include "source_pw/module_pwdft/global.h" template RI::Tensor Matrix_Orbs21::cal_overlap_matrix( diff --git a/source/source_lcao/module_ri/Matrix_Orbs22.cpp b/source/source_lcao/module_ri/Matrix_Orbs22.cpp index 1dca7a351b9..23b782a781e 100644 --- a/source/source_lcao/module_ri/Matrix_Orbs22.cpp +++ b/source/source_lcao/module_ri/Matrix_Orbs22.cpp @@ -8,7 +8,6 @@ #include "exx_abfs-construct_orbs.h" #include "source_base/timer.h" #include "source_base/tool_title.h" -#include "source_pw/module_pwdft/global.h" void Matrix_Orbs22::init( const std::vector>>& orb_A1, diff --git a/source/source_lcao/module_ri/Matrix_Orbs22.hpp b/source/source_lcao/module_ri/Matrix_Orbs22.hpp index 502597ba460..ed4b58d83ff 100644 --- a/source/source_lcao/module_ri/Matrix_Orbs22.hpp +++ b/source/source_lcao/module_ri/Matrix_Orbs22.hpp @@ -8,7 +8,6 @@ #include "Matrix_Orbs22.h" #include "RI_Util.h" -#include "source_pw/module_pwdft/global.h" template RI::Tensor Matrix_Orbs22::cal_overlap_matrix( diff --git a/source/source_lcao/module_ri/RI_2D_Comm.cpp b/source/source_lcao/module_ri/RI_2D_Comm.cpp index fdb3d52a8d0..90c016f51d6 100644 --- a/source/source_lcao/module_ri/RI_2D_Comm.cpp +++ b/source/source_lcao/module_ri/RI_2D_Comm.cpp @@ -1,11 +1,10 @@ //======================= // AUTHOR : Peize Lin -#include "source_io/module_parameter/parameter.h" // DATE : 2022-08-17 //======================= +#include "source_io/module_parameter/parameter.h" #include "RI_2D_Comm.h" -#include "source_pw/module_pwdft/global.h" #include "source_cell/klist.h" #include diff --git a/source/source_lcao/module_ri/RI_2D_Comm.hpp b/source/source_lcao/module_ri/RI_2D_Comm.hpp index 78eedf56c48..b9c34acd43d 100644 --- a/source/source_lcao/module_ri/RI_2D_Comm.hpp +++ b/source/source_lcao/module_ri/RI_2D_Comm.hpp @@ -8,7 +8,6 @@ #include "RI_2D_Comm.h" #include "RI_Util.h" -#include "source_pw/module_pwdft/global.h" #include "source_base/tool_title.h" #include "source_base/timer.h" #include "source_lcao/LCAO_domain.h" @@ -284,4 +283,4 @@ void RI_2D_Comm::add_HexxR( ModuleBase::timer::tick("RI_2D_Comm", "add_HexxR"); } -#endif \ No newline at end of file +#endif diff --git a/source/source_lcao/module_ri/RI_Util.hpp b/source/source_lcao/module_ri/RI_Util.hpp index 3ff9cb4cf52..c37dc7de8b1 100644 --- a/source/source_lcao/module_ri/RI_Util.hpp +++ b/source/source_lcao/module_ri/RI_Util.hpp @@ -7,7 +7,6 @@ #define RI_UTIL_HPP #include "RI_Util.h" -#include "source_pw/module_pwdft/global.h" #include "source_base/global_function.h" namespace RI_Util @@ -147,4 +146,4 @@ namespace RI_Util } } -#endif \ No newline at end of file +#endif diff --git a/source/source_lcao/module_ri/RPA_LRI.h b/source/source_lcao/module_ri/RPA_LRI.h index 75161a21a49..ae5754069f3 100644 --- a/source/source_lcao/module_ri/RPA_LRI.h +++ b/source/source_lcao/module_ri/RPA_LRI.h @@ -11,6 +11,7 @@ // #include "module_xc/exx_info.h" // #include "source_basis/module_ao/ORB_atomic_lm.h" #include "source_base/matrix.h" +#include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info // #include "source_lcao/module_ri/Exx_LRI.h" // #include #include diff --git a/source/source_lcao/module_ri/RPA_LRI.hpp b/source/source_lcao/module_ri/RPA_LRI.hpp index 8b039122ee7..2580a754248 100644 --- a/source/source_lcao/module_ri/RPA_LRI.hpp +++ b/source/source_lcao/module_ri/RPA_LRI.hpp @@ -13,6 +13,7 @@ #include "RPA_LRI.h" #include "source_io/module_parameter/parameter.h" +#include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info template void RPA_LRI::init(const MPI_Comm& mpi_comm_in, const K_Vectors& kv_in, const std::vector& orb_cutoff) diff --git a/source/source_lcao/module_ri/conv_coulomb_pot_k.cpp b/source/source_lcao/module_ri/conv_coulomb_pot_k.cpp index bb50800b13b..17198101073 100644 --- a/source/source_lcao/module_ri/conv_coulomb_pot_k.cpp +++ b/source/source_lcao/module_ri/conv_coulomb_pot_k.cpp @@ -2,7 +2,6 @@ #include "../../source_base/constants.h" #include "source_io/module_parameter/parameter.h" #include "../../source_basis/module_ao/ORB_atomic_lm.h" -#include "../../source_pw/module_pwdft/global.h" namespace Conv_Coulomb_Pot_K { diff --git a/source/source_lcao/module_ri/exx_abfs-construct_orbs.cpp b/source/source_lcao/module_ri/exx_abfs-construct_orbs.cpp index 0a0e22b21a1..fc80551ad61 100644 --- a/source/source_lcao/module_ri/exx_abfs-construct_orbs.cpp +++ b/source/source_lcao/module_ri/exx_abfs-construct_orbs.cpp @@ -5,7 +5,6 @@ #include "source_base/gram_schmidt_orth-inl.h" #include "source_base/gram_schmidt_orth.h" #include "source_basis/module_ao/ORB_read.h" -#include "source_pw/module_pwdft/global.h" //for ucell #include "source_lcao/module_ri/test_code/exx_abfs-construct_orbs-test.h" // Peize Lin test std::vector>> Exx_Abfs::Construct_Orbs::change_orbs( diff --git a/source/source_lcao/module_ri/exx_abfs-io.cpp b/source/source_lcao/module_ri/exx_abfs-io.cpp index 2d78dcb4d8b..0ed196335b1 100644 --- a/source/source_lcao/module_ri/exx_abfs-io.cpp +++ b/source/source_lcao/module_ri/exx_abfs-io.cpp @@ -4,7 +4,6 @@ #include "exx_abfs-io.h" #include "exx_abfs-jle.h" -#include "../../source_pw/module_pwdft/global.h" #include "../../source_basis/module_ao/ORB_read.h" #include "../../source_base/global_function.h" #include "../../source_base/math_integral.h" // mohan add 2021-04-03 diff --git a/source/source_lcao/module_ri/exx_lip.hpp b/source/source_lcao/module_ri/exx_lip.hpp index 1ba014a935d..d83f975342f 100644 --- a/source/source_lcao/module_ri/exx_lip.hpp +++ b/source/source_lcao/module_ri/exx_lip.hpp @@ -11,7 +11,6 @@ #include "source_base/vector3.h" #include "source_base/global_function.h" #include "source_base/vector3.h" -#include "source_pw/module_pwdft/global.h" #include "source_cell/klist.h" #include "source_lcao/wavefunc_in_pw.h" #include "source_base/module_external/lapack_connector.h" @@ -24,6 +23,7 @@ #include "source_pw/module_pwdft/structure_factor.h" #include "source_base/tool_title.h" #include "source_base/timer.h" +#include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info #include #include @@ -622,4 +622,4 @@ void Exx_Lip::read_q_pack(const ModuleSymmetry::Symmetry& symm, } */ -#endif \ No newline at end of file +#endif diff --git a/source/source_lcao/module_ri/exx_opt_orb-print.cpp b/source/source_lcao/module_ri/exx_opt_orb-print.cpp index bf19815cfce..2418fdd9962 100644 --- a/source/source_lcao/module_ri/exx_opt_orb-print.cpp +++ b/source/source_lcao/module_ri/exx_opt_orb-print.cpp @@ -1,5 +1,4 @@ #include "exx_opt_orb.h" -#include "../../source_pw/module_pwdft/global.h" #include "exx_abfs-jle.h" #include "source_base/tool_title.h" #include diff --git a/source/source_lcao/module_ri/exx_opt_orb.cpp b/source/source_lcao/module_ri/exx_opt_orb.cpp index a00af11834d..49faad5d785 100644 --- a/source/source_lcao/module_ri/exx_opt_orb.cpp +++ b/source/source_lcao/module_ri/exx_opt_orb.cpp @@ -1,5 +1,4 @@ #include "exx_opt_orb.h" -#include "source_pw/module_pwdft/global.h" #include "source_basis/module_ao/ORB_atomic_lm.h" #include "exx_abfs.h" #include "exx_abfs-construct_orbs.h" From e7d155f2920ed629437346d57ff366ec9770d059 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 12:17:24 +0800 Subject: [PATCH 39/54] fix --- source/source_io/write_HS_R.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/source_io/write_HS_R.h b/source/source_io/write_HS_R.h index 8732ae0224c..df0aa67de94 100644 --- a/source/source_io/write_HS_R.h +++ b/source/source_io/write_HS_R.h @@ -8,6 +8,10 @@ #include "source_lcao/LCAO_HS_arrays.hpp" #include "source_lcao/module_dftu/dftu.h" // mohan add 20251107 +#ifdef __EXX +#include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info +#endif + namespace ModuleIO { using TAC = std::pair>; From da991442bdfd25064782e06c8b7b3778d47c41f0 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 12:29:46 +0800 Subject: [PATCH 40/54] fix --- source/source_io/write_HS_R.h | 1 + source/source_lcao/module_ri/Exx_LRI_interface.h | 1 + source/source_lcao/module_ri/RI_Util.hpp | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/source_io/write_HS_R.h b/source/source_io/write_HS_R.h index df0aa67de94..fcd2dd11720 100644 --- a/source/source_io/write_HS_R.h +++ b/source/source_io/write_HS_R.h @@ -10,6 +10,7 @@ #ifdef __EXX #include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info +#include "RI/global/Tensor.h" // for RI::Tensor #endif namespace ModuleIO diff --git a/source/source_lcao/module_ri/Exx_LRI_interface.h b/source/source_lcao/module_ri/Exx_LRI_interface.h index 15302677b57..7a0cab7a58f 100644 --- a/source/source_lcao/module_ri/Exx_LRI_interface.h +++ b/source/source_lcao/module_ri/Exx_LRI_interface.h @@ -5,6 +5,7 @@ #include "source_lcao/module_ri/Mix_DMk_2D.h" #include "source_lcao/module_ri/module_exx_symmetry/symmetry_rotation.h" #include "source_estate/module_dm/density_matrix.h" // mohan add 2025-11-04 +#include "source_hamilt/hamilt.h" #include class LCAO_Matrix; diff --git a/source/source_lcao/module_ri/RI_Util.hpp b/source/source_lcao/module_ri/RI_Util.hpp index c37dc7de8b1..7e0fd61d6c5 100644 --- a/source/source_lcao/module_ri/RI_Util.hpp +++ b/source/source_lcao/module_ri/RI_Util.hpp @@ -6,8 +6,9 @@ #ifndef RI_UTIL_HPP #define RI_UTIL_HPP -#include "RI_Util.h" -#include "source_base/global_function.h" +#include "RI_Util.h" +#include "source_base/global_function.h" +#include "source_io/module_parameter/parameter.h" namespace RI_Util { From feb2be0b4137f5c5460e2c72133f83dd5531096d Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 12:49:07 +0800 Subject: [PATCH 41/54] fix dftu_io --- source/source_lcao/module_dftu/dftu_io.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/source_lcao/module_dftu/dftu_io.cpp b/source/source_lcao/module_dftu/dftu_io.cpp index 33a3aceac18..f75bc408c6f 100644 --- a/source/source_lcao/module_dftu/dftu_io.cpp +++ b/source/source_lcao/module_dftu/dftu_io.cpp @@ -1,6 +1,7 @@ #include "dftu.h" #include "source_base/timer.h" #include "source_io/module_parameter/parameter.h" +#include void Plus_U::output(const UnitCell &ucell) From 0889330939d92fb132d5c0906fd86fb7219b93b3 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 13:03:13 +0800 Subject: [PATCH 42/54] fix diago_lapack.cpp --- source/source_hsolver/diago_lapack.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/source_hsolver/diago_lapack.cpp b/source/source_hsolver/diago_lapack.cpp index 7ebfe55850a..62e4d34a4f1 100644 --- a/source/source_hsolver/diago_lapack.cpp +++ b/source/source_hsolver/diago_lapack.cpp @@ -7,7 +7,9 @@ #include "source_base/global_variable.h" #include "source_base/module_external/lapack_connector.h" #include "source_base/timer.h" +#include #include "source_base/tool_quit.h" +#include typedef hamilt::MatrixBlock matd; typedef hamilt::MatrixBlock> matcd; From 4b45b57c743276787b290265bfc49dd650d1f70d Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 13:08:32 +0800 Subject: [PATCH 43/54] updates --- source/source_hsolver/diago_lapack.cpp | 1 - source/source_main/driver.cpp | 3 ++- source/source_relax/relax_sync.cpp | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/source/source_hsolver/diago_lapack.cpp b/source/source_hsolver/diago_lapack.cpp index 62e4d34a4f1..996115fa697 100644 --- a/source/source_hsolver/diago_lapack.cpp +++ b/source/source_hsolver/diago_lapack.cpp @@ -9,7 +9,6 @@ #include "source_base/timer.h" #include #include "source_base/tool_quit.h" -#include typedef hamilt::MatrixBlock matd; typedef hamilt::MatrixBlock> matcd; diff --git a/source/source_main/driver.cpp b/source/source_main/driver.cpp index 13c481bca4e..d28bd5ba4f4 100644 --- a/source/source_main/driver.cpp +++ b/source/source_main/driver.cpp @@ -4,7 +4,6 @@ #include "source_base/memory.h" #include "source_base/timer.h" #include "source_esolver/esolver.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/cal_test.h" #include "source_io/input_conv.h" #include "source_io/para_json.h" @@ -12,6 +11,8 @@ #include "source_io/read_input.h" #include "source_io/module_parameter/parameter.h" #include "source_main/version.h" +#include "source_base/parallel_global.h" + Driver::Driver() { } diff --git a/source/source_relax/relax_sync.cpp b/source/source_relax/relax_sync.cpp index a788af2f684..47f3e3b3332 100644 --- a/source/source_relax/relax_sync.cpp +++ b/source/source_relax/relax_sync.cpp @@ -6,7 +6,6 @@ #include "source_base/tool_title.h" #include "source_cell/update_cell.h" #include "source_cell/print_cell.h" -#include "source_pw/module_pwdft/global.h" #include "source_io/module_parameter/parameter.h" #include "source_relax/ions_move_basic.h" From e5dca8125912e20eccc9ff2ca0f96b37dc69eec7 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 13:14:16 +0800 Subject: [PATCH 44/54] update rdmft --- source/source_lcao/module_rdmft/rdmft.cpp | 2 -- source/source_lcao/module_rdmft/rdmft.h | 4 +++- source/source_lcao/module_rdmft/rdmft_tools.cpp | 1 - source/source_lcao/module_rdmft/rdmft_tools.h | 3 ++- source/source_lcao/module_rdmft/update_state_rdmft.cpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/source_lcao/module_rdmft/rdmft.cpp b/source/source_lcao/module_rdmft/rdmft.cpp index 34549fb671c..82aeeead513 100644 --- a/source/source_lcao/module_rdmft/rdmft.cpp +++ b/source/source_lcao/module_rdmft/rdmft.cpp @@ -6,11 +6,9 @@ #include "rdmft.h" #include "source_lcao/module_rdmft/rdmft_tools.h" #include "source_base/timer.h" -#include "source_pw/module_pwdft/global.h" #include "source_base/parallel_reduce.h" #include "source_cell/module_symmetry/symmetry.h" - #include #include #include diff --git a/source/source_lcao/module_rdmft/rdmft.h b/source/source_lcao/module_rdmft/rdmft.h index 0e6b532d6e9..8e9fb71ced9 100644 --- a/source/source_lcao/module_rdmft/rdmft.h +++ b/source/source_lcao/module_rdmft/rdmft.h @@ -6,7 +6,6 @@ #define RDMFT_H #include "source_io/module_parameter/parameter.h" -#include "source_pw/module_pwdft/global.h" #include "source_psi/psi.h" #include "source_base/matrix.h" @@ -26,6 +25,9 @@ // there are some operator reload to print data in different formats #endif +#include "source_estate/elecstate.h" +#include "source_cell/module_neighbor/sltk_grid_driver.h" // use Grid_Driver + #include #include #include diff --git a/source/source_lcao/module_rdmft/rdmft_tools.cpp b/source/source_lcao/module_rdmft/rdmft_tools.cpp index ffc08c431ac..845ffea162f 100644 --- a/source/source_lcao/module_rdmft/rdmft_tools.cpp +++ b/source/source_lcao/module_rdmft/rdmft_tools.cpp @@ -3,7 +3,6 @@ // DATE : 2024-03-11 //========================================================== #include "source_lcao/module_rdmft/rdmft_tools.h" -#include "source_pw/module_pwdft/global.h" // used by class Veff_rdmft #include "source_base/tool_title.h" #include "source_base/timer.h" diff --git a/source/source_lcao/module_rdmft/rdmft_tools.h b/source/source_lcao/module_rdmft/rdmft_tools.h index 0a4e28f548c..d8a34419e7d 100644 --- a/source/source_lcao/module_rdmft/rdmft_tools.h +++ b/source/source_lcao/module_rdmft/rdmft_tools.h @@ -5,6 +5,8 @@ #ifndef RDMFT_TOOLS_H #define RDMFT_TOOLS_H +#include "source_cell/klist.h" +#include "source_io/module_parameter/parameter.h" // use PARAM #include "source_psi/psi.h" #include "source_base/matrix.h" #include "source_cell/module_neighbor/sltk_grid_driver.h" @@ -15,7 +17,6 @@ #include "source_base/parallel_2d.h" #include "source_basis/module_ao/parallel_orbitals.h" #include "source_base/parallel_reduce.h" -#include "source_pw/module_pwdft/global.h" #include "source_estate/module_dm/cal_dm_psi.h" #include "source_estate/module_dm/density_matrix.h" diff --git a/source/source_lcao/module_rdmft/update_state_rdmft.cpp b/source/source_lcao/module_rdmft/update_state_rdmft.cpp index 7a43c9be914..4f22791cf9a 100644 --- a/source/source_lcao/module_rdmft/update_state_rdmft.cpp +++ b/source/source_lcao/module_rdmft/update_state_rdmft.cpp @@ -9,7 +9,7 @@ #include "source_estate/module_dm/density_matrix.h" #include "source_estate/module_charge/symmetry_rho.h" #include "source_lcao/module_gint/gint_interface.h" - +#include "source_hamilt/module_xc/xc_functional.h" namespace rdmft { From 51a4d83da31cc42d1c7693fb52e3c73b2941c750 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 13:18:39 +0800 Subject: [PATCH 45/54] update module_rt --- source/source_lcao/module_rt/evolve_elec.cpp | 3 +-- source/source_lcao/module_rt/evolve_psi.cpp | 1 - source/source_lcao/module_rt/solve_propagation.cpp | 7 ++++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/source/source_lcao/module_rt/evolve_elec.cpp b/source/source_lcao/module_rt/evolve_elec.cpp index e43c5da4f37..b957d193ea8 100644 --- a/source/source_lcao/module_rt/evolve_elec.cpp +++ b/source/source_lcao/module_rt/evolve_elec.cpp @@ -6,7 +6,6 @@ #include "source_estate/module_charge/symmetry_rho.h" #include "source_lcao/hamilt_lcao.h" #include "source_lcao/module_dftu/dftu.h" -#include "source_pw/module_pwdft/global.h" namespace module_rt { @@ -215,4 +214,4 @@ template class Evolve_elec; #if ((defined __CUDA) /* || (defined __ROCM) */) template class Evolve_elec; #endif -} // namespace module_rt \ No newline at end of file +} // namespace module_rt diff --git a/source/source_lcao/module_rt/evolve_psi.cpp b/source/source_lcao/module_rt/evolve_psi.cpp index 94d65597e83..bd6eaef793e 100644 --- a/source/source_lcao/module_rt/evolve_psi.cpp +++ b/source/source_lcao/module_rt/evolve_psi.cpp @@ -10,7 +10,6 @@ #include "source_esolver/esolver_ks_lcao_tddft.h" // use gatherMatrix #include "source_io/module_parameter/parameter.h" #include "source_lcao/hamilt_lcao.h" -#include "source_pw/module_pwdft/global.h" #include "upsi.h" #include diff --git a/source/source_lcao/module_rt/solve_propagation.cpp b/source/source_lcao/module_rt/solve_propagation.cpp index 01a08e04255..298bf2eef94 100644 --- a/source/source_lcao/module_rt/solve_propagation.cpp +++ b/source/source_lcao/module_rt/solve_propagation.cpp @@ -1,10 +1,11 @@ #include "solve_propagation.h" +#include "source_base/module_external/scalapack_connector.h" +#include "source_base/module_external/blas_connector.h" +#include "source_base/constants.h" +#include "source_base/global_function.h" #include -#include "source_base/module_external/scalapack_connector.h" -#include "source_pw/module_pwdft/global.h" - namespace module_rt { #ifdef __MPI From d031b198818565740fdc8c85389344bf30597c88 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 13:20:51 +0800 Subject: [PATCH 46/54] update td operator --- .../source_lcao/module_lr/operator_casida/operator_lr_hxc.cpp | 3 +-- source/source_lcao/module_operator_lcao/op_dftu_lcao.cpp | 1 - source/source_lcao/module_operator_lcao/op_exx_lcao.hpp | 3 +-- source/source_lcao/module_operator_lcao/td_ekinetic_lcao.cpp | 1 - source/source_lcao/module_operator_lcao/td_nonlocal_lcao.cpp | 1 - source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp | 1 - 6 files changed, 2 insertions(+), 8 deletions(-) diff --git a/source/source_lcao/module_lr/operator_casida/operator_lr_hxc.cpp b/source/source_lcao/module_lr/operator_casida/operator_lr_hxc.cpp index 4aed4244f45..5b008589e1d 100644 --- a/source/source_lcao/module_lr/operator_casida/operator_lr_hxc.cpp +++ b/source/source_lcao/module_lr/operator_casida/operator_lr_hxc.cpp @@ -8,7 +8,6 @@ // #include "source_lcao/DM_gamma_2d_to_grid.h" #include "source_lcao/module_hcontainer/hcontainer_funcs.h" #include "source_lcao/module_lr/ao_to_mo_transformer/ao_to_mo.h" -#include "source_pw/module_pwdft/global.h" #include "source_lcao/module_gint/gint_interface.h" inline double conj(double a) { return a; } @@ -120,4 +119,4 @@ namespace LR template class OperatorLRHxc; template class OperatorLRHxc>; -} \ No newline at end of file +} diff --git a/source/source_lcao/module_operator_lcao/op_dftu_lcao.cpp b/source/source_lcao/module_operator_lcao/op_dftu_lcao.cpp index c3ed6bb51e6..ab3d482f67f 100644 --- a/source/source_lcao/module_operator_lcao/op_dftu_lcao.cpp +++ b/source/source_lcao/module_operator_lcao/op_dftu_lcao.cpp @@ -2,7 +2,6 @@ #include "source_base/timer.h" #include "source_base/tool_title.h" #include "source_lcao/module_dftu/dftu.h" -#include "source_pw/module_pwdft/global.h" namespace hamilt { diff --git a/source/source_lcao/module_operator_lcao/op_exx_lcao.hpp b/source/source_lcao/module_operator_lcao/op_exx_lcao.hpp index 80f0c422a26..cf2d3603dd4 100644 --- a/source/source_lcao/module_operator_lcao/op_exx_lcao.hpp +++ b/source/source_lcao/module_operator_lcao/op_exx_lcao.hpp @@ -5,7 +5,6 @@ #include "op_exx_lcao.h" #include "source_io/module_parameter/parameter.h" #include "source_lcao/module_ri/RI_2D_Comm.h" -#include "source_pw/module_pwdft/global.h" #include "source_hamilt/module_xc/xc_functional.h" #include "source_io/restart_exx_csr.h" @@ -394,4 +393,4 @@ void OperatorEXX>::contributeHk(int ik) } // namespace hamilt #endif // __EXX -#endif // OPEXXLCAO_HPP \ No newline at end of file +#endif // OPEXXLCAO_HPP diff --git a/source/source_lcao/module_operator_lcao/td_ekinetic_lcao.cpp b/source/source_lcao/module_operator_lcao/td_ekinetic_lcao.cpp index 6ee51ad7799..9ef6bbe126f 100644 --- a/source/source_lcao/module_operator_lcao/td_ekinetic_lcao.cpp +++ b/source/source_lcao/module_operator_lcao/td_ekinetic_lcao.cpp @@ -10,7 +10,6 @@ #include "source_lcao/center2_orb-orb11.h" #include "source_lcao/spar_hsr.h" #include "source_lcao/module_hcontainer/hcontainer_funcs.h" -#include "source_pw/module_pwdft/global.h" namespace hamilt { diff --git a/source/source_lcao/module_operator_lcao/td_nonlocal_lcao.cpp b/source/source_lcao/module_operator_lcao/td_nonlocal_lcao.cpp index 6f39ad039f9..0bbcb6fd528 100644 --- a/source/source_lcao/module_operator_lcao/td_nonlocal_lcao.cpp +++ b/source/source_lcao/module_operator_lcao/td_nonlocal_lcao.cpp @@ -12,7 +12,6 @@ #include "source_lcao/module_rt/kernels/snap_psibeta_gpu.h" #endif -#include "source_pw/module_pwdft/global.h" #ifdef _OPENMP #include #include diff --git a/source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp b/source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp index f024c6fbff8..f0d68d01334 100644 --- a/source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp +++ b/source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp @@ -5,7 +5,6 @@ #include "source_cell/module_neighbor/sltk_grid_driver.h" #include "source_lcao/module_operator_lcao/operator_lcao.h" #include "source_lcao/module_hcontainer/hcontainer_funcs.h" -#include "source_pw/module_pwdft/global.h" // Constructor template From 62c79d32133515f1bc3929301c9518cf41fe22a3 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 13:27:03 +0800 Subject: [PATCH 47/54] update module_pwdft/operator etc --- source/source_esolver/esolver_ks_pw.cpp | 2 ++ source/source_lcao/module_lr/potentials/pot_hxc_lrtd.cpp | 1 - source/source_pw/module_pwdft/hamilt_pw.cpp | 1 + .../source_pw/module_pwdft/module_exx_helper/exx_helper.cpp | 2 ++ source/source_pw/module_pwdft/module_exx_helper/exx_helper.h | 1 - source/source_pw/module_pwdft/operator_pw/exx_pw_pot.cpp | 4 ++-- source/source_pw/module_pwdft/operator_pw/meta_pw.cpp | 3 +-- source/source_pw/module_pwdft/operator_pw/op_exx_pw.cpp | 3 ++- 8 files changed, 10 insertions(+), 7 deletions(-) diff --git a/source/source_esolver/esolver_ks_pw.cpp b/source/source_esolver/esolver_ks_pw.cpp index 61ee2e10bca..b98fe6490e9 100644 --- a/source/source_esolver/esolver_ks_pw.cpp +++ b/source/source_esolver/esolver_ks_pw.cpp @@ -28,6 +28,8 @@ #include "source_estate/module_charge/chgmixing.h" // use charge mixing, mohan add 20251006 #include "source_estate/update_pot.h" // mohan add 20251016 +#include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info + namespace ModuleESolver { diff --git a/source/source_lcao/module_lr/potentials/pot_hxc_lrtd.cpp b/source/source_lcao/module_lr/potentials/pot_hxc_lrtd.cpp index 58febe316ec..d4b04ad3ff6 100644 --- a/source/source_lcao/module_lr/potentials/pot_hxc_lrtd.cpp +++ b/source/source_lcao/module_lr/potentials/pot_hxc_lrtd.cpp @@ -6,7 +6,6 @@ #include #include "source_lcao/module_lr/utils/lr_util.h" #include "source_lcao/module_lr/utils/lr_util_xc.hpp" -#include "source_pw/module_pwdft/global.h" // tmp, for pgrid #define FXC_PARA_TYPE const double* const rho, ModuleBase::matrix& v_eff, const std::vector& ispin_op = { 0,0 } namespace LR { diff --git a/source/source_pw/module_pwdft/hamilt_pw.cpp b/source/source_pw/module_pwdft/hamilt_pw.cpp index 9acb7787aef..6ba4df43188 100644 --- a/source/source_pw/module_pwdft/hamilt_pw.cpp +++ b/source/source_pw/module_pwdft/hamilt_pw.cpp @@ -10,6 +10,7 @@ #include "operator_pw/nonlocal_pw.h" #include "operator_pw/onsite_proj_pw.h" #include "operator_pw/op_exx_pw.h" +#include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info namespace hamilt { diff --git a/source/source_pw/module_pwdft/module_exx_helper/exx_helper.cpp b/source/source_pw/module_pwdft/module_exx_helper/exx_helper.cpp index db0a2aa49ab..eb70bd302a2 100644 --- a/source/source_pw/module_pwdft/module_exx_helper/exx_helper.cpp +++ b/source/source_pw/module_pwdft/module_exx_helper/exx_helper.cpp @@ -1,4 +1,6 @@ #include "exx_helper.h" +#include "source_io/module_parameter/parameter.h" // use PARAM +#include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info template double Exx_Helper::cal_exx_energy(psi::Psi *psi_) diff --git a/source/source_pw/module_pwdft/module_exx_helper/exx_helper.h b/source/source_pw/module_pwdft/module_exx_helper/exx_helper.h index 77c6c842958..010d9c7176c 100644 --- a/source/source_pw/module_pwdft/module_exx_helper/exx_helper.h +++ b/source/source_pw/module_pwdft/module_exx_helper/exx_helper.h @@ -3,7 +3,6 @@ // #include "source_psi/psi.h" #include "source_base/matrix.h" -#include "source_pw/module_pwdft/global.h" #include "source_pw/module_pwdft/operator_pw/op_exx_pw.h" #ifndef EXX_HELPER_H diff --git a/source/source_pw/module_pwdft/operator_pw/exx_pw_pot.cpp b/source/source_pw/module_pwdft/operator_pw/exx_pw_pot.cpp index 924380d9dd4..e353e5ee602 100644 --- a/source/source_pw/module_pwdft/operator_pw/exx_pw_pot.cpp +++ b/source/source_pw/module_pwdft/operator_pw/exx_pw_pot.cpp @@ -1,6 +1,6 @@ #include "op_exx_pw.h" #include "source_io/module_parameter/parameter.h" -#include "source_pw/module_pwdft/global.h" +#include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info namespace hamilt { @@ -587,4 +587,4 @@ template void get_exx_stress_potential(const K_ int, int); #endif -} // namespace hamilt \ No newline at end of file +} // namespace hamilt diff --git a/source/source_pw/module_pwdft/operator_pw/meta_pw.cpp b/source/source_pw/module_pwdft/operator_pw/meta_pw.cpp index c036a0a1f3c..70926e0830e 100644 --- a/source/source_pw/module_pwdft/operator_pw/meta_pw.cpp +++ b/source/source_pw/module_pwdft/operator_pw/meta_pw.cpp @@ -1,7 +1,6 @@ #include "meta_pw.h" #include "source_base/timer.h" -#include "source_pw/module_pwdft/global.h" #include "source_hamilt/module_xc/xc_functional.h" #include "source_base/tool_quit.h" @@ -114,4 +113,4 @@ template class Meta, base_device::DEVICE_GPU>>; // base_device::DEVICE_CPU>> *meta); template Meta, // base_device::DEVICE_GPU>>::Meta(const Meta, base_device::DEVICE_GPU>> *meta); #endif -} // namespace hamilt \ No newline at end of file +} // namespace hamilt diff --git a/source/source_pw/module_pwdft/operator_pw/op_exx_pw.cpp b/source/source_pw/module_pwdft/operator_pw/op_exx_pw.cpp index e4e6f9167d6..c5be374e1d9 100644 --- a/source/source_pw/module_pwdft/operator_pw/op_exx_pw.cpp +++ b/source/source_pw/module_pwdft/operator_pw/op_exx_pw.cpp @@ -10,11 +10,12 @@ #include "source_cell/klist.h" #include "source_hamilt/operator.h" #include "source_psi/psi.h" -#include "source_pw/module_pwdft/global.h" #include "source_pw/module_pwdft/kernels/cal_density_real_op.h" #include "source_pw/module_pwdft/kernels/exx_cal_energy_op.h" #include "source_pw/module_pwdft/kernels/mul_potential_op.h" #include "source_pw/module_pwdft/kernels/vec_mul_vec_complex_op.h" +#include "source_io/module_parameter/parameter.h" // use PARAM +#include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info #include #include From 384620e10a742037a217588d85cf058634b4adb8 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 13:29:01 +0800 Subject: [PATCH 48/54] solve fft --- source/source_base/module_fft/fft_cuda.cpp | 5 ++--- source/source_base/module_fft/fft_rocm.cpp | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/source_base/module_fft/fft_cuda.cpp b/source/source_base/module_fft/fft_cuda.cpp index bd5669f8228..e33fd203118 100644 --- a/source/source_base/module_fft/fft_cuda.cpp +++ b/source/source_base/module_fft/fft_cuda.cpp @@ -1,7 +1,6 @@ #include "fft_cuda.h" - #include "source_base/module_device/memory_op.h" -#include "source_pw/module_pwdft/global.h" +#include "source_base/module_device/device_check.h" namespace ModuleBase { @@ -111,4 +110,4 @@ template FFT_CUDA::FFT_CUDA(); template FFT_CUDA::~FFT_CUDA(); template FFT_CUDA::FFT_CUDA(); template FFT_CUDA::~FFT_CUDA(); -} // namespace ModuleBase \ No newline at end of file +} // namespace ModuleBase diff --git a/source/source_base/module_fft/fft_rocm.cpp b/source/source_base/module_fft/fft_rocm.cpp index 89413e2d645..1730a0cdda5 100644 --- a/source/source_base/module_fft/fft_rocm.cpp +++ b/source/source_base/module_fft/fft_rocm.cpp @@ -1,6 +1,7 @@ #include "fft_rocm.h" #include "source_base/module_device/memory_op.h" -#include "source_pw/module_pwdft/global.h" +#include "source_base/module_device/device_check.h" + namespace ModuleBase { template @@ -107,4 +108,4 @@ template FFT_ROCM::FFT_ROCM(); template FFT_ROCM::~FFT_ROCM(); template FFT_ROCM::FFT_ROCM(); template FFT_ROCM::~FFT_ROCM(); -}// namespace ModuleBase \ No newline at end of file +}// namespace ModuleBase From 390eced3a217abbde140409698360320c981b349 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 13:30:14 +0800 Subject: [PATCH 49/54] update xc --- .../module_xc/xc_functional_libxc_wrapper_tauxc.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/source_hamilt/module_xc/xc_functional_libxc_wrapper_tauxc.cpp b/source/source_hamilt/module_xc/xc_functional_libxc_wrapper_tauxc.cpp index 8891fc98f6d..1c5c9ebb625 100644 --- a/source/source_hamilt/module_xc/xc_functional_libxc_wrapper_tauxc.cpp +++ b/source/source_hamilt/module_xc/xc_functional_libxc_wrapper_tauxc.cpp @@ -5,7 +5,6 @@ #ifdef USE_LIBXC #include "xc_functional_libxc.h" -#include "source_pw/module_pwdft/global.h" #include //tau_xc and tau_xc_spin: interface for calling xc_mgga_exc_vxc from LIBXC @@ -102,4 +101,4 @@ void XC_Functional_Libxc::tau_xc_spin( XC_Functional_Libxc::finish_func(funcs); } -#endif \ No newline at end of file +#endif From 30c921595f32cf5ddbc6164c325aa6d107c2bcbb Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 13:32:34 +0800 Subject: [PATCH 50/54] update --- source/source_hamilt/module_xc/xc_functional_wrapper_gcxc.cpp | 1 - source/source_lcao/LCAO_init_basis.cpp | 3 --- .../module_ri/module_exx_symmetry/symmetry_rotation.cpp | 4 +--- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/source/source_hamilt/module_xc/xc_functional_wrapper_gcxc.cpp b/source/source_hamilt/module_xc/xc_functional_wrapper_gcxc.cpp index 7b46ce96a1e..ea6a5a3e1e3 100644 --- a/source/source_hamilt/module_xc/xc_functional_wrapper_gcxc.cpp +++ b/source/source_hamilt/module_xc/xc_functional_wrapper_gcxc.cpp @@ -8,7 +8,6 @@ #include "xc_functional.h" #include -#include "source_pw/module_pwdft/global.h" #include "source_base/global_function.h" #ifdef USE_LIBXC diff --git a/source/source_lcao/LCAO_init_basis.cpp b/source/source_lcao/LCAO_init_basis.cpp index d57ff4b112b..c18e859599a 100644 --- a/source/source_lcao/LCAO_init_basis.cpp +++ b/source/source_lcao/LCAO_init_basis.cpp @@ -2,9 +2,6 @@ #include "source_io/module_parameter/parameter.h" #include "source_base/parallel_comm.h" -#ifdef __EXX -//#include "source_pw/module_pwdft/global.h" -#endif namespace LCAO_domain { diff --git a/source/source_lcao/module_ri/module_exx_symmetry/symmetry_rotation.cpp b/source/source_lcao/module_ri/module_exx_symmetry/symmetry_rotation.cpp index 53922f42ac7..e0b4d91b8bd 100644 --- a/source/source_lcao/module_ri/module_exx_symmetry/symmetry_rotation.cpp +++ b/source/source_lcao/module_ri/module_exx_symmetry/symmetry_rotation.cpp @@ -8,8 +8,6 @@ #include "source_base/timer.h" #include "source_base/mathzone.h" -#include "source_pw/module_pwdft/global.h" - namespace ModuleSymmetry { void Symmetry_rotation::set_Cs_rotation(const std::vector>& abfs_l_nchi) @@ -479,4 +477,4 @@ namespace ModuleSymmetry return RI_Util::get_Born_von_Karmen_cells(period); } -} \ No newline at end of file +} From a1ee0fcc8f7fd5b611d2f10da0c9723c4ab0ce7b Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 13:37:22 +0800 Subject: [PATCH 51/54] delete global.h and global.cpp, finally after nearly 20 years --- source/Makefile.Objects | 1 - source/source_pw/module_pwdft/CMakeLists.txt | 1 - source/source_pw/module_pwdft/global.cpp | 0 source/source_pw/module_pwdft/global.h | 22 -------------------- 4 files changed, 24 deletions(-) delete mode 100644 source/source_pw/module_pwdft/global.cpp delete mode 100644 source/source_pw/module_pwdft/global.h diff --git a/source/Makefile.Objects b/source/Makefile.Objects index 6d310cf9753..d7e5116df8a 100644 --- a/source/Makefile.Objects +++ b/source/Makefile.Objects @@ -715,7 +715,6 @@ OBJS_SRCPW=H_Ewald_pw.o\ onsite_op.o\ wf_op.o\ vnl_op.o\ - global.o\ magnetism.o\ occupy.o\ structure_factor.o\ diff --git a/source/source_pw/module_pwdft/CMakeLists.txt b/source/source_pw/module_pwdft/CMakeLists.txt index f958fdc75eb..66354adb9a3 100644 --- a/source/source_pw/module_pwdft/CMakeLists.txt +++ b/source/source_pw/module_pwdft/CMakeLists.txt @@ -39,7 +39,6 @@ list(APPEND objects structure_factor.cpp structure_factor_k.cpp soc.cpp - global.cpp parallel_grid.cpp elecond.cpp fs_nonlocal_tools.cpp diff --git a/source/source_pw/module_pwdft/global.cpp b/source/source_pw/module_pwdft/global.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/source/source_pw/module_pwdft/global.h b/source/source_pw/module_pwdft/global.h deleted file mode 100644 index 53258d870b8..00000000000 --- a/source/source_pw/module_pwdft/global.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef GLOBAL_H -#define GLOBAL_H - -#include "source_base/global_function.h" -#include "source_base/global_variable.h" -#include "source_io/restart.h" - -#include "source_relax/ions_move_methods.h" -#include "source_relax/lattice_change_methods.h" -#include "source_cell/unitcell.h" -#include "source_relax/bfgs.h" -#include "source_io/module_parameter/input_parameter.h" - -#ifdef __EXX -#include "source_hamilt/module_xc/exx_info.h" -#include "source_lcao/module_ri/exx_lip.h" -#endif - -#include "source_hamilt/module_xc/xc_functional.h" -#include "source_base/module_device/device_check.h" - -#endif From 5e2945c7f2329ec492d096baa06b7b4c740ad77c Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 13:42:45 +0800 Subject: [PATCH 52/54] fix op_exx_lcao --- source/source_lcao/module_operator_lcao/op_exx_lcao.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/source_lcao/module_operator_lcao/op_exx_lcao.hpp b/source/source_lcao/module_operator_lcao/op_exx_lcao.hpp index cf2d3603dd4..31e219fbd71 100644 --- a/source/source_lcao/module_operator_lcao/op_exx_lcao.hpp +++ b/source/source_lcao/module_operator_lcao/op_exx_lcao.hpp @@ -7,6 +7,7 @@ #include "source_lcao/module_ri/RI_2D_Comm.h" #include "source_hamilt/module_xc/xc_functional.h" #include "source_io/restart_exx_csr.h" +#include "source_io/restart.h" namespace hamilt { From 0f8610e1b768d641c1badf02cd7fabf9ad131c2b Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 13:44:12 +0800 Subject: [PATCH 53/54] fix --- source/source_lcao/module_ri/Exx_LRI_interface.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/source_lcao/module_ri/Exx_LRI_interface.hpp b/source/source_lcao/module_ri/Exx_LRI_interface.hpp index f7b22fef075..131ae98ab35 100644 --- a/source/source_lcao/module_ri/Exx_LRI_interface.hpp +++ b/source/source_lcao/module_ri/Exx_LRI_interface.hpp @@ -12,6 +12,7 @@ #include "source_io/write_HS_sparse.h" #include "source_estate/elecstate_lcao.h" #include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info +#include "source_io/restart.h" #include #include From c73cf3ef166f8b09931f00f7f1e810a116ade1cb Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 25 Jan 2026 13:52:09 +0800 Subject: [PATCH 54/54] fix --- .../module_xc/xc_functional_libxc_wrapper_tauxc.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/source_hamilt/module_xc/xc_functional_libxc_wrapper_tauxc.cpp b/source/source_hamilt/module_xc/xc_functional_libxc_wrapper_tauxc.cpp index 1c5c9ebb625..a7499ef0906 100644 --- a/source/source_hamilt/module_xc/xc_functional_libxc_wrapper_tauxc.cpp +++ b/source/source_hamilt/module_xc/xc_functional_libxc_wrapper_tauxc.cpp @@ -4,6 +4,8 @@ #ifdef USE_LIBXC +#include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info +#include "source_hamilt/module_xc/xc_functional.h" #include "xc_functional_libxc.h" #include