From b69c08538fa2cf11bb42b3d0e9a3c2b35fcae5af Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Fri, 23 Jan 2026 20:25:54 +0800 Subject: [PATCH 01/32] 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 0000000000..6da3f391e3 --- /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 b2bb8f065e..94faa31e74 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 166e7b3fb9..8c0c651172 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 4debfde4d5..b17cf6fb9d 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 daeda628cb..12a398a2f7 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 ea411bcb1b..fa19083dcd 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 b60eeb69db..dd45e6bbc6 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/32] 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 2d89673313..4809c6df77 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 6716ea0c96..dd621cfe15 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 3a2fb57496..47b6648954 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 990aa56751..895b06bf57 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 a11361e8363c826b9ceb546002ff7b0a08079078 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 1 Feb 2026 21:37:30 +0800 Subject: [PATCH 03/32] add module_energy directory --- source/source_esolver/esolver_ks.cpp | 4 ++-- source/source_io/CMakeLists.txt | 6 +++--- source/source_io/module_ctrl/ctrl_runner_lcao.cpp | 4 ++-- source/source_io/{ => module_energy}/write_bands.cpp | 0 source/source_io/{ => module_energy}/write_bands.h | 0 source/source_io/{ => module_energy}/write_eband_terms.hpp | 0 source/source_io/{ => module_energy}/write_eig_occ.cpp | 0 source/source_io/{ => module_energy}/write_eig_occ.h | 0 .../source_io/{ => module_energy}/write_proj_band_lcao.cpp | 2 +- source/source_io/{ => module_energy}/write_proj_band_lcao.h | 0 source/source_io/test/CMakeLists.txt | 2 +- source/source_io/test/write_eig_occ_test.cpp | 2 +- source/source_io/test_serial/CMakeLists.txt | 2 +- source/source_io/test_serial/write_bands_test.cpp | 2 +- 14 files changed, 12 insertions(+), 12 deletions(-) rename source/source_io/{ => module_energy}/write_bands.cpp (100%) rename source/source_io/{ => module_energy}/write_bands.h (100%) rename source/source_io/{ => module_energy}/write_eband_terms.hpp (100%) rename source/source_io/{ => module_energy}/write_eig_occ.cpp (100%) rename source/source_io/{ => module_energy}/write_eig_occ.h (100%) rename source/source_io/{ => module_energy}/write_proj_band_lcao.cpp (99%) rename source/source_io/{ => module_energy}/write_proj_band_lcao.h (100%) diff --git a/source/source_esolver/esolver_ks.cpp b/source/source_esolver/esolver_ks.cpp index bf36989233..0312f308ac 100644 --- a/source/source_esolver/esolver_ks.cpp +++ b/source/source_esolver/esolver_ks.cpp @@ -9,8 +9,8 @@ #include "source_estate/module_charge/chgmixing.h" // mohan add 20251018 #include "source_pw/module_pwdft/setup_pwwfc.h" // mohan add 20251018 #include "source_hsolver/hsolver.h" -#include "source_io/write_eig_occ.h" -#include "source_io/write_bands.h" +#include "source_io/module_energy/write_eig_occ.h" +#include "source_io/module_energy/write_bands.h" #include "source_hamilt/module_xc/xc_functional.h" #include "source_io/module_output/output_log.h" // use write_head #include "source_estate/elecstate_print.h" // print_etot diff --git a/source/source_io/CMakeLists.txt b/source/source_io/CMakeLists.txt index 813b0247eb..430015d4a9 100644 --- a/source/source_io/CMakeLists.txt +++ b/source/source_io/CMakeLists.txt @@ -10,9 +10,9 @@ list(APPEND objects module_ml/cal_mlkedf_descriptors.cpp cif_io.cpp module_dos/write_dos_pw.cpp - write_bands.cpp + module_energy/write_bands.cpp nscf_fermi_surf.cpp - write_eig_occ.cpp + module_energy/write_eig_occ.cpp module_bessel/numerical_basis.cpp module_bessel/numerical_basis_jyjy.cpp module_bessel/numerical_descriptor.cpp @@ -59,7 +59,7 @@ if(ENABLE_LCAO) module_dos/cal_pdos_gamma.cpp module_dos/cal_pdos_multik.cpp write_orb_info.cpp - write_proj_band_lcao.cpp + module_energy/write_proj_band_lcao.cpp module_chgpot/get_pchg_lcao.cpp module_wf/get_wf_lcao.cpp module_wf/read_wfc_nao.cpp diff --git a/source/source_io/module_ctrl/ctrl_runner_lcao.cpp b/source/source_io/module_ctrl/ctrl_runner_lcao.cpp index 0e59b8586b..902337f35e 100644 --- a/source/source_io/module_ctrl/ctrl_runner_lcao.cpp +++ b/source/source_io/module_ctrl/ctrl_runner_lcao.cpp @@ -3,9 +3,9 @@ #include "source_estate/elecstate_lcao.h" // use elecstate::ElecState #include "source_lcao/hamilt_lcao.h" // use hamilt::HamiltLCAO -#include "../write_proj_band_lcao.h" // projcted band structure +#include "../module_energy/write_proj_band_lcao.h" // projcted band structure #include "../module_dos/cal_ldos.h" // cal LDOS -#include "../write_eband_terms.hpp" +#include "../module_energy/write_eband_terms.hpp" #include "../module_hs/write_vxc.hpp" #include "../module_hs/write_vxc_r.hpp" diff --git a/source/source_io/write_bands.cpp b/source/source_io/module_energy/write_bands.cpp similarity index 100% rename from source/source_io/write_bands.cpp rename to source/source_io/module_energy/write_bands.cpp diff --git a/source/source_io/write_bands.h b/source/source_io/module_energy/write_bands.h similarity index 100% rename from source/source_io/write_bands.h rename to source/source_io/module_energy/write_bands.h diff --git a/source/source_io/write_eband_terms.hpp b/source/source_io/module_energy/write_eband_terms.hpp similarity index 100% rename from source/source_io/write_eband_terms.hpp rename to source/source_io/module_energy/write_eband_terms.hpp diff --git a/source/source_io/write_eig_occ.cpp b/source/source_io/module_energy/write_eig_occ.cpp similarity index 100% rename from source/source_io/write_eig_occ.cpp rename to source/source_io/module_energy/write_eig_occ.cpp diff --git a/source/source_io/write_eig_occ.h b/source/source_io/module_energy/write_eig_occ.h similarity index 100% rename from source/source_io/write_eig_occ.h rename to source/source_io/module_energy/write_eig_occ.h diff --git a/source/source_io/write_proj_band_lcao.cpp b/source/source_io/module_energy/write_proj_band_lcao.cpp similarity index 99% rename from source/source_io/write_proj_band_lcao.cpp rename to source/source_io/module_energy/write_proj_band_lcao.cpp index a01937c5d2..fd63cf05c6 100644 --- a/source/source_io/write_proj_band_lcao.cpp +++ b/source/source_io/module_energy/write_proj_band_lcao.cpp @@ -6,7 +6,7 @@ #include "source_base/module_external/scalapack_connector.h" #include "source_base/timer.h" #include "source_cell/module_neighbor/sltk_atom_arrange.h" -#include "write_orb_info.h" +#include "../write_orb_info.h" #include "source_lcao/hamilt_lcao.h" template<> diff --git a/source/source_io/write_proj_band_lcao.h b/source/source_io/module_energy/write_proj_band_lcao.h similarity index 100% rename from source/source_io/write_proj_band_lcao.h rename to source/source_io/module_energy/write_proj_band_lcao.h diff --git a/source/source_io/test/CMakeLists.txt b/source/source_io/test/CMakeLists.txt index 7361521781..006c775af9 100644 --- a/source/source_io/test/CMakeLists.txt +++ b/source/source_io/test/CMakeLists.txt @@ -42,7 +42,7 @@ AddTest( AddTest( TARGET MODULE_IO_write_eig_occ_test LIBS parameter ${math_libs} base device symmetry - SOURCES write_eig_occ_test.cpp ../write_eig_occ.cpp ../module_output/output.cpp ../../source_cell/parallel_kpoints.cpp ../../source_cell/klist.cpp ../../source_cell/k_vector_utils.cpp + SOURCES write_eig_occ_test.cpp ../module_energy/write_eig_occ.cpp ../module_output/output.cpp ../../source_cell/parallel_kpoints.cpp ../../source_cell/klist.cpp ../../source_cell/k_vector_utils.cpp ../cif_io.cpp ) diff --git a/source/source_io/test/write_eig_occ_test.cpp b/source/source_io/test/write_eig_occ_test.cpp index 3797efe8a5..b7139ba093 100644 --- a/source/source_io/test/write_eig_occ_test.cpp +++ b/source/source_io/test/write_eig_occ_test.cpp @@ -11,7 +11,7 @@ #include "source_cell/parallel_kpoints.h" #include "mpi.h" #endif -#include "../write_eig_occ.h" +#include "../module_energy/write_eig_occ.h" #include "for_testing_klist.h" /************************************************ diff --git a/source/source_io/test_serial/CMakeLists.txt b/source/source_io/test_serial/CMakeLists.txt index 0e82c0764e..24c614067a 100644 --- a/source/source_io/test_serial/CMakeLists.txt +++ b/source/source_io/test_serial/CMakeLists.txt @@ -53,7 +53,7 @@ AddTest( AddTest( TARGET MODULE_IO_write_bands LIBS parameter ${math_libs} base device - SOURCES write_bands_test.cpp ../write_bands.cpp + SOURCES write_bands_test.cpp ../module_energy/write_bands.cpp ) AddTest( diff --git a/source/source_io/test_serial/write_bands_test.cpp b/source/source_io/test_serial/write_bands_test.cpp index e7e82684da..f03e27719e 100644 --- a/source/source_io/test_serial/write_bands_test.cpp +++ b/source/source_io/test_serial/write_bands_test.cpp @@ -1,6 +1,6 @@ #include "gtest/gtest.h" #include "gmock/gmock.h" -#include "source_io/write_bands.h" +#include "source_io/module_energy/write_bands.h" #include "source_cell/parallel_kpoints.h" #include "source_cell/klist.h" From 16a65d24d05a327998f3290b139fc7c6add7a62c Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Tue, 3 Feb 2026 09:03:36 +0800 Subject: [PATCH 04/32] updates --- source/source_esolver/esolver_dm2rho.cpp | 4 +- source/source_esolver/esolver_dp.cpp | 2 +- source/source_esolver/esolver_fp.cpp | 4 +- source/source_esolver/esolver_gets.cpp | 2 +- .../source_esolver/esolver_ks_lcao_tddft.cpp | 2 +- source/source_esolver/esolver_lj.cpp | 2 +- source/source_esolver/esolver_nep.cpp | 2 +- source/source_esolver/esolver_of.cpp | 2 +- source/source_esolver/esolver_of_tddft.cpp | 2 +- source/source_esolver/lcao_others.cpp | 2 +- source/source_esolver/pw_others.cpp | 2 +- .../module_charge/charge_extra.cpp | 2 +- .../module_charge/charge_init.cpp | 2 +- source/source_io/CMakeLists.txt | 38 +++++++++---------- .../source_io/module_chgpot/get_pchg_lcao.cpp | 2 +- source/source_io/module_chgpot/get_pchg_pw.h | 2 +- source/source_io/module_chgpot/rhog_io.cpp | 2 +- .../module_chgpot/write_elecstat_pot.cpp | 2 +- source/source_io/module_chgpot/write_init.cpp | 2 +- .../{ => module_chgpot}/write_libxc_r.cpp | 0 .../{ => module_chgpot}/write_libxc_r.h | 8 ++-- .../source_io/module_ctrl/ctrl_output_fp.cpp | 2 +- .../source_io/module_ctrl/ctrl_output_td.cpp | 2 +- .../source_io/module_ctrl/ctrl_scf_lcao.cpp | 4 +- .../source_io/{ => module_dipole}/dipole_io.h | 0 .../{ => module_dipole}/write_dipole.cpp | 2 +- source/source_io/module_dos/cal_ldos.cpp | 2 +- .../source_io/module_dos/cal_pdos_gamma.cpp | 2 +- .../source_io/module_dos/cal_pdos_multik.cpp | 2 +- .../source_io/module_dos/write_dos_lcao.cpp | 2 +- source/source_io/module_dos/write_dos_pw.cpp | 2 +- source/source_io/module_elf/write_elf.cpp | 2 +- .../{ => module_energy}/nscf_fermi_surf.cpp | 0 .../{ => module_energy}/nscf_fermi_surf.h | 0 .../module_energy/write_proj_band_lcao.cpp | 2 +- source/source_io/{ => module_hs}/cal_pLpR.cpp | 2 +- source/source_io/{ => module_hs}/cal_pLpR.h | 0 .../{ => module_hs}/cal_r_overlap_R.cpp | 0 .../{ => module_hs}/cal_r_overlap_R.h | 0 .../{ => module_hs}/output_mat_sparse.cpp | 2 +- .../{ => module_hs}/output_mat_sparse.h | 0 .../source_io/{ => module_hs}/single_R_io.cpp | 0 .../source_io/{ => module_hs}/single_R_io.h | 0 .../source_io/module_hs/write_HS_sparse.cpp | 2 +- .../{ => module_output}/binstream.cpp | 0 .../source_io/{ => module_output}/binstream.h | 0 .../{ => module_output}/cal_test.cpp | 0 .../source_io/{ => module_output}/cal_test.h | 0 .../source_io/{ => module_output}/cif_io.cpp | 2 +- source/source_io/{ => module_output}/cif_io.h | 0 .../{ => module_output}/csr_reader.cpp | 0 .../{ => module_output}/csr_reader.h | 0 .../source_io/{ => module_output}/cube_io.h | 0 .../{ => module_output}/file_reader.cpp | 0 .../{ => module_output}/file_reader.h | 0 .../source_io/{ => module_output}/orb_io.cpp | 2 +- source/source_io/{ => module_output}/orb_io.h | 0 .../{ => module_output}/read_cube.cpp | 2 +- .../{ => module_output}/read_exit_file.cpp | 0 .../{ => module_output}/read_exit_file.h | 0 .../{ => module_output}/sparse_matrix.cpp | 0 .../{ => module_output}/sparse_matrix.h | 0 .../{ => module_output}/write_cube.cpp | 2 +- .../{ => module_output}/write_orb_info.cpp | 0 .../{ => module_output}/write_orb_info.h | 0 .../{ => module_wannier}/fR_overlap.cpp | 0 .../{ => module_wannier}/fR_overlap.h | 0 .../module_wannier/to_wannier90_lcao.cpp | 2 +- .../module_wannier/to_wannier90_lcao.h | 4 +- .../to_wannier90_lcao_in_pw.cpp | 2 +- .../module_wannier/to_wannier90_lcao_in_pw.h | 2 +- .../module_wannier/to_wannier90_pw.cpp | 2 +- source/source_io/module_wf/get_wf_lcao.cpp | 2 +- source/source_io/module_wf/read_wfc_pw.cpp | 2 +- source/source_io/module_wf/write_wfc_nao.cpp | 2 +- source/source_io/module_wf/write_wfc_pw.cpp | 2 +- .../module_hcontainer/output_hcontainer.cpp | 2 +- .../module_hcontainer/read_hcontainer.cpp | 4 +- .../module_lr/esolver_lrtd_lcao.cpp | 2 +- .../module_lr/potentials/xc_kernel.cpp | 2 +- .../module_operator_lcao/td_pot_hybrid.h | 2 +- source/source_lcao/module_rt/td_info.h | 2 +- source/source_lcao/module_rt/velocity_op.h | 2 +- source/source_main/driver.cpp | 2 +- source/source_psi/psi_init_nao.cpp | 2 +- source/source_pw/module_pwdft/elecond.cpp | 2 +- source/source_relax/relax_driver.cpp | 4 +- 87 files changed, 85 insertions(+), 85 deletions(-) rename source/source_io/{ => module_chgpot}/write_libxc_r.cpp (100%) rename source/source_io/{ => module_chgpot}/write_libxc_r.h (84%) rename source/source_io/{ => module_dipole}/dipole_io.h (100%) rename source/source_io/{ => module_dipole}/write_dipole.cpp (99%) rename source/source_io/{ => module_energy}/nscf_fermi_surf.cpp (100%) rename source/source_io/{ => module_energy}/nscf_fermi_surf.h (100%) rename source/source_io/{ => module_hs}/cal_pLpR.cpp (99%) rename source/source_io/{ => module_hs}/cal_pLpR.h (100%) rename source/source_io/{ => module_hs}/cal_r_overlap_R.cpp (100%) rename source/source_io/{ => module_hs}/cal_r_overlap_R.h (100%) rename source/source_io/{ => module_hs}/output_mat_sparse.cpp (99%) rename source/source_io/{ => module_hs}/output_mat_sparse.h (100%) rename source/source_io/{ => module_hs}/single_R_io.cpp (100%) rename source/source_io/{ => module_hs}/single_R_io.h (100%) rename source/source_io/{ => module_output}/binstream.cpp (100%) rename source/source_io/{ => module_output}/binstream.h (100%) rename source/source_io/{ => module_output}/cal_test.cpp (100%) rename source/source_io/{ => module_output}/cal_test.h (100%) rename source/source_io/{ => module_output}/cif_io.cpp (99%) rename source/source_io/{ => module_output}/cif_io.h (100%) rename source/source_io/{ => module_output}/csr_reader.cpp (100%) rename source/source_io/{ => module_output}/csr_reader.h (100%) rename source/source_io/{ => module_output}/cube_io.h (100%) rename source/source_io/{ => module_output}/file_reader.cpp (100%) rename source/source_io/{ => module_output}/file_reader.h (100%) rename source/source_io/{ => module_output}/orb_io.cpp (99%) rename source/source_io/{ => module_output}/orb_io.h (100%) rename source/source_io/{ => module_output}/read_cube.cpp (99%) rename source/source_io/{ => module_output}/read_exit_file.cpp (100%) rename source/source_io/{ => module_output}/read_exit_file.h (100%) rename source/source_io/{ => module_output}/sparse_matrix.cpp (100%) rename source/source_io/{ => module_output}/sparse_matrix.h (100%) rename source/source_io/{ => module_output}/write_cube.cpp (99%) rename source/source_io/{ => module_output}/write_orb_info.cpp (100%) rename source/source_io/{ => module_output}/write_orb_info.h (100%) rename source/source_io/{ => module_wannier}/fR_overlap.cpp (100%) rename source/source_io/{ => module_wannier}/fR_overlap.h (100%) diff --git a/source/source_esolver/esolver_dm2rho.cpp b/source/source_esolver/esolver_dm2rho.cpp index d194c39f9a..1ddac414f0 100644 --- a/source/source_esolver/esolver_dm2rho.cpp +++ b/source/source_esolver/esolver_dm2rho.cpp @@ -7,8 +7,8 @@ #include "source_lcao/LCAO_domain.h" #include "source_lcao/hamilt_lcao.h" #include "source_lcao/module_operator_lcao/operator_lcao.h" -#include "source_io/cube_io.h" -#include "../source_io/module_ml/io_npz.h" +#include "source_io/module_output/cube_io.h" +#include "source_io/module_ml/io_npz.h" #include "source_io/module_output/print_info.h" #include "source_lcao/rho_tau_lcao.h" // mohan add 2025-10-24 diff --git a/source/source_esolver/esolver_dp.cpp b/source/source_esolver/esolver_dp.cpp index 618772cbd6..2cabd668b6 100644 --- a/source/source_esolver/esolver_dp.cpp +++ b/source/source_esolver/esolver_dp.cpp @@ -22,7 +22,7 @@ #include "source_base/parallel_common.h" #include "source_base/timer.h" #include "source_io/module_output/output_log.h" -#include "source_io/cif_io.h" +#include "source_io/module_output/cif_io.h" #include #include diff --git a/source/source_esolver/esolver_fp.cpp b/source/source_esolver/esolver_fp.cpp index 42996cbe79..ed0d40aa31 100644 --- a/source/source_esolver/esolver_fp.cpp +++ b/source/source_esolver/esolver_fp.cpp @@ -5,8 +5,8 @@ #include "source_estate/read_pseudo.h" #include "source_hamilt/module_ewald/H_Ewald_pw.h" #include "source_hamilt/module_vdw/vdw.h" -#include "source_io/cif_io.h" -#include "source_io/cube_io.h" // use write_vdata_palgrid +#include "source_io/module_output/cif_io.h" +#include "source_io/module_output/cube_io.h" // use write_vdata_palgrid #include "source_io/json_output/init_info.h" #include "source_io/json_output/output_info.h" #include "source_io/module_output/output_log.h" diff --git a/source/source_esolver/esolver_gets.cpp b/source/source_esolver/esolver_gets.cpp index e1d6e2d70f..7eff0f537a 100644 --- a/source/source_esolver/esolver_gets.cpp +++ b/source/source_esolver/esolver_gets.cpp @@ -7,7 +7,7 @@ #include "source_lcao/LCAO_domain.h" #include "source_lcao/hamilt_lcao.h" #include "source_lcao/module_operator_lcao/operator_lcao.h" -#include "source_io/cal_r_overlap_R.h" +#include "source_io/module_hs/cal_r_overlap_R.h" #include "source_io/module_output/print_info.h" #include "source_io/module_hs/write_HS_R.h" diff --git a/source/source_esolver/esolver_ks_lcao_tddft.cpp b/source/source_esolver/esolver_ks_lcao_tddft.cpp index 1ab68926d5..35c4876aa9 100644 --- a/source/source_esolver/esolver_ks_lcao_tddft.cpp +++ b/source/source_esolver/esolver_ks_lcao_tddft.cpp @@ -2,7 +2,7 @@ //----------------IO----------------- #include "source_io/module_ctrl/ctrl_output_td.h" -#include "source_io/dipole_io.h" +#include "source_io/module_dipole/dipole_io.h" #include "source_io/module_output/output_log.h" #include "source_io/module_wf/read_wfc_nao.h" #include "source_io/module_current/td_current_io.h" diff --git a/source/source_esolver/esolver_lj.cpp b/source/source_esolver/esolver_lj.cpp index 018bdd818a..d6bb6ff21c 100644 --- a/source/source_esolver/esolver_lj.cpp +++ b/source/source_esolver/esolver_lj.cpp @@ -3,7 +3,7 @@ #include "source_cell/module_neighbor/sltk_atom_arrange.h" #include "source_cell/module_neighbor/sltk_grid_driver.h" #include "source_io/module_output/output_log.h" -#include "source_io/cif_io.h" +#include "source_io/module_output/cif_io.h" namespace ModuleESolver diff --git a/source/source_esolver/esolver_nep.cpp b/source/source_esolver/esolver_nep.cpp index 0fe0510407..680442bbf4 100644 --- a/source/source_esolver/esolver_nep.cpp +++ b/source/source_esolver/esolver_nep.cpp @@ -20,7 +20,7 @@ #include "source_base/parallel_common.h" #include "source_base/timer.h" #include "source_io/module_output/output_log.h" -#include "source_io/cif_io.h" +#include "source_io/module_output/cif_io.h" #include #include diff --git a/source/source_esolver/esolver_of.cpp b/source/source_esolver/esolver_of.cpp index 52bb929544..4a086205c4 100644 --- a/source/source_esolver/esolver_of.cpp +++ b/source/source_esolver/esolver_of.cpp @@ -1,7 +1,7 @@ #include "esolver_of.h" #include "source_io/module_parameter/parameter.h" -#include "source_io/cube_io.h" +#include "source_io/module_output/cube_io.h" #include "source_io/module_output/output_log.h" #include "source_io/module_chgpot/write_elecstat_pot.h" //-----------temporary------------------------- diff --git a/source/source_esolver/esolver_of_tddft.cpp b/source/source_esolver/esolver_of_tddft.cpp index 3aeb2bc768..487cbbca5b 100644 --- a/source/source_esolver/esolver_of_tddft.cpp +++ b/source/source_esolver/esolver_of_tddft.cpp @@ -1,7 +1,7 @@ #include "esolver_of_tddft.h" #include "source_io/module_parameter/parameter.h" -#include "source_io/cube_io.h" +#include "source_io/module_output/cube_io.h" #include "source_io/module_output/output_log.h" #include "source_io/module_chgpot/write_elecstat_pot.h" //-----------temporary------------------------- diff --git a/source/source_esolver/lcao_others.cpp b/source/source_esolver/lcao_others.cpp index 6c548ff1d6..f720493e75 100644 --- a/source/source_esolver/lcao_others.cpp +++ b/source/source_esolver/lcao_others.cpp @@ -26,7 +26,7 @@ #endif // mohan add 2025-03-06 -#include "source_io/cal_test.h" +#include "source_io/module_output/cal_test.h" namespace ModuleESolver { diff --git a/source/source_esolver/pw_others.cpp b/source/source_esolver/pw_others.cpp index 43520168d7..fc42df14bd 100644 --- a/source/source_esolver/pw_others.cpp +++ b/source/source_esolver/pw_others.cpp @@ -7,7 +7,7 @@ #include "source_base/formatter.h" // mohan add 2025-03-06 -#include "source_io/cal_test.h" +#include "source_io/module_output/cal_test.h" namespace ModuleESolver { diff --git a/source/source_estate/module_charge/charge_extra.cpp b/source/source_estate/module_charge/charge_extra.cpp index dd7bea8344..5d3c7e96d1 100644 --- a/source/source_estate/module_charge/charge_extra.cpp +++ b/source/source_estate/module_charge/charge_extra.cpp @@ -4,7 +4,7 @@ #include "source_base/global_variable.h" #include "source_base/timer.h" #include "source_base/tool_threading.h" -#include "source_io/cube_io.h" +#include "source_io/module_output/cube_io.h" Charge_Extra::Charge_Extra() { diff --git a/source/source_estate/module_charge/charge_init.cpp b/source/source_estate/module_charge/charge_init.cpp index 53e80312d4..e93f1210c9 100644 --- a/source/source_estate/module_charge/charge_init.cpp +++ b/source/source_estate/module_charge/charge_init.cpp @@ -13,7 +13,7 @@ #include "source_base/tool_threading.h" #include "source_estate/magnetism.h" #include "source_pw/module_pwdft/parallel_grid.h" -#include "source_io/cube_io.h" +#include "source_io/module_output/cube_io.h" #include "source_io/module_chgpot/rhog_io.h" #include "source_io/module_wf/read_wf2rho_pw.h" #include "source_io/module_restart/restart.h" diff --git a/source/source_io/CMakeLists.txt b/source/source_io/CMakeLists.txt index 430015d4a9..d4cc78912d 100644 --- a/source/source_io/CMakeLists.txt +++ b/source/source_io/CMakeLists.txt @@ -4,42 +4,42 @@ list(APPEND objects module_ctrl/ctrl_output_pw.cpp module_ctrl/ctrl_output_td.cpp module_bessel/bessel_basis.cpp - cal_test.cpp + module_output/cal_test.cpp module_dos/cal_dos.cpp module_dos/cal_ldos.cpp module_ml/cal_mlkedf_descriptors.cpp - cif_io.cpp + module_output/cif_io.cpp module_dos/write_dos_pw.cpp module_energy/write_bands.cpp - nscf_fermi_surf.cpp + module_energy/nscf_fermi_surf.cpp module_energy/write_eig_occ.cpp module_bessel/numerical_basis.cpp module_bessel/numerical_basis_jyjy.cpp module_bessel/numerical_descriptor.cpp module_output/output.cpp module_output/print_info.cpp - read_cube.cpp + module_output/read_cube.cpp module_chgpot/rhog_io.cpp - read_exit_file.cpp + module_output/read_exit_file.cpp module_wf/read_wfc_pw.cpp module_wf/read_wf2rho_pw.cpp module_restart/restart.cpp - binstream.cpp + module_output/binstream.cpp module_wf/write_wfc_pw.cpp module_output/write_pao.cpp - write_cube.cpp + module_output/write_cube.cpp module_chgpot/write_elecstat_pot.cpp module_elf/write_elf.cpp - write_dipole.cpp + module_dipole/write_dipole.cpp module_chgpot/write_init.cpp module_ml/write_mlkedf_descriptors.cpp module_current/td_current_io.cpp module_current/td_current_io_comm.cpp - write_libxc_r.cpp + module_chgpot/write_libxc_r.cpp module_output/output_log.cpp para_json.cpp parse_args.cpp - orb_io.cpp + module_output/orb_io.cpp module_output/filename.cpp ) @@ -50,7 +50,7 @@ list(APPEND objects_advanced module_wannier/to_wannier90_pw.cpp module_wannier/to_wannier90_lcao_in_pw.cpp module_wannier/to_wannier90_lcao.cpp - fR_overlap.cpp + module_wannier/fR_overlap.cpp ) if(ENABLE_LCAO) @@ -58,7 +58,7 @@ if(ENABLE_LCAO) module_dos/write_dos_lcao.cpp module_dos/cal_pdos_gamma.cpp module_dos/cal_pdos_multik.cpp - write_orb_info.cpp + module_output/write_orb_info.cpp module_energy/write_proj_band_lcao.cpp module_chgpot/get_pchg_lcao.cpp module_wf/get_wf_lcao.cpp @@ -66,9 +66,9 @@ if(ENABLE_LCAO) module_wf/write_wfc_nao.cpp module_dm/write_dmk.cpp module_dm/write_dmr.cpp - sparse_matrix.cpp - file_reader.cpp - csr_reader.cpp + module_output/sparse_matrix.cpp + module_output/file_reader.cpp + module_output/csr_reader.cpp module_qo/to_qo_kernel.cpp module_qo/to_qo_mpi.cpp module_qo/to_qo_structures.cpp @@ -76,15 +76,15 @@ if(ENABLE_LCAO) module_mulliken/output_dmk.cpp module_mulliken/output_mulliken.cpp module_ml/io_npz.cpp - cal_pLpR.cpp + module_hs/cal_pLpR.cpp ) list(APPEND objects_advanced module_unk/unk_overlap_lcao.cpp module_hs/write_HS_R.cpp module_hs/write_HS_sparse.cpp - single_R_io.cpp - cal_r_overlap_R.cpp - output_mat_sparse.cpp + module_hs/single_R_io.cpp + module_hs/cal_r_overlap_R.cpp + module_hs/output_mat_sparse.cpp module_ctrl/ctrl_scf_lcao.cpp module_ctrl/ctrl_runner_lcao.cpp module_ctrl/ctrl_iter_lcao.cpp diff --git a/source/source_io/module_chgpot/get_pchg_lcao.cpp b/source/source_io/module_chgpot/get_pchg_lcao.cpp index 82de5db224..9115ed784e 100644 --- a/source/source_io/module_chgpot/get_pchg_lcao.cpp +++ b/source/source_io/module_chgpot/get_pchg_lcao.cpp @@ -1,6 +1,6 @@ #include "get_pchg_lcao.h" -#include "source_io/cube_io.h" +#include "source_io/module_output/cube_io.h" #include "source_estate/module_charge/symmetry_rho.h" #include "source_estate/module_dm/cal_dm_psi.h" #include "source_lcao/module_gint/gint_interface.h" diff --git a/source/source_io/module_chgpot/get_pchg_pw.h b/source/source_io/module_chgpot/get_pchg_pw.h index 2a61c77aa3..7609b30eb8 100644 --- a/source/source_io/module_chgpot/get_pchg_pw.h +++ b/source/source_io/module_chgpot/get_pchg_pw.h @@ -1,7 +1,7 @@ #ifndef GET_PCHG_PW_H #define GET_PCHG_PW_H -#include "source_io/cube_io.h" +#include "source_io/module_output/cube_io.h" #include "source_estate/module_charge/symmetry_rho.h" namespace ModuleIO diff --git a/source/source_io/module_chgpot/rhog_io.cpp b/source/source_io/module_chgpot/rhog_io.cpp index 591fa8f7d4..b1ae0a4892 100644 --- a/source/source_io/module_chgpot/rhog_io.cpp +++ b/source/source_io/module_chgpot/rhog_io.cpp @@ -1,4 +1,4 @@ -#include "../binstream.h" +#include "source_io/module_output/binstream.h" #include "source_base/global_function.h" #include "source_io/module_parameter/parameter.h" #include "source_base/global_variable.h" diff --git a/source/source_io/module_chgpot/write_elecstat_pot.cpp b/source/source_io/module_chgpot/write_elecstat_pot.cpp index a8ae95a6c2..f2e69c0c2e 100644 --- a/source/source_io/module_chgpot/write_elecstat_pot.cpp +++ b/source/source_io/module_chgpot/write_elecstat_pot.cpp @@ -3,7 +3,7 @@ #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_io/cube_io.h" +#include "source_io/module_output/cube_io.h" #include "source_io/module_output/output_log.h" #include "write_elecstat_pot.h" diff --git a/source/source_io/module_chgpot/write_init.cpp b/source/source_io/module_chgpot/write_init.cpp index 65b0f88f3f..8455e0efe3 100644 --- a/source/source_io/module_chgpot/write_init.cpp +++ b/source/source_io/module_chgpot/write_init.cpp @@ -1,5 +1,5 @@ #include "source_io/module_chgpot/write_init.h" -#include "source_io/cube_io.h" +#include "source_io/module_output/cube_io.h" #include #include diff --git a/source/source_io/write_libxc_r.cpp b/source/source_io/module_chgpot/write_libxc_r.cpp similarity index 100% rename from source/source_io/write_libxc_r.cpp rename to source/source_io/module_chgpot/write_libxc_r.cpp diff --git a/source/source_io/write_libxc_r.h b/source/source_io/module_chgpot/write_libxc_r.h similarity index 84% rename from source/source_io/write_libxc_r.h rename to source/source_io/module_chgpot/write_libxc_r.h index ad82e68b57..d5464998ea 100644 --- a/source/source_io/write_libxc_r.h +++ b/source/source_io/module_chgpot/write_libxc_r.h @@ -11,9 +11,9 @@ #include #include - class Charge; - namespace ModulePW{ class PW_Basis_Big; } - namespace ModulePW{ class PW_Basis; } +class Charge; +namespace ModulePW{ class PW_Basis_Big; } +namespace ModulePW{ class PW_Basis; } namespace ModuleIO { @@ -51,4 +51,4 @@ namespace ModuleIO #endif // USE_LIBXC -#endif // WRITE_LIBXC_R_H \ No newline at end of file +#endif // WRITE_LIBXC_R_H diff --git a/source/source_io/module_ctrl/ctrl_output_fp.cpp b/source/source_io/module_ctrl/ctrl_output_fp.cpp index 1652395c29..19adef14b5 100644 --- a/source/source_io/module_ctrl/ctrl_output_fp.cpp +++ b/source/source_io/module_ctrl/ctrl_output_fp.cpp @@ -1,6 +1,6 @@ #include "ctrl_output_fp.h" // use ctrl_output_fp() -#include "../cube_io.h" // use write_vdata_palgrid +#include "../module_output/cube_io.h" // use write_vdata_palgrid #include "source_estate/module_charge/symmetry_rho.h" // use Symmetry_rho #include "source_hamilt/module_xc/xc_functional.h" // use XC_Functional #include "source_io/module_chgpot/write_elecstat_pot.h" // use write_elecstat_pot diff --git a/source/source_io/module_ctrl/ctrl_output_td.cpp b/source/source_io/module_ctrl/ctrl_output_td.cpp index 20fbb73227..65d0c9ab96 100644 --- a/source/source_io/module_ctrl/ctrl_output_td.cpp +++ b/source/source_io/module_ctrl/ctrl_output_td.cpp @@ -1,7 +1,7 @@ #include "ctrl_output_td.h" #include "source_base/parallel_global.h" -#include "source_io/dipole_io.h" +#include "source_io/module_dipole/dipole_io.h" #include "source_io/module_parameter/parameter.h" #include "source_io/module_current/td_current_io.h" diff --git a/source/source_io/module_ctrl/ctrl_scf_lcao.cpp b/source/source_io/module_ctrl/ctrl_scf_lcao.cpp index 5e18ebd5e4..d89993ce1a 100644 --- a/source/source_io/module_ctrl/ctrl_scf_lcao.cpp +++ b/source/source_io/module_ctrl/ctrl_scf_lcao.cpp @@ -8,8 +8,8 @@ // functions #include "../module_unk/berryphase.h" // use berryphase -#include "../cal_pLpR.h" // use AngularMomentumCalculator() -#include "../output_mat_sparse.h" // use ModuleIO::output_mat_sparse() +#include "../module_hs/cal_pLpR.h" // use AngularMomentumCalculator() +#include "source_io/module_hs/output_mat_sparse.h" // use ModuleIO::output_mat_sparse() #include "../module_mulliken/output_mulliken.h" // use cal_mag() #include "../module_wannier/to_wannier90_lcao.h" // use toWannier90_LCAO #include "../module_wannier/to_wannier90_lcao_in_pw.h" // use toWannier90_LCAO_IN_PW diff --git a/source/source_io/dipole_io.h b/source/source_io/module_dipole/dipole_io.h similarity index 100% rename from source/source_io/dipole_io.h rename to source/source_io/module_dipole/dipole_io.h diff --git a/source/source_io/write_dipole.cpp b/source/source_io/module_dipole/write_dipole.cpp similarity index 99% rename from source/source_io/write_dipole.cpp rename to source/source_io/module_dipole/write_dipole.cpp index 29d26e518d..56448365bf 100644 --- a/source/source_io/write_dipole.cpp +++ b/source/source_io/module_dipole/write_dipole.cpp @@ -1,6 +1,6 @@ #include "source_base/parallel_reduce.h" #include "source_estate/module_charge/charge.h" -#include "source_io/dipole_io.h" +#include "source_io/module_dipole/dipole_io.h" #include "source_lcao/module_rt/evolve_elec.h" // fuxiang add 2017-03-15 diff --git a/source/source_io/module_dos/cal_ldos.cpp b/source/source_io/module_dos/cal_ldos.cpp index 1168d1189e..4463c4cf03 100644 --- a/source/source_io/module_dos/cal_ldos.cpp +++ b/source/source_io/module_dos/cal_ldos.cpp @@ -1,7 +1,7 @@ #include "cal_ldos.h" #include "cal_dos.h" -#include "../cube_io.h" +#include "../module_output/cube_io.h" #include "source_estate/module_dm/cal_dm_psi.h" #include "source_lcao/module_gint/gint_interface.h" diff --git a/source/source_io/module_dos/cal_pdos_gamma.cpp b/source/source_io/module_dos/cal_pdos_gamma.cpp index 6838a28413..50acad4f26 100644 --- a/source/source_io/module_dos/cal_pdos_gamma.cpp +++ b/source/source_io/module_dos/cal_pdos_gamma.cpp @@ -6,7 +6,7 @@ #include "source_base/global_function.h" #include "source_base/global_variable.h" #include "source_lcao/hamilt_lcao.h" -#include "source_io/write_orb_info.h" +#include "source_io/module_output/write_orb_info.h" void ModuleIO::cal_pdos( diff --git a/source/source_io/module_dos/cal_pdos_multik.cpp b/source/source_io/module_dos/cal_pdos_multik.cpp index 8c868ba7eb..b7766b22f4 100644 --- a/source/source_io/module_dos/cal_pdos_multik.cpp +++ b/source/source_io/module_dos/cal_pdos_multik.cpp @@ -3,7 +3,7 @@ #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_io/module_output/write_orb_info.h" #include "source_base/global_function.h" #include "source_base/global_variable.h" #include "source_lcao/hamilt_lcao.h" diff --git a/source/source_io/module_dos/write_dos_lcao.cpp b/source/source_io/module_dos/write_dos_lcao.cpp index 2b4457f2d6..359b22fee4 100644 --- a/source/source_io/module_dos/write_dos_lcao.cpp +++ b/source/source_io/module_dos/write_dos_lcao.cpp @@ -2,7 +2,7 @@ #include "cal_dos.h" #include "cal_pdos_gamma.h" #include "cal_pdos_multik.h" -#include "../nscf_fermi_surf.h" +#include "source_io/module_energy/nscf_fermi_surf.h" #include "source_io/module_parameter/parameter.h" namespace ModuleIO diff --git a/source/source_io/module_dos/write_dos_pw.cpp b/source/source_io/module_dos/write_dos_pw.cpp index 4005d7be15..bfcc094d5c 100644 --- a/source/source_io/module_dos/write_dos_pw.cpp +++ b/source/source_io/module_dos/write_dos_pw.cpp @@ -1,6 +1,6 @@ #include "write_dos_pw.h" #include "cal_dos.h" -#include "../nscf_fermi_surf.h" +#include "../module_energy/nscf_fermi_surf.h" #include "source_base/parallel_reduce.h" #include "source_io/module_parameter/parameter.h" diff --git a/source/source_io/module_elf/write_elf.cpp b/source/source_io/module_elf/write_elf.cpp index b6ba94f78e..347a119099 100644 --- a/source/source_io/module_elf/write_elf.cpp +++ b/source/source_io/module_elf/write_elf.cpp @@ -1,5 +1,5 @@ #include "write_elf.h" -#include "source_io/cube_io.h" +#include "source_io/module_output/cube_io.h" namespace ModuleIO { diff --git a/source/source_io/nscf_fermi_surf.cpp b/source/source_io/module_energy/nscf_fermi_surf.cpp similarity index 100% rename from source/source_io/nscf_fermi_surf.cpp rename to source/source_io/module_energy/nscf_fermi_surf.cpp diff --git a/source/source_io/nscf_fermi_surf.h b/source/source_io/module_energy/nscf_fermi_surf.h similarity index 100% rename from source/source_io/nscf_fermi_surf.h rename to source/source_io/module_energy/nscf_fermi_surf.h diff --git a/source/source_io/module_energy/write_proj_band_lcao.cpp b/source/source_io/module_energy/write_proj_band_lcao.cpp index fd63cf05c6..dfcbda0757 100644 --- a/source/source_io/module_energy/write_proj_band_lcao.cpp +++ b/source/source_io/module_energy/write_proj_band_lcao.cpp @@ -6,7 +6,7 @@ #include "source_base/module_external/scalapack_connector.h" #include "source_base/timer.h" #include "source_cell/module_neighbor/sltk_atom_arrange.h" -#include "../write_orb_info.h" +#include "source_io/module_output/write_orb_info.h" #include "source_lcao/hamilt_lcao.h" template<> diff --git a/source/source_io/cal_pLpR.cpp b/source/source_io/module_hs/cal_pLpR.cpp similarity index 99% rename from source/source_io/cal_pLpR.cpp rename to source/source_io/module_hs/cal_pLpR.cpp index 91ebdad313..e437335ec0 100644 --- a/source/source_io/cal_pLpR.cpp +++ b/source/source_io/module_hs/cal_pLpR.cpp @@ -11,7 +11,7 @@ #include "source_cell/module_neighbor/sltk_grid_driver.h" #include "source_cell/module_neighbor/sltk_atom_arrange.h" #include "source_io/module_parameter/parameter.h" -#include "source_io/cal_pLpR.h" +#include "source_io/module_hs/cal_pLpR.h" #include "source_base/formatter.h" #include "source_base/parallel_common.h" /** diff --git a/source/source_io/cal_pLpR.h b/source/source_io/module_hs/cal_pLpR.h similarity index 100% rename from source/source_io/cal_pLpR.h rename to source/source_io/module_hs/cal_pLpR.h diff --git a/source/source_io/cal_r_overlap_R.cpp b/source/source_io/module_hs/cal_r_overlap_R.cpp similarity index 100% rename from source/source_io/cal_r_overlap_R.cpp rename to source/source_io/module_hs/cal_r_overlap_R.cpp diff --git a/source/source_io/cal_r_overlap_R.h b/source/source_io/module_hs/cal_r_overlap_R.h similarity index 100% rename from source/source_io/cal_r_overlap_R.h rename to source/source_io/module_hs/cal_r_overlap_R.h diff --git a/source/source_io/output_mat_sparse.cpp b/source/source_io/module_hs/output_mat_sparse.cpp similarity index 99% rename from source/source_io/output_mat_sparse.cpp rename to source/source_io/module_hs/output_mat_sparse.cpp index 00b0991ef4..4f8b04ec29 100644 --- a/source/source_io/output_mat_sparse.cpp +++ b/source/source_io/module_hs/output_mat_sparse.cpp @@ -1,6 +1,6 @@ #include "output_mat_sparse.h" -#include "source_io/cal_r_overlap_R.h" +#include "cal_r_overlap_R.h" #include "source_io/module_hs/write_HS_R.h" namespace ModuleIO diff --git a/source/source_io/output_mat_sparse.h b/source/source_io/module_hs/output_mat_sparse.h similarity index 100% rename from source/source_io/output_mat_sparse.h rename to source/source_io/module_hs/output_mat_sparse.h diff --git a/source/source_io/single_R_io.cpp b/source/source_io/module_hs/single_R_io.cpp similarity index 100% rename from source/source_io/single_R_io.cpp rename to source/source_io/module_hs/single_R_io.cpp diff --git a/source/source_io/single_R_io.h b/source/source_io/module_hs/single_R_io.h similarity index 100% rename from source/source_io/single_R_io.h rename to source/source_io/module_hs/single_R_io.h diff --git a/source/source_io/module_hs/write_HS_sparse.cpp b/source/source_io/module_hs/write_HS_sparse.cpp index 4722c0f4f6..382ece5a03 100644 --- a/source/source_io/module_hs/write_HS_sparse.cpp +++ b/source/source_io/module_hs/write_HS_sparse.cpp @@ -4,7 +4,7 @@ #include "source_base/parallel_reduce.h" #include "source_base/timer.h" #include "source_lcao/module_rt/td_info.h" -#include "../single_R_io.h" +#include "single_R_io.h" void ModuleIO::save_HSR_sparse(const int& istep, const Parallel_Orbitals& pv, diff --git a/source/source_io/binstream.cpp b/source/source_io/module_output/binstream.cpp similarity index 100% rename from source/source_io/binstream.cpp rename to source/source_io/module_output/binstream.cpp diff --git a/source/source_io/binstream.h b/source/source_io/module_output/binstream.h similarity index 100% rename from source/source_io/binstream.h rename to source/source_io/module_output/binstream.h diff --git a/source/source_io/cal_test.cpp b/source/source_io/module_output/cal_test.cpp similarity index 100% rename from source/source_io/cal_test.cpp rename to source/source_io/module_output/cal_test.cpp diff --git a/source/source_io/cal_test.h b/source/source_io/module_output/cal_test.h similarity index 100% rename from source/source_io/cal_test.h rename to source/source_io/module_output/cal_test.h diff --git a/source/source_io/cif_io.cpp b/source/source_io/module_output/cif_io.cpp similarity index 99% rename from source/source_io/cif_io.cpp rename to source/source_io/module_output/cif_io.cpp index a03cd0d15c..4b9a0e0fea 100644 --- a/source/source_io/cif_io.cpp +++ b/source/source_io/module_output/cif_io.cpp @@ -3,7 +3,7 @@ #include #include #include "source_base/formatter.h" -#include "source_io/cif_io.h" +#include "cif_io.h" #include #include #include "source_base/tool_quit.h" diff --git a/source/source_io/cif_io.h b/source/source_io/module_output/cif_io.h similarity index 100% rename from source/source_io/cif_io.h rename to source/source_io/module_output/cif_io.h diff --git a/source/source_io/csr_reader.cpp b/source/source_io/module_output/csr_reader.cpp similarity index 100% rename from source/source_io/csr_reader.cpp rename to source/source_io/module_output/csr_reader.cpp diff --git a/source/source_io/csr_reader.h b/source/source_io/module_output/csr_reader.h similarity index 100% rename from source/source_io/csr_reader.h rename to source/source_io/module_output/csr_reader.h diff --git a/source/source_io/cube_io.h b/source/source_io/module_output/cube_io.h similarity index 100% rename from source/source_io/cube_io.h rename to source/source_io/module_output/cube_io.h diff --git a/source/source_io/file_reader.cpp b/source/source_io/module_output/file_reader.cpp similarity index 100% rename from source/source_io/file_reader.cpp rename to source/source_io/module_output/file_reader.cpp diff --git a/source/source_io/file_reader.h b/source/source_io/module_output/file_reader.h similarity index 100% rename from source/source_io/file_reader.h rename to source/source_io/module_output/file_reader.h diff --git a/source/source_io/orb_io.cpp b/source/source_io/module_output/orb_io.cpp similarity index 99% rename from source/source_io/orb_io.cpp rename to source/source_io/module_output/orb_io.cpp index 8a615b9a3c..cd1763e924 100644 --- a/source/source_io/orb_io.cpp +++ b/source/source_io/module_output/orb_io.cpp @@ -1,4 +1,4 @@ -#include "source_io/orb_io.h" +#include "source_io/module_output/orb_io.h" #include "source_base/tool_quit.h" #ifdef __MPI #include "source_base/parallel_common.h" diff --git a/source/source_io/orb_io.h b/source/source_io/module_output/orb_io.h similarity index 100% rename from source/source_io/orb_io.h rename to source/source_io/module_output/orb_io.h diff --git a/source/source_io/read_cube.cpp b/source/source_io/module_output/read_cube.cpp similarity index 99% rename from source/source_io/read_cube.cpp rename to source/source_io/module_output/read_cube.cpp index dea1136edd..f71374ad89 100644 --- a/source/source_io/read_cube.cpp +++ b/source/source_io/module_output/read_cube.cpp @@ -1,4 +1,4 @@ -#include "source_io/cube_io.h" +#include "source_io/module_output/cube_io.h" #include #include "source_pw/module_pwdft/parallel_grid.h" #include // use std::memcpy diff --git a/source/source_io/read_exit_file.cpp b/source/source_io/module_output/read_exit_file.cpp similarity index 100% rename from source/source_io/read_exit_file.cpp rename to source/source_io/module_output/read_exit_file.cpp diff --git a/source/source_io/read_exit_file.h b/source/source_io/module_output/read_exit_file.h similarity index 100% rename from source/source_io/read_exit_file.h rename to source/source_io/module_output/read_exit_file.h diff --git a/source/source_io/sparse_matrix.cpp b/source/source_io/module_output/sparse_matrix.cpp similarity index 100% rename from source/source_io/sparse_matrix.cpp rename to source/source_io/module_output/sparse_matrix.cpp diff --git a/source/source_io/sparse_matrix.h b/source/source_io/module_output/sparse_matrix.h similarity index 100% rename from source/source_io/sparse_matrix.h rename to source/source_io/module_output/sparse_matrix.h diff --git a/source/source_io/write_cube.cpp b/source/source_io/module_output/write_cube.cpp similarity index 99% rename from source/source_io/write_cube.cpp rename to source/source_io/module_output/write_cube.cpp index ae591969d0..79181a5dc0 100644 --- a/source/source_io/write_cube.cpp +++ b/source/source_io/module_output/write_cube.cpp @@ -1,7 +1,7 @@ #include "source_base/element_name.h" #include "source_base/parallel_comm.h" #include "source_pw/module_pwdft/parallel_grid.h" -#include "source_io/cube_io.h" +#include "source_io/module_output/cube_io.h" #include "source_io/module_parameter/parameter.h" #include diff --git a/source/source_io/write_orb_info.cpp b/source/source_io/module_output/write_orb_info.cpp similarity index 100% rename from source/source_io/write_orb_info.cpp rename to source/source_io/module_output/write_orb_info.cpp diff --git a/source/source_io/write_orb_info.h b/source/source_io/module_output/write_orb_info.h similarity index 100% rename from source/source_io/write_orb_info.h rename to source/source_io/module_output/write_orb_info.h diff --git a/source/source_io/fR_overlap.cpp b/source/source_io/module_wannier/fR_overlap.cpp similarity index 100% rename from source/source_io/fR_overlap.cpp rename to source/source_io/module_wannier/fR_overlap.cpp diff --git a/source/source_io/fR_overlap.h b/source/source_io/module_wannier/fR_overlap.h similarity index 100% rename from source/source_io/fR_overlap.h rename to source/source_io/module_wannier/fR_overlap.h diff --git a/source/source_io/module_wannier/to_wannier90_lcao.cpp b/source/source_io/module_wannier/to_wannier90_lcao.cpp index 989bdc1b39..8c1b8288d9 100644 --- a/source/source_io/module_wannier/to_wannier90_lcao.cpp +++ b/source/source_io/module_wannier/to_wannier90_lcao.cpp @@ -1,7 +1,7 @@ #include "to_wannier90_lcao.h" #include "source_io/module_parameter/parameter.h" -#include "../fR_overlap.h" +#include "fR_overlap.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/module_wannier/to_wannier90_lcao.h b/source/source_io/module_wannier/to_wannier90_lcao.h index d8540886f2..6681dadece 100644 --- a/source/source_io/module_wannier/to_wannier90_lcao.h +++ b/source/source_io/module_wannier/to_wannier90_lcao.h @@ -23,7 +23,7 @@ #include "source_lcao/center2_orb.h" #include "source_lcao/wavefunc_in_pw.h" #include "source_psi/psi.h" -#include "../single_R_io.h" +#include "../module_hs/single_R_io.h" #include "to_wannier90.h" #include @@ -35,7 +35,7 @@ #include #ifdef __LCAO -#include "../fR_overlap.h" +#include "fR_overlap.h" #include "source_base/abfs-vector3_order.h" #include "source_base/math_lebedev_laikov.h" #include "source_lcao/module_hcontainer/hcontainer.h" diff --git a/source/source_io/module_wannier/to_wannier90_lcao_in_pw.cpp b/source/source_io/module_wannier/to_wannier90_lcao_in_pw.cpp index e0c9b5242e..48d3e7ae65 100644 --- a/source/source_io/module_wannier/to_wannier90_lcao_in_pw.cpp +++ b/source/source_io/module_wannier/to_wannier90_lcao_in_pw.cpp @@ -6,7 +6,7 @@ #include "source_base/math_sphbes.h" #include "source_base/math_ylmreal.h" #include "source_base/parallel_reduce.h" -#include "../binstream.h" +#include "../module_output/binstream.h" #include "source_psi/psi_init_nao.h" #ifdef __LCAO diff --git a/source/source_io/module_wannier/to_wannier90_lcao_in_pw.h b/source/source_io/module_wannier/to_wannier90_lcao_in_pw.h index afd954c501..763c050a81 100644 --- a/source/source_io/module_wannier/to_wannier90_lcao_in_pw.h +++ b/source/source_io/module_wannier/to_wannier90_lcao_in_pw.h @@ -17,7 +17,7 @@ #include "source_cell/klist.h" #include "source_cell/module_neighbor/sltk_grid_driver.h" #include "source_psi/psi.h" -#include "../single_R_io.h" +#include "../module_hs/single_R_io.h" #include "to_wannier90.h" #include "to_wannier90_pw.h" diff --git a/source/source_io/module_wannier/to_wannier90_pw.cpp b/source/source_io/module_wannier/to_wannier90_pw.cpp index 5b55899082..3f6af1d44e 100644 --- a/source/source_io/module_wannier/to_wannier90_pw.cpp +++ b/source/source_io/module_wannier/to_wannier90_pw.cpp @@ -7,7 +7,7 @@ #include "source_base/math_sphbes.h" #include "source_base/math_ylmreal.h" #include "source_base/parallel_reduce.h" -#include "../binstream.h" +#include "../module_output/binstream.h" toWannier90_PW::toWannier90_PW( const bool &out_wannier_mmn, diff --git a/source/source_io/module_wf/get_wf_lcao.cpp b/source/source_io/module_wf/get_wf_lcao.cpp index 4ef2e8cd17..4fd6c9a5f3 100644 --- a/source/source_io/module_wf/get_wf_lcao.cpp +++ b/source/source_io/module_wf/get_wf_lcao.cpp @@ -1,6 +1,6 @@ #include "get_wf_lcao.h" -#include "source_io/cube_io.h" +#include "source_io/module_output/cube_io.h" #include "source_io/module_wf/write_wfc_pw.h" #include "source_base/memory.h" diff --git a/source/source_io/module_wf/read_wfc_pw.cpp b/source/source_io/module_wf/read_wfc_pw.cpp index bb616a4a0a..66b58ae517 100644 --- a/source/source_io/module_wf/read_wfc_pw.cpp +++ b/source/source_io/module_wf/read_wfc_pw.cpp @@ -1,7 +1,7 @@ #include "read_wfc_pw.h" #include "source_io/module_parameter/parameter.h" -#include "../binstream.h" +#include "source_io/module_output/binstream.h" #include "source_base/global_function.h" #include "source_base/global_variable.h" #include "source_base/parallel_common.h" diff --git a/source/source_io/module_wf/write_wfc_nao.cpp b/source/source_io/module_wf/write_wfc_nao.cpp index 25e8d679ee..1ea1717c29 100644 --- a/source/source_io/module_wf/write_wfc_nao.cpp +++ b/source/source_io/module_wf/write_wfc_nao.cpp @@ -8,7 +8,7 @@ #include "source_base/module_external/scalapack_connector.h" #include "source_base/global_variable.h" #include "source_base/global_function.h" -#include "../binstream.h" +#include "source_io/module_output/binstream.h" #include "source_io/module_output/filename.h" namespace ModuleIO diff --git a/source/source_io/module_wf/write_wfc_pw.cpp b/source/source_io/module_wf/write_wfc_pw.cpp index ba89969fa0..0a8a7cf912 100644 --- a/source/source_io/module_wf/write_wfc_pw.cpp +++ b/source/source_io/module_wf/write_wfc_pw.cpp @@ -4,7 +4,7 @@ #include "mpi.h" #endif -#include "../binstream.h" +#include "source_io/module_output/binstream.h" #include "source_base/global_variable.h" #include "source_base/parallel_global.h" #include "source_base/tool_title.h" diff --git a/source/source_lcao/module_hcontainer/output_hcontainer.cpp b/source/source_lcao/module_hcontainer/output_hcontainer.cpp index 10d21bd2ca..6b89302e1c 100644 --- a/source/source_lcao/module_hcontainer/output_hcontainer.cpp +++ b/source/source_lcao/module_hcontainer/output_hcontainer.cpp @@ -1,6 +1,6 @@ #include "output_hcontainer.h" -#include "source_io/sparse_matrix.h" +#include "source_io/module_output/sparse_matrix.h" #include diff --git a/source/source_lcao/module_hcontainer/read_hcontainer.cpp b/source/source_lcao/module_hcontainer/read_hcontainer.cpp index 1ff134f898..4db9dcf895 100644 --- a/source/source_lcao/module_hcontainer/read_hcontainer.cpp +++ b/source/source_lcao/module_hcontainer/read_hcontainer.cpp @@ -1,7 +1,7 @@ #include "read_hcontainer.h" -#include "source_io/sparse_matrix.h" -#include "source_io/csr_reader.h" +#include "source_io/module_output/sparse_matrix.h" +#include "source_io/module_output/csr_reader.h" #include "hcontainer_funcs.h" #include diff --git a/source/source_lcao/module_lr/esolver_lrtd_lcao.cpp b/source/source_lcao/module_lr/esolver_lrtd_lcao.cpp index da51fce0c0..b8848e6bcd 100644 --- a/source/source_lcao/module_lr/esolver_lrtd_lcao.cpp +++ b/source/source_lcao/module_lr/esolver_lrtd_lcao.cpp @@ -8,7 +8,7 @@ #include #include "source_lcao/hamilt_lcao.h" #include "source_io/module_wf/read_wfc_nao.h" -#include "source_io/cube_io.h" +#include "source_io/module_output/cube_io.h" #include "source_io/module_output/print_info.h" #include "source_cell/module_neighbor/sltk_atom_arrange.h" #include "source_lcao/module_lr/utils/lr_util_print.h" diff --git a/source/source_lcao/module_lr/potentials/xc_kernel.cpp b/source/source_lcao/module_lr/potentials/xc_kernel.cpp index 69c37b8de2..b28d44a0c6 100644 --- a/source/source_lcao/module_lr/potentials/xc_kernel.cpp +++ b/source/source_lcao/module_lr/potentials/xc_kernel.cpp @@ -6,7 +6,7 @@ #include "source_lcao/module_lr/utils/lr_util_xc.hpp" #include #include -#include "source_io/cube_io.h" +#include "source_io/module_output/cube_io.h" #ifdef USE_LIBXC #include #include "source_hamilt/module_xc/xc_functional_libxc.h" diff --git a/source/source_lcao/module_operator_lcao/td_pot_hybrid.h b/source/source_lcao/module_operator_lcao/td_pot_hybrid.h index 265d3b1576..bdb53f3480 100644 --- a/source/source_lcao/module_operator_lcao/td_pot_hybrid.h +++ b/source/source_lcao/module_operator_lcao/td_pot_hybrid.h @@ -8,7 +8,7 @@ #include "source_lcao/module_operator_lcao/operator_lcao.h" #include "source_lcao/module_hcontainer/hcontainer.h" #include -#include "source_io/cal_r_overlap_R.h" +#include "source_io/module_hs/cal_r_overlap_R.h" #include "source_lcao/module_rt/td_info.h" #include "source_estate/module_pot/H_TDDFT_pw.h" diff --git a/source/source_lcao/module_rt/td_info.h b/source/source_lcao/module_rt/td_info.h index 57dccd7e9f..78f0b1cc00 100644 --- a/source/source_lcao/module_rt/td_info.h +++ b/source/source_lcao/module_rt/td_info.h @@ -3,7 +3,7 @@ #include "source_base/abfs-vector3_order.h" #include "source_base/timer.h" #include "source_lcao/module_hcontainer/hcontainer.h" -#include "source_io/cal_r_overlap_R.h" +#include "source_io/module_hs/cal_r_overlap_R.h" #include // Class to store TDDFT infos, mainly for periodic system. diff --git a/source/source_lcao/module_rt/velocity_op.h b/source/source_lcao/module_rt/velocity_op.h index 7c3986a431..69f184872e 100644 --- a/source/source_lcao/module_rt/velocity_op.h +++ b/source/source_lcao/module_rt/velocity_op.h @@ -7,7 +7,7 @@ #include "source_lcao/module_hcontainer/hcontainer.h" #include "source_basis/module_nao/two_center_integrator.h" #include "source_base/vector3.h" -#include "source_io/cal_r_overlap_R.h" +#include "source_io/module_hs/cal_r_overlap_R.h" //design to calculate velocity operator template diff --git a/source/source_main/driver.cpp b/source/source_main/driver.cpp index 2c341fb8ff..23fc3de633 100644 --- a/source/source_main/driver.cpp +++ b/source/source_main/driver.cpp @@ -4,7 +4,7 @@ #include "source_base/memory.h" #include "source_base/timer.h" #include "source_esolver/esolver.h" -#include "source_io/cal_test.h" +#include "source_io/module_output/cal_test.h" #include "source_io/module_parameter/input_conv.h" #include "source_io/para_json.h" #include "source_io/module_output/print_info.h" diff --git a/source/source_psi/psi_init_nao.cpp b/source/source_psi/psi_init_nao.cpp index 151f1ac7b4..29d018f213 100644 --- a/source/source_psi/psi_init_nao.cpp +++ b/source/source_psi/psi_init_nao.cpp @@ -16,7 +16,7 @@ #include "source_base/parallel_common.h" #include "source_base/parallel_reduce.h" #endif -#include "source_io/orb_io.h" +#include "source_io/module_output/orb_io.h" #include "source_io/module_parameter/parameter.h" // GlobalV::NQX and GlobalV::DQ are here #include "source_io/module_parameter/parameter.h" diff --git a/source/source_pw/module_pwdft/elecond.cpp b/source/source_pw/module_pwdft/elecond.cpp index dbf78ea2a4..e7862538ab 100644 --- a/source/source_pw/module_pwdft/elecond.cpp +++ b/source/source_pw/module_pwdft/elecond.cpp @@ -5,7 +5,7 @@ #include "source_base/kernels/math_kernel_op.h" #include "source_base/parallel_device.h" #include "source_estate/occupy.h" -#include "source_io/binstream.h" +#include "source_io/module_output/binstream.h" #include "source_io/module_parameter/parameter.h" #include diff --git a/source/source_relax/relax_driver.cpp b/source/source_relax/relax_driver.cpp index 06ed682e1b..ba42678d75 100644 --- a/source/source_relax/relax_driver.cpp +++ b/source/source_relax/relax_driver.cpp @@ -1,11 +1,11 @@ #include "relax_driver.h" #include "source_base/global_file.h" -#include "source_io/cif_io.h" +#include "source_io/module_output/cif_io.h" #include "source_io/json_output/output_info.h" #include "source_io/module_output/output_log.h" #include "source_io/module_output/print_info.h" -#include "source_io/read_exit_file.h" +#include "source_io/module_output/read_exit_file.h" #include "source_io/module_parameter/parameter.h" #include "source_cell/print_cell.h" From 11938feb5ad1ea4f8635d29a449d6f606e05e684 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Tue, 3 Feb 2026 09:22:46 +0800 Subject: [PATCH 05/32] Rename json_output to module_json and move para_json files, update include paths --- source/source_esolver/esolver_fp.cpp | 4 ++-- source/source_esolver/esolver_ks.cpp | 4 ++-- source/source_io/CMakeLists.txt | 2 +- source/source_io/{json_output => module_json}/CMakeLists.txt | 0 source/source_io/{json_output => module_json}/abacusjson.cpp | 0 source/source_io/{json_output => module_json}/abacusjson.h | 0 .../source_io/{json_output => module_json}/general_info.cpp | 0 source/source_io/{json_output => module_json}/general_info.h | 0 source/source_io/{json_output => module_json}/init_info.cpp | 0 source/source_io/{json_output => module_json}/init_info.h | 0 source/source_io/{json_output => module_json}/json_node.h | 0 source/source_io/{json_output => module_json}/output_info.cpp | 0 source/source_io/{json_output => module_json}/output_info.h | 0 source/source_io/{ => module_json}/para_json.cpp | 0 source/source_io/{ => module_json}/para_json.h | 0 source/source_io/{json_output => module_json}/readin_info.cpp | 0 source/source_io/{json_output => module_json}/readin_info.h | 0 .../{json_output => module_json}/test/CMakeLists.txt | 0 .../{json_output => module_json}/test/para_json_test.cpp | 0 source/source_main/driver.cpp | 2 +- source/source_main/driver_run.cpp | 2 +- source/source_relax/relax_driver.cpp | 2 +- 22 files changed, 8 insertions(+), 8 deletions(-) rename source/source_io/{json_output => module_json}/CMakeLists.txt (100%) rename source/source_io/{json_output => module_json}/abacusjson.cpp (100%) rename source/source_io/{json_output => module_json}/abacusjson.h (100%) rename source/source_io/{json_output => module_json}/general_info.cpp (100%) rename source/source_io/{json_output => module_json}/general_info.h (100%) rename source/source_io/{json_output => module_json}/init_info.cpp (100%) rename source/source_io/{json_output => module_json}/init_info.h (100%) rename source/source_io/{json_output => module_json}/json_node.h (100%) rename source/source_io/{json_output => module_json}/output_info.cpp (100%) rename source/source_io/{json_output => module_json}/output_info.h (100%) rename source/source_io/{ => module_json}/para_json.cpp (100%) rename source/source_io/{ => module_json}/para_json.h (100%) rename source/source_io/{json_output => module_json}/readin_info.cpp (100%) rename source/source_io/{json_output => module_json}/readin_info.h (100%) rename source/source_io/{json_output => module_json}/test/CMakeLists.txt (100%) rename source/source_io/{json_output => module_json}/test/para_json_test.cpp (100%) diff --git a/source/source_esolver/esolver_fp.cpp b/source/source_esolver/esolver_fp.cpp index ed0d40aa31..238c093580 100644 --- a/source/source_esolver/esolver_fp.cpp +++ b/source/source_esolver/esolver_fp.cpp @@ -7,8 +7,8 @@ #include "source_hamilt/module_vdw/vdw.h" #include "source_io/module_output/cif_io.h" #include "source_io/module_output/cube_io.h" // use write_vdata_palgrid -#include "source_io/json_output/init_info.h" -#include "source_io/json_output/output_info.h" +#include "source_io/module_json/init_info.h" +#include "source_io/module_json/output_info.h" #include "source_io/module_output/output_log.h" #include "source_io/module_output/print_info.h" #include "source_io/module_chgpot/rhog_io.h" diff --git a/source/source_esolver/esolver_ks.cpp b/source/source_esolver/esolver_ks.cpp index 0312f308ac..fc99b8a572 100644 --- a/source/source_esolver/esolver_ks.cpp +++ b/source/source_esolver/esolver_ks.cpp @@ -2,8 +2,8 @@ #include "source_base/timer_wrapper.h" // for jason output information -#include "source_io/json_output/init_info.h" -#include "source_io/json_output/output_info.h" +#include "source_io/module_json/init_info.h" +#include "source_io/module_json/output_info.h" #include "source_estate/update_pot.h" // mohan add 20251016 #include "source_estate/module_charge/chgmixing.h" // mohan add 20251018 diff --git a/source/source_io/CMakeLists.txt b/source/source_io/CMakeLists.txt index d4cc78912d..026a0efe36 100644 --- a/source/source_io/CMakeLists.txt +++ b/source/source_io/CMakeLists.txt @@ -37,7 +37,7 @@ list(APPEND objects module_current/td_current_io_comm.cpp module_chgpot/write_libxc_r.cpp module_output/output_log.cpp - para_json.cpp + module_json/para_json.cpp parse_args.cpp module_output/orb_io.cpp module_output/filename.cpp diff --git a/source/source_io/json_output/CMakeLists.txt b/source/source_io/module_json/CMakeLists.txt similarity index 100% rename from source/source_io/json_output/CMakeLists.txt rename to source/source_io/module_json/CMakeLists.txt diff --git a/source/source_io/json_output/abacusjson.cpp b/source/source_io/module_json/abacusjson.cpp similarity index 100% rename from source/source_io/json_output/abacusjson.cpp rename to source/source_io/module_json/abacusjson.cpp diff --git a/source/source_io/json_output/abacusjson.h b/source/source_io/module_json/abacusjson.h similarity index 100% rename from source/source_io/json_output/abacusjson.h rename to source/source_io/module_json/abacusjson.h diff --git a/source/source_io/json_output/general_info.cpp b/source/source_io/module_json/general_info.cpp similarity index 100% rename from source/source_io/json_output/general_info.cpp rename to source/source_io/module_json/general_info.cpp diff --git a/source/source_io/json_output/general_info.h b/source/source_io/module_json/general_info.h similarity index 100% rename from source/source_io/json_output/general_info.h rename to source/source_io/module_json/general_info.h diff --git a/source/source_io/json_output/init_info.cpp b/source/source_io/module_json/init_info.cpp similarity index 100% rename from source/source_io/json_output/init_info.cpp rename to source/source_io/module_json/init_info.cpp diff --git a/source/source_io/json_output/init_info.h b/source/source_io/module_json/init_info.h similarity index 100% rename from source/source_io/json_output/init_info.h rename to source/source_io/module_json/init_info.h diff --git a/source/source_io/json_output/json_node.h b/source/source_io/module_json/json_node.h similarity index 100% rename from source/source_io/json_output/json_node.h rename to source/source_io/module_json/json_node.h diff --git a/source/source_io/json_output/output_info.cpp b/source/source_io/module_json/output_info.cpp similarity index 100% rename from source/source_io/json_output/output_info.cpp rename to source/source_io/module_json/output_info.cpp diff --git a/source/source_io/json_output/output_info.h b/source/source_io/module_json/output_info.h similarity index 100% rename from source/source_io/json_output/output_info.h rename to source/source_io/module_json/output_info.h diff --git a/source/source_io/para_json.cpp b/source/source_io/module_json/para_json.cpp similarity index 100% rename from source/source_io/para_json.cpp rename to source/source_io/module_json/para_json.cpp diff --git a/source/source_io/para_json.h b/source/source_io/module_json/para_json.h similarity index 100% rename from source/source_io/para_json.h rename to source/source_io/module_json/para_json.h diff --git a/source/source_io/json_output/readin_info.cpp b/source/source_io/module_json/readin_info.cpp similarity index 100% rename from source/source_io/json_output/readin_info.cpp rename to source/source_io/module_json/readin_info.cpp diff --git a/source/source_io/json_output/readin_info.h b/source/source_io/module_json/readin_info.h similarity index 100% rename from source/source_io/json_output/readin_info.h rename to source/source_io/module_json/readin_info.h diff --git a/source/source_io/json_output/test/CMakeLists.txt b/source/source_io/module_json/test/CMakeLists.txt similarity index 100% rename from source/source_io/json_output/test/CMakeLists.txt rename to source/source_io/module_json/test/CMakeLists.txt diff --git a/source/source_io/json_output/test/para_json_test.cpp b/source/source_io/module_json/test/para_json_test.cpp similarity index 100% rename from source/source_io/json_output/test/para_json_test.cpp rename to source/source_io/module_json/test/para_json_test.cpp diff --git a/source/source_main/driver.cpp b/source/source_main/driver.cpp index 23fc3de633..f2b08dcf67 100644 --- a/source/source_main/driver.cpp +++ b/source/source_main/driver.cpp @@ -6,7 +6,7 @@ #include "source_esolver/esolver.h" #include "source_io/module_output/cal_test.h" #include "source_io/module_parameter/input_conv.h" -#include "source_io/para_json.h" +#include "source_io/module_json/para_json.h" #include "source_io/module_output/print_info.h" #include "source_io/module_parameter/read_input.h" #include "source_io/module_parameter/parameter.h" diff --git a/source/source_main/driver_run.cpp b/source/source_main/driver_run.cpp index 2f4d985adf..dcdc09d217 100644 --- a/source/source_main/driver_run.cpp +++ b/source/source_main/driver_run.cpp @@ -3,7 +3,7 @@ #include "source_cell/module_neighbor/sltk_atom_arrange.h" #include "source_relax/relax_driver.h" #include "source_io/module_parameter/parameter.h" -#include "source_io/para_json.h" +#include "source_io/module_json/para_json.h" #include "source_io/module_output/print_info.h" #include "source_md/run_md.h" #include "source_base/global_variable.h" diff --git a/source/source_relax/relax_driver.cpp b/source/source_relax/relax_driver.cpp index ba42678d75..d1c69df8b0 100644 --- a/source/source_relax/relax_driver.cpp +++ b/source/source_relax/relax_driver.cpp @@ -2,7 +2,7 @@ #include "source_base/global_file.h" #include "source_io/module_output/cif_io.h" -#include "source_io/json_output/output_info.h" +#include "source_io/module_json/output_info.h" #include "source_io/module_output/output_log.h" #include "source_io/module_output/print_info.h" #include "source_io/module_output/read_exit_file.h" From ba64c35c6655d48ba712e751eaff7d3040cfc541 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sat, 7 Feb 2026 15:42:00 +0800 Subject: [PATCH 06/32] Update CMakeLists.txt: change json_output to module_json --- source/source_io/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/source_io/CMakeLists.txt b/source/source_io/CMakeLists.txt index 026a0efe36..d018181b3e 100644 --- a/source/source_io/CMakeLists.txt +++ b/source/source_io/CMakeLists.txt @@ -142,6 +142,6 @@ endif() if(ENABLE_RAPIDJSON) if(ENABLE_MPI) - add_subdirectory(json_output) + add_subdirectory(module_json) endif() endif() From 08370eafd83d4c99e4d3da4aa59a5e7e7243aa92 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sat, 7 Feb 2026 16:11:37 +0800 Subject: [PATCH 07/32] Fix CMakeLists.txt: update source_io file paths to module_output directory --- source/source_basis/module_nao/test/CMakeLists.txt | 2 +- source/source_estate/test/CMakeLists.txt | 2 +- source/source_io/module_mulliken/output_mulliken.cpp | 1 - source/source_lcao/module_lr/utils/test/CMakeLists.txt | 2 +- source/source_md/test/CMakeLists.txt | 2 +- source/source_psi/test/CMakeLists.txt | 4 ++-- source/source_relax/test/CMakeLists.txt | 2 +- 7 files changed, 7 insertions(+), 8 deletions(-) diff --git a/source/source_basis/module_nao/test/CMakeLists.txt b/source/source_basis/module_nao/test/CMakeLists.txt index b337633003..6834084ff3 100644 --- a/source/source_basis/module_nao/test/CMakeLists.txt +++ b/source/source_basis/module_nao/test/CMakeLists.txt @@ -16,7 +16,7 @@ AddTest( ../numerical_radial.cpp ../../module_ao/ORB_atomic_lm.cpp ../../module_ao/ORB_atomic.cpp - ../../../source_io/orb_io.cpp + ../../../source_io/module_output/orb_io.cpp LIBS parameter ${math_libs} device base ) diff --git a/source/source_estate/test/CMakeLists.txt b/source/source_estate/test/CMakeLists.txt index ba337172d3..b361f3026d 100644 --- a/source/source_estate/test/CMakeLists.txt +++ b/source/source_estate/test/CMakeLists.txt @@ -97,7 +97,7 @@ AddTest( AddTest( TARGET charge_extra LIBS parameter ${math_libs} base device cell_info - SOURCES charge_extra_test.cpp ../module_charge/charge_extra.cpp ../../source_io/read_cube.cpp ../../source_io/write_cube.cpp + SOURCES charge_extra_test.cpp ../module_charge/charge_extra.cpp ../../source_io/module_output/read_cube.cpp ../../source_io/module_output/write_cube.cpp ../../source_io/module_output/output.cpp ../../source_base/module_fft/fft_bundle.cpp ../../source_base/module_fft/fft_cpu.cpp ) diff --git a/source/source_io/module_mulliken/output_mulliken.cpp b/source/source_io/module_mulliken/output_mulliken.cpp index fb67f7ea8f..3acba7bc51 100644 --- a/source/source_io/module_mulliken/output_mulliken.cpp +++ b/source/source_io/module_mulliken/output_mulliken.cpp @@ -1,5 +1,4 @@ #include "source_io/module_mulliken/output_mulliken.h" - #include "source_io/module_parameter/parameter.h" #include "source_base/formatter.h" #include "source_base/name_angular.h" diff --git a/source/source_lcao/module_lr/utils/test/CMakeLists.txt b/source/source_lcao/module_lr/utils/test/CMakeLists.txt index 4b4589a5c9..2ecf21011d 100644 --- a/source/source_lcao/module_lr/utils/test/CMakeLists.txt +++ b/source/source_lcao/module_lr/utils/test/CMakeLists.txt @@ -3,7 +3,7 @@ AddTest( TARGET lr_util_phys_test LIBS parameter base ${math_libs} device container planewave #for FFT SOURCES lr_util_physics_test.cpp ../lr_util.cpp - ../../../../source_io/orb_io.cpp + ../../../../source_io/module_output/orb_io.cpp ) AddTest( diff --git a/source/source_md/test/CMakeLists.txt b/source/source_md/test/CMakeLists.txt index 457127eb42..296e9a10b7 100644 --- a/source/source_md/test/CMakeLists.txt +++ b/source/source_md/test/CMakeLists.txt @@ -48,7 +48,7 @@ list(APPEND depend_files ../../source_io/module_output/output.cpp ../../source_io/module_output/output_log.cpp ../../source_io/module_output/print_info.cpp - ../../source_io/cif_io.cpp + ../../source_io/module_output/cif_io.cpp ../../source_esolver/esolver_lj.cpp ../../source_base/parallel_reduce.cpp ../../source_base/parallel_global.cpp diff --git a/source/source_psi/test/CMakeLists.txt b/source/source_psi/test/CMakeLists.txt index 628fc10342..0cd654d675 100644 --- a/source/source_psi/test/CMakeLists.txt +++ b/source/source_psi/test/CMakeLists.txt @@ -16,10 +16,10 @@ AddTest( ../../source_cell/atom_spec.cpp ../../source_cell/parallel_kpoints.cpp ../../source_cell/test/support/mock_unitcell.cpp - ../../source_io/orb_io.cpp + ../../source_io/module_output/orb_io.cpp ../../source_io/module_output/write_pao.cpp ../../source_io/module_wf/read_wfc_pw.cpp - ../../source_io/binstream.cpp + ../../source_io/module_output/binstream.cpp ../../source_io/module_output/filename.cpp ) endif() diff --git a/source/source_relax/test/CMakeLists.txt b/source/source_relax/test/CMakeLists.txt index d157cc721c..52a20a8ccf 100644 --- a/source/source_relax/test/CMakeLists.txt +++ b/source/source_relax/test/CMakeLists.txt @@ -48,7 +48,7 @@ AddTest( ../lattice_change_cg.cpp ../lattice_change_basic.cpp mock_remake_cell.cpp - ../../source_io/orb_io.cpp + ../../source_io/module_output/orb_io.cpp ) AddTest( From d556f85ed548a5d3d8b669cbfa409f3f990aec73 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sat, 7 Feb 2026 16:21:09 +0800 Subject: [PATCH 08/32] Fix csr_reader.h include paths: update to module_output directory --- source/source_io/module_restart/restart_exx_csr.hpp | 2 +- source/source_io/test/csr_reader_test.cpp | 2 +- .../module_hcontainer/test/test_hcontainer_readCSR.cpp | 2 +- source/source_lcao/module_ri/Exx_LRI_interface.hpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/source_io/module_restart/restart_exx_csr.hpp b/source/source_io/module_restart/restart_exx_csr.hpp index 81c0b9301f..fa373dd6e1 100644 --- a/source/source_io/module_restart/restart_exx_csr.hpp +++ b/source/source_io/module_restart/restart_exx_csr.hpp @@ -1,7 +1,7 @@ #pragma once #include "restart_exx_csr.h" #include "source_cell/unitcell.h" -#include "source_io/csr_reader.h" +#include "source_io/module_output/csr_reader.h" #include "source_io/module_hs/write_HS_sparse.h" #include "source_lcao/module_ri/serialization_cereal.h" #include diff --git a/source/source_io/test/csr_reader_test.cpp b/source/source_io/test/csr_reader_test.cpp index e42ad335c7..75d53a3ce8 100644 --- a/source/source_io/test/csr_reader_test.cpp +++ b/source/source_io/test/csr_reader_test.cpp @@ -1,4 +1,4 @@ -#include "source_io/csr_reader.h" +#include "source_io/module_output/csr_reader.h" #include "gmock/gmock.h" #include "gtest/gtest.h" diff --git a/source/source_lcao/module_hcontainer/test/test_hcontainer_readCSR.cpp b/source/source_lcao/module_hcontainer/test/test_hcontainer_readCSR.cpp index c75df807ac..3ce249e025 100644 --- a/source/source_lcao/module_hcontainer/test/test_hcontainer_readCSR.cpp +++ b/source/source_lcao/module_hcontainer/test/test_hcontainer_readCSR.cpp @@ -1,6 +1,6 @@ #include "../hcontainer.h" #include "../output_hcontainer.h" -#include "source_io/csr_reader.h" +#include "source_io/module_output/csr_reader.h" #include "prepare_unitcell.h" #include "gmock/gmock.h" diff --git a/source/source_lcao/module_ri/Exx_LRI_interface.hpp b/source/source_lcao/module_ri/Exx_LRI_interface.hpp index c3c6268789..5272cb7b10 100644 --- a/source/source_lcao/module_ri/Exx_LRI_interface.hpp +++ b/source/source_lcao/module_ri/Exx_LRI_interface.hpp @@ -8,7 +8,7 @@ #include "source_base/parallel_common.h" #include "source_base/formatter.h" -#include "source_io/csr_reader.h" +#include "source_io/module_output/csr_reader.h" #include "source_io/module_hs/write_HS_sparse.h" #include "source_estate/elecstate_lcao.h" #include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info From 92afac809cc63bfe4d2cb0a48049ad4d2f8ce9ba Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 8 Feb 2026 10:03:40 +0800 Subject: [PATCH 09/32] fix bugs related to libxc --- source/source_io/module_chgpot/write_libxc_r.cpp | 4 ++-- source/source_io/module_ctrl/ctrl_output_fp.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/source_io/module_chgpot/write_libxc_r.cpp b/source/source_io/module_chgpot/write_libxc_r.cpp index 744f9f736a..c9465d0bcc 100644 --- a/source/source_io/module_chgpot/write_libxc_r.cpp +++ b/source/source_io/module_chgpot/write_libxc_r.cpp @@ -11,7 +11,7 @@ #include "source_estate/module_charge/charge.h" #include "source_basis/module_pw/pw_basis_big.h" #include "source_basis/module_pw/pw_basis.h" -#include "source_io/cube_io.h" +#include "source_io/module_ouptut/cube_io.h" #include "source_base/global_variable.h" #include "source_io/module_parameter/parameter.h" #include "source_base/timer.h" @@ -445,4 +445,4 @@ void ModuleIO::write_cube_core( #endif // #ifdef __MPI -#endif // USE_LIBXC \ No newline at end of file +#endif // USE_LIBXC diff --git a/source/source_io/module_ctrl/ctrl_output_fp.cpp b/source/source_io/module_ctrl/ctrl_output_fp.cpp index 19adef14b5..7b5a41408e 100644 --- a/source/source_io/module_ctrl/ctrl_output_fp.cpp +++ b/source/source_io/module_ctrl/ctrl_output_fp.cpp @@ -7,7 +7,7 @@ #include "source_io/module_elf/write_elf.h" #ifdef USE_LIBXC -#include "source_io/write_libxc_r.h" +#include "source_io/module_chgpot/write_libxc_r.h" #endif namespace ModuleIO From 03983eb2edf846991dcd36d19ccedb8630b0181c Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 8 Feb 2026 10:04:18 +0800 Subject: [PATCH 10/32] fix --- source/source_io/module_chgpot/write_libxc_r.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/source_io/module_chgpot/write_libxc_r.cpp b/source/source_io/module_chgpot/write_libxc_r.cpp index c9465d0bcc..9de370190b 100644 --- a/source/source_io/module_chgpot/write_libxc_r.cpp +++ b/source/source_io/module_chgpot/write_libxc_r.cpp @@ -11,7 +11,7 @@ #include "source_estate/module_charge/charge.h" #include "source_basis/module_pw/pw_basis_big.h" #include "source_basis/module_pw/pw_basis.h" -#include "source_io/module_ouptut/cube_io.h" +#include "source_io/module_output/cube_io.h" #include "source_base/global_variable.h" #include "source_io/module_parameter/parameter.h" #include "source_base/timer.h" From 0da1a53cce4b990f25c6896a594f9eca7c5acab2 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 8 Feb 2026 10:29:18 +0800 Subject: [PATCH 11/32] fix --- .../source_io/module_chgpot/write_libxc_r.cpp | 944 +++++++++--------- 1 file changed, 496 insertions(+), 448 deletions(-) diff --git a/source/source_io/module_chgpot/write_libxc_r.cpp b/source/source_io/module_chgpot/write_libxc_r.cpp index 9de370190b..e2a246bacf 100644 --- a/source/source_io/module_chgpot/write_libxc_r.cpp +++ b/source/source_io/module_chgpot/write_libxc_r.cpp @@ -1,448 +1,496 @@ -//====================== -// AUTHOR : Peize Lin -// DATE : 2024-09-12 -//====================== - -#ifdef USE_LIBXC - -#include "write_libxc_r.h" -#include "source_hamilt/module_xc/xc_functional.h" -#include "source_hamilt/module_xc/xc_functional_libxc.h" -#include "source_estate/module_charge/charge.h" -#include "source_basis/module_pw/pw_basis_big.h" -#include "source_basis/module_pw/pw_basis.h" -#include "source_io/module_output/cube_io.h" -#include "source_base/global_variable.h" -#include "source_io/module_parameter/parameter.h" -#include "source_base/timer.h" -#include "source_base/tool_title.h" - -#include -#include -#include -#include -#include - -void ModuleIO::write_libxc_r( - const int order, - const std::vector &func_id, - const int &nrxx, // number of real-space grid - const double &omega, // volume of cell - const double tpiba, - const Charge &chr, - const ModulePW::PW_Basis_Big &pw_big, - const ModulePW::PW_Basis &pw_rhod) -{ - ModuleBase::TITLE("ModuleIO","write_libxc_r"); - ModuleBase::timer::tick("ModuleIO","write_libxc_r"); - - const int nspin = - (PARAM.inp.nspin == 1 || ( PARAM.inp.nspin ==4 && !PARAM.globalv.domag && !PARAM.globalv.domag_z)) - ? 1 : 2; - - //---------------------------------------------------------- - // xc_func_type is defined in Libxc package - // to understand the usage of xc_func_type, - // use can check on website, for example: - // https://www.tddft.org/programs/libxc/manual/libxc-5.1.x/ - //---------------------------------------------------------- - - std::vector funcs = XC_Functional_Libxc::init_func( func_id, (1==nspin) ? XC_UNPOLARIZED:XC_POLARIZED ); - - const bool is_gga = [&funcs]() - { - for( xc_func_type &func : funcs ) - { - switch( func.info->family ) - { - case XC_FAMILY_GGA: - case XC_FAMILY_HYB_GGA: - return true; - } - } - return false; - }(); - - // converting rho - std::vector rho; - std::vector amag; - if(1==nspin || 2==PARAM.inp.nspin) - { - rho = XC_Functional_Libxc::convert_rho(nspin, nrxx, &chr); - } - else - { - std::tuple,std::vector> rho_amag = XC_Functional_Libxc::convert_rho_amag_nspin4(nspin, nrxx, &chr); - rho = std::get<0>(std::move(rho_amag)); - amag = std::get<1>(std::move(rho_amag)); - } - - std::vector sigma; - if(is_gga) - { - const std::vector>> gdr = XC_Functional_Libxc::cal_gdr(nspin, nrxx, rho, tpiba, &chr); - sigma = XC_Functional_Libxc::convert_sigma(gdr); - } - - std::vector exc; - std::vector vrho; - std::vector vsigma; - std::vector v2rho2; - std::vector v2rhosigma; - std::vector v2sigma2; - std::vector v3rho3; - std::vector v3rho2sigma; - std::vector v3rhosigma2; - std::vector v3sigma3; - std::vector v4rho4; - std::vector v4rho3sigma; - std::vector v4rho2sigma2; - std::vector v4rhosigma3; - std::vector v4sigma4; - // attention: order 4321 don't break - switch( order ) - { - case 4: v4rho4.resize( nrxx * ((1==nspin)?1:5) ); - case 3: v3rho3.resize( nrxx * ((1==nspin)?1:4) ); - case 2: v2rho2.resize( nrxx * ((1==nspin)?1:3) ); - case 1: vrho .resize( nrxx * nspin ); - case 0: exc .resize( nrxx ); - break; - default: throw std::domain_error("order ="+std::to_string(order) - +" unfinished in "+std::string(__FILE__)+" line "+std::to_string(__LINE__)); - break; - } - if(is_gga) - { - switch( order ) - { - case 4: v4rho3sigma .resize( nrxx * ((1==nspin)?1:12) ); - v4rho2sigma2.resize( nrxx * ((1==nspin)?1:15) ); - v4rhosigma3 .resize( nrxx * ((1==nspin)?1:20) ); - v4sigma4 .resize( nrxx * ((1==nspin)?1:15) ); - case 3: v3rho2sigma .resize( nrxx * ((1==nspin)?1:9) ); - v3rhosigma2 .resize( nrxx * ((1==nspin)?1:12) ); - v3sigma3 .resize( nrxx * ((1==nspin)?1:10) ); - case 2: v2rhosigma .resize( nrxx * ((1==nspin)?1:6) ); - v2sigma2 .resize( nrxx * ((1==nspin)?1:6) ); - case 1: vsigma .resize( nrxx * ((1==nspin)?1:3) ); - case 0: break; - default: throw std::domain_error("order ="+std::to_string(order) - +" unfinished in "+std::string(__FILE__)+" line "+std::to_string(__LINE__)); - break; - } - } - - for( xc_func_type &func : funcs ) - { - // jiyy add for threshold - constexpr double rho_threshold = 1E-6; - constexpr double grho_threshold = 1E-10; - - xc_func_set_dens_threshold(&func, rho_threshold); - - // sgn for threshold mask - const std::vector sgn = XC_Functional_Libxc::cal_sgn(rho_threshold, grho_threshold, func, nspin, nrxx, rho, sigma); - - // call libxc function - // attention: order 432 don't break - switch( func.info->family ) - { - case XC_FAMILY_LDA: - { - switch( order ) - { - case 4: xc_lda_lxc ( &func, nrxx, rho.data(), v4rho4.data() ); - case 3: xc_lda_kxc ( &func, nrxx, rho.data(), v3rho3.data() ); - case 2: xc_lda_fxc ( &func, nrxx, rho.data(), v2rho2.data() ); - case 1: xc_lda_exc_vxc( &func, nrxx, rho.data(), exc.data(), vrho.data() ); - break; - case 0: xc_lda_exc ( &func, nrxx, rho.data(), exc.data() ); - break; - default: throw std::domain_error("order ="+std::to_string(order) - +" unfinished in "+std::string(__FILE__)+" line "+std::to_string(__LINE__)); - break; - } - break; - } - case XC_FAMILY_GGA: - case XC_FAMILY_HYB_GGA: - { - switch( order ) - { - case 4: xc_gga_lxc ( &func, nrxx, rho.data(), sigma.data(), v4rho4.data(), v4rho3sigma.data(), v4rho2sigma2.data(), v4rhosigma3.data(), v4sigma4.data() ); - case 3: xc_gga_kxc ( &func, nrxx, rho.data(), sigma.data(), v3rho3.data(), v3rho2sigma.data(), v3rhosigma2.data(), v3sigma3.data() ); - case 2: xc_gga_fxc ( &func, nrxx, rho.data(), sigma.data(), v2rho2.data(), v2rhosigma.data(), v2sigma2.data() ); - case 1: xc_gga_exc_vxc( &func, nrxx, rho.data(), sigma.data(), exc.data(), vrho.data(), vsigma.data() ); - break; - case 0: xc_gga_exc ( &func, nrxx, rho.data(), sigma.data(), exc.data() ); - break; - default: throw std::domain_error("order ="+std::to_string(order) - +" unfinished in "+std::string(__FILE__)+" line "+std::to_string(__LINE__)); - break; - } - break; - } - default: - { - throw std::domain_error("func.info->family ="+std::to_string(func.info->family) - +" unfinished in "+std::string(__FILE__)+" line "+std::to_string(__LINE__)); - break; - } - } // end switch( func.info->family ) - } // end for( xc_func_type &func : funcs ) - - auto write_data = [&pw_big, &pw_rhod]( - const std::string data_name, - const std::vector &data, - const int number_spin) - { - for(int is=0; is data_cube(nxyz, 0.0); - - // num_z: how many planes on processor 'ip' - std::vector num_z(nproc_in_pool, 0); - for (int iz = 0; iz < nbz; iz++) - { - const int ip = iz % nproc_in_pool; - num_z[ip] += bz; - } - - // start_z: start position of z in - // processor ip. - std::vector start_z(nproc_in_pool, 0); - for (int ip = 1; ip < nproc_in_pool; ip++) - { - start_z[ip] = start_z[ip - 1] + num_z[ip - 1]; - } - - // which_ip: found iz belongs to which ip. - std::vector which_ip(nz, 0); - for (int iz = 0; iz < nz; iz++) - { - for (int ip = 0; ip < nproc_in_pool; ip++) - { - if (iz >= start_z[nproc_in_pool - 1]) - { - which_ip[iz] = nproc_in_pool - 1; - break; - } - else if (iz >= start_z[ip] && iz < start_z[ip + 1]) - { - which_ip[iz] = ip; - break; - } - } - } - - int count = 0; - std::vector zpiece(nxy, 0.0); - - // save the rho one z by one z. - for (int iz = 0; iz < nz; iz++) - { - zpiece.assign(nxy, 0.0); - - // tag must be different for different iz. - const int tag = iz; - MPI_Status ierror; - - // case 1: the first part of rho in processor 0. - if (which_ip[iz] == 0 && rank_in_pool == 0) - { - for (int ixy = 0; ixy < nxy; ixy++) - { - // mohan change to rho_save on 2012-02-10 - // because this can make our next restart calculation lead - // to the same scf_thr as the one saved. - zpiece[ixy] = data[ixy * nplane + (iz - startz_current) * nld]; - } - } - // case 2: > first part rho: send the rho to - // processor 0. - else if (which_ip[iz] == rank_in_pool) - { - for (int ixy = 0; ixy < nxy; ixy++) - { - zpiece[ixy] = data[ixy * nplane + (iz - startz_current) * nld]; - } - MPI_Send(zpiece.data(), nxy, MPI_DOUBLE, 0, tag, POOL_WORLD); - } - - // case 2: > first part rho: processor 0 receive the rho - // from other processors - else if (rank_in_pool == 0) - { - MPI_Recv(zpiece.data(), nxy, MPI_DOUBLE, which_ip[iz], tag, POOL_WORLD, &ierror); - } - - if (my_rank == 0) - { - /// for cube file - for (int ixy = 0; ixy < nxy; ixy++) - { - data_cube[ixy * nz + iz] = zpiece[ixy]; - } - /// for cube file - } - } // end iz - - // for cube file - if (my_rank == 0) - { - for (int ixy = 0; ixy < nxy; ixy++) - { - for (int iz = 0; iz < nz; iz++) - { - ofs_cube << " " << data_cube[ixy * nz + iz]; - if ((iz % n_data_newline == n_data_newline-1) && (iz != nz - 1)) - { - ofs_cube << "\n"; - } - } - ofs_cube << "\n"; - } - } - /// for cube file - } - MPI_Barrier(MPI_COMM_WORLD); -} - -#else // #ifdef __MPI - -void ModuleIO::write_cube_core( - std::ofstream &ofs_cube, - const double*const data, - const int nxy, - const int nz, - const int n_data_newline) -{ - ModuleBase::TITLE("ModuleIO", "write_cube_core"); - for (int ixy = 0; ixy < nxy; ixy++) - { - for (int iz = 0; iz < nz; iz++) - { - ofs_cube << " " << data[iz * nxy + ixy]; - // ++count_cube; - if ((iz % n_data_newline == n_data_newline-1) && (iz != nz - 1)) - { - ofs_cube << "\n"; - } - } - ofs_cube << "\n"; - } -} - -#endif // #ifdef __MPI - -#endif // USE_LIBXC +//====================== +// AUTHOR : Peize Lin +// DATE : 2024-09-12 +//====================== + +#ifdef USE_LIBXC + +#include "write_libxc_r.h" +#include "source_hamilt/module_xc/xc_functional.h" +#include "source_hamilt/module_xc/xc_functional_libxc.h" +#include "source_estate/module_charge/charge.h" +#include "source_basis/module_pw/pw_basis_big.h" +#include "source_basis/module_pw/pw_basis.h" +#include "source_io/module_output/cube_io.h" +#include "source_base/global_variable.h" +#include "source_io/module_parameter/parameter.h" +#include "source_base/timer.h" +#include "source_base/tool_title.h" + +#include +#include +#include +#include +#include + +void ModuleIO::write_libxc_r( + const int order, + const std::vector &func_id, + const int &nrxx, // number of real-space grid + const double &omega, // volume of cell + const double tpiba, + const Charge &chr, + const ModulePW::PW_Basis_Big &pw_big, + const ModulePW::PW_Basis &pw_rhod) +{ + ModuleBase::TITLE("ModuleIO","write_libxc_r"); + ModuleBase::timer::tick("ModuleIO","write_libxc_r"); + + const int nspin = + (PARAM.inp.nspin == 1 || ( + PARAM.inp.nspin ==4 && !PARAM.globalv.domag + && !PARAM.globalv.domag_z)) + ? 1 : 2; + + //---------------------------------------------------------- + // xc_func_type is defined in Libxc package + // to understand the usage of xc_func_type, + // use can check on website, for example: + // https://www.tddft.org/programs/libxc/manual/libxc-5.1.x/ + //---------------------------------------------------------- + + std::vector funcs = + XC_Functional_Libxc::init_func( + func_id, + (1==nspin) ? XC_UNPOLARIZED : XC_POLARIZED + ); + + const bool is_gga = [&funcs]() + { + for( xc_func_type &func : funcs ) + { + switch( func.info->family ) + { + case XC_FAMILY_GGA: + case XC_FAMILY_HYB_GGA: + return true; + } + } + return false; + }(); + + // converting rho + std::vector rho; + std::vector amag; + if(1==nspin || 2==PARAM.inp.nspin) + { + rho = XC_Functional_Libxc::convert_rho(nspin, nrxx, &chr); + } + else + { + std::tuple, std::vector> rho_amag = + XC_Functional_Libxc::convert_rho_amag_nspin4(nspin, nrxx, &chr); + rho = std::get<0>(std::move(rho_amag)); + amag = std::get<1>(std::move(rho_amag)); + } + + std::vector sigma; + if(is_gga) + { + const std::vector>> gdr = + XC_Functional_Libxc::cal_gdr(nspin, nrxx, rho, tpiba, &chr); + sigma = XC_Functional_Libxc::convert_sigma(gdr); + } + + std::vector exc; + std::vector vrho; + std::vector vsigma; + std::vector v2rho2; + std::vector v2rhosigma; + std::vector v2sigma2; + std::vector v3rho3; + std::vector v3rho2sigma; + std::vector v3rhosigma2; + std::vector v3sigma3; + std::vector v4rho4; + std::vector v4rho3sigma; + std::vector v4rho2sigma2; + std::vector v4rhosigma3; + std::vector v4sigma4; + // attention: order 4321 don't break + switch( order ) + { + case 4: v4rho4.resize( nrxx * ((1==nspin)?1:5) ); + case 3: v3rho3.resize( nrxx * ((1==nspin)?1:4) ); + case 2: v2rho2.resize( nrxx * ((1==nspin)?1:3) ); + case 1: vrho .resize( nrxx * nspin ); + case 0: exc .resize( nrxx ); + break; + default: throw std::domain_error( + "order =" + std::to_string(order) + + " unfinished in " + std::string(__FILE__) + + " line " + std::to_string(__LINE__)); + break; + } + if(is_gga) + { + switch( order ) + { + case 4: v4rho3sigma .resize( nrxx * ((1==nspin)?1:12) ); + v4rho2sigma2.resize( nrxx * ((1==nspin)?1:15) ); + v4rhosigma3 .resize( nrxx * ((1==nspin)?1:20) ); + v4sigma4 .resize( nrxx * ((1==nspin)?1:15) ); + case 3: v3rho2sigma .resize( nrxx * ((1==nspin)?1:9) ); + v3rhosigma2 .resize( nrxx * ((1==nspin)?1:12) ); + v3sigma3 .resize( nrxx * ((1==nspin)?1:10) ); + case 2: v2rhosigma .resize( nrxx * ((1==nspin)?1:6) ); + v2sigma2 .resize( nrxx * ((1==nspin)?1:6) ); + case 1: vsigma .resize( nrxx * ((1==nspin)?1:3) ); + case 0: break; + default: throw std::domain_error( + "order =" + std::to_string(order) + + " unfinished in " + std::string(__FILE__) + + " line " + std::to_string(__LINE__)); + break; + } + } + + for( xc_func_type &func : funcs ) + { + // jiyy add for threshold + constexpr double rho_threshold = 1E-6; + constexpr double grho_threshold = 1E-10; + + xc_func_set_dens_threshold(&func, rho_threshold); + + // sgn for threshold mask + const std::vector sgn = + XC_Functional_Libxc::cal_sgn( + rho_threshold, grho_threshold, func, nspin, nrxx, rho, sigma); + + // call libxc function + // attention: order 432 don't break + switch( func.info->family ) + { + case XC_FAMILY_LDA: + { + switch( order ) + { + case 4: xc_lda_lxc ( &func, nrxx, rho.data(), v4rho4.data() ); + case 3: xc_lda_kxc ( &func, nrxx, rho.data(), v3rho3.data() ); + case 2: xc_lda_fxc ( &func, nrxx, rho.data(), v2rho2.data() ); + case 1: xc_lda_exc_vxc( &func, nrxx, rho.data(), exc.data(), vrho.data() ); + break; + case 0: xc_lda_exc ( &func, nrxx, rho.data(), exc.data() ); + break; + default: throw std::domain_error( + "order =" + std::to_string(order) + + " unfinished in " + std::string(__FILE__) + + " line " + std::to_string(__LINE__)); + break; + } + break; + } + case XC_FAMILY_GGA: + case XC_FAMILY_HYB_GGA: + { + switch( order ) + { + case 4: xc_gga_lxc ( + &func, nrxx, rho.data(), sigma.data(), + v4rho4.data(), v4rho3sigma.data(), + v4rho2sigma2.data(), v4rhosigma3.data(), + v4sigma4.data() ); + case 3: xc_gga_kxc ( + &func, nrxx, rho.data(), sigma.data(), + v3rho3.data(), v3rho2sigma.data(), + v3rhosigma2.data(), v3sigma3.data() ); + case 2: xc_gga_fxc ( + &func, nrxx, rho.data(), sigma.data(), + v2rho2.data(), v2rhosigma.data(), + v2sigma2.data() ); + case 1: xc_gga_exc_vxc( + &func, nrxx, rho.data(), sigma.data(), + exc.data(), vrho.data(), vsigma.data() ); + break; + case 0: xc_gga_exc ( &func, nrxx, rho.data(), sigma.data(), exc.data() ); + break; + default: throw std::domain_error( + "order =" + std::to_string(order) + + " unfinished in " + std::string(__FILE__) + + " line " + std::to_string(__LINE__)); + break; + } + break; + } + default: + { + throw std::domain_error( + "func.info->family =" + std::to_string(func.info->family) + + " unfinished in " + std::string(__FILE__) + + " line " + std::to_string(__LINE__)); + break; + } + } // end switch( func.info->family ) + } // end for( xc_func_type &func : funcs ) + + auto write_data = [&pw_big, &pw_rhod, nspin]( + const std::string data_name, + const std::vector &data, + const int number_spin) +{ + for(int is=0; is data_cube(nxyz, 0.0); + + // num_z: how many planes on processor 'ip' + std::vector num_z(nproc_in_pool, 0); + for (int iz = 0; iz < nbz; iz++) + { + const int ip = iz % nproc_in_pool; + num_z[ip] += bz; + } + + // start_z: start position of z in + // processor ip. + std::vector start_z(nproc_in_pool, 0); + for (int ip = 1; ip < nproc_in_pool; ip++) + { + start_z[ip] = start_z[ip - 1] + num_z[ip - 1]; + } + + // which_ip: found iz belongs to which ip. + std::vector which_ip(nz, 0); + for (int iz = 0; iz < nz; iz++) + { + for (int ip = 0; ip < nproc_in_pool; ip++) + { + if (iz >= start_z[nproc_in_pool - 1]) + { + which_ip[iz] = nproc_in_pool - 1; + break; + } + else if (iz >= start_z[ip] && iz < start_z[ip + 1]) + { + which_ip[iz] = ip; + break; + } + } + } + + int count = 0; + std::vector zpiece(nxy, 0.0); + + // save the rho one z by one z. + for (int iz = 0; iz < nz; iz++) + { + zpiece.assign(nxy, 0.0); + + // tag must be different for different iz. + const int tag = iz; + MPI_Status ierror; + + // case 1: the first part of rho in processor 0. + if (which_ip[iz] == 0 && rank_in_pool == 0) + { + for (int ixy = 0; ixy < nxy; ixy++) + { + // mohan change to rho_save on 2012-02-10 + // because this can make our next restart calculation lead + // to the same scf_thr as the one saved. + zpiece[ixy] = data[ixy * nplane + (iz - startz_current) * nld]; + } + } + // case 2: > first part rho: send the rho to + // processor 0. + else if (which_ip[iz] == rank_in_pool) + { + for (int ixy = 0; ixy < nxy; ixy++) + { + zpiece[ixy] = data[ixy * nplane + (iz - startz_current) * nld]; + } + MPI_Send(zpiece.data(), nxy, MPI_DOUBLE, 0, tag, POOL_WORLD); + } + + // case 2: > first part rho: processor 0 receive the rho + // from other processors + else if (rank_in_pool == 0) + { + MPI_Recv(zpiece.data(), nxy, MPI_DOUBLE, which_ip[iz], + tag, POOL_WORLD, &ierror); + } + + if (my_rank == 0) + { + /// for cube file + for (int ixy = 0; ixy < nxy; ixy++) + { + data_cube[ixy * nz + iz] = zpiece[ixy]; + } + /// for cube file + } + } // end iz + + // for cube file + if (my_rank == 0) + { + for (int ixy = 0; ixy < nxy; ixy++) + { + for (int iz = 0; iz < nz; iz++) + { + ofs_cube << " " << data_cube[ixy * nz + iz]; + if ((iz % n_data_newline == n_data_newline-1) && (iz != nz - 1)) + { + ofs_cube << "\n"; + } + } + ofs_cube << "\n"; + } + } + /// for cube file + } + MPI_Barrier(MPI_COMM_WORLD); +} + +#else // #ifdef __MPI + +void ModuleIO::write_cube_core( + std::ofstream &ofs_cube, + const double*const data, + const int nxy, + const int nz, + const int n_data_newline) +{ + ModuleBase::TITLE("ModuleIO", "write_cube_core"); + for (int ixy = 0; ixy < nxy; ixy++) + { + for (int iz = 0; iz < nz; iz++) + { + ofs_cube << " " << data[iz * nxy + ixy]; + // ++count_cube; + if ((iz % n_data_newline == n_data_newline-1) && (iz != nz - 1)) + { + ofs_cube << "\n"; + } + } + ofs_cube << "\n"; + } +} + +#endif // #ifdef __MPI + +#endif // USE_LIBXC From f2a83e93ecd2e97302a1c38cfe7a22232ebc4710 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 8 Feb 2026 15:24:32 +0800 Subject: [PATCH 12/32] fix several CMakeLists --- CMakeLists.txt | 33 +++++++++++++----- .../module_nao/test/CMakeLists.txt | 18 +++++----- source/source_esolver/test/CMakeLists.txt | 2 +- source/source_io/test/CMakeLists.txt | 34 +++++++++---------- source/source_io/test_serial/CMakeLists.txt | 2 +- .../module_deepks/test/CMakeLists.txt | 2 +- .../module_hcontainer/test/CMakeLists.txt | 8 ++--- .../module_operator_lcao/test/CMakeLists.txt | 6 ++-- source/source_relax/test/CMakeLists.txt | 4 +-- 9 files changed, 63 insertions(+), 46 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 703fda65a8..7ad905f43d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,16 +129,33 @@ if(NOT ENABLE_MPI) endif() # Different exe files of ABACUS -if(ENABLE_LCAO AND ENABLE_MPI) - set(ABACUS_BIN_NAME abacus) -elseif(NOT ENABLE_LCAO AND ENABLE_MPI) - set(ABACUS_BIN_NAME abacus_pw) -elseif(NOT ENABLE_LCAO AND NOT ENABLE_MPI) - set(ABACUS_BIN_NAME abacus_pw_serial) -elseif(ENABLE_LCAO AND NOT ENABLE_MPI) - set(ABACUS_BIN_NAME abacus_serial) +if(ENABLE_LCAO) + if(USE_CUDA) + if(ENABLE_MPI) + set(ABACUS_BIN_NAME abacus_2g) + endif() + else() + if(ENABLE_MPI) + set(ABACUS_BIN_NAME abacus_2p) + else() + set(ABACUS_BIN_NAME abacus_2s) + endif() + endif() +else() + if(USE_CUDA) + if(ENABLE_MPI) + set(ABACUS_BIN_NAME abacus_1g) + endif() + else() + if(ENABLE_MPI) + set(ABACUS_BIN_NAME abacus_1p) + else() + set(ABACUS_BIN_NAME abacus_1s) + endif() + endif() endif() + # Use DSP hardware if (USE_DSP) set(USE_ELPA OFF) diff --git a/source/source_basis/module_nao/test/CMakeLists.txt b/source/source_basis/module_nao/test/CMakeLists.txt index 6834084ff3..0ac6fab22c 100644 --- a/source/source_basis/module_nao/test/CMakeLists.txt +++ b/source/source_basis/module_nao/test/CMakeLists.txt @@ -29,7 +29,7 @@ AddTest( ../numerical_radial.cpp ../../module_ao/ORB_atomic_lm.cpp ../../module_ao/ORB_atomic.cpp - ../../../source_io/orb_io.cpp + ../../../source_io/module_output/orb_io.cpp LIBS parameter ${math_libs} device base ) @@ -42,7 +42,7 @@ AddTest( ../numerical_radial.cpp ../../module_ao/ORB_atomic_lm.cpp ../../module_ao/ORB_atomic.cpp - ../../../source_io/orb_io.cpp + ../../../source_io/module_output/orb_io.cpp LIBS parameter ${math_libs} device base ) @@ -55,7 +55,7 @@ AddTest( ../numerical_radial.cpp ../../module_ao/ORB_atomic_lm.cpp ../../module_ao/ORB_atomic.cpp - ../../../source_io/orb_io.cpp + ../../../source_io/module_output/orb_io.cpp LIBS parameter ${math_libs} device base ) @@ -68,7 +68,7 @@ AddTest( ../numerical_radial.cpp ../../module_ao/ORB_atomic_lm.cpp ../../module_ao/ORB_atomic.cpp - ../../../source_io/orb_io.cpp + ../../../source_io/module_output/orb_io.cpp LIBS parameter ${math_libs} device base ) @@ -86,7 +86,7 @@ AddTest( ../sphbes_radials.cpp ../../module_ao/ORB_atomic_lm.cpp ../../module_ao/ORB_atomic.cpp - ../../../source_io/orb_io.cpp + ../../../source_io/module_output/orb_io.cpp LIBS parameter ${math_libs} device base ) @@ -106,7 +106,7 @@ AddTest( ../two_center_bundle.cpp ../two_center_integrator.cpp ../real_gaunt_table.cpp - ../../../source_io/orb_io.cpp + ../../../source_io/module_output/orb_io.cpp LIBS parameter ${math_libs} device base container orb ) @@ -135,7 +135,7 @@ AddTest( ../radial_set.cpp ../numerical_radial.cpp ../two_center_bundle.cpp - ../../../source_io/orb_io.cpp + ../../../source_io/module_output/orb_io.cpp LIBS parameter ${math_libs} device base container orb ) @@ -155,7 +155,7 @@ AddTest( ../sphbes_radials.cpp ../radial_set.cpp ../numerical_radial.cpp - ../../../source_io/orb_io.cpp + ../../../source_io/module_output/orb_io.cpp LIBS parameter ${math_libs} device base container orb ) @@ -175,7 +175,7 @@ AddTest( ../sphbes_radials.cpp ../radial_set.cpp ../numerical_radial.cpp - ../../../source_io/orb_io.cpp + ../../../source_io/module_output/orb_io.cpp LIBS parameter ${math_libs} device base container orb ) diff --git a/source/source_esolver/test/CMakeLists.txt b/source/source_esolver/test/CMakeLists.txt index fe51b41275..f297fc7378 100644 --- a/source/source_esolver/test/CMakeLists.txt +++ b/source/source_esolver/test/CMakeLists.txt @@ -6,5 +6,5 @@ install(DIRECTORY support DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) AddTest( TARGET esolver_dp_test LIBS parameter ${math_libs} base device - SOURCES esolver_dp_test.cpp ../esolver_dp.cpp ../../source_io/cif_io.cpp ../../source_io/module_output/output_log.cpp + SOURCES esolver_dp_test.cpp ../esolver_dp.cpp ../../source_io/module_output/cif_io.cpp ../../source_io/module_output/output_log.cpp ) diff --git a/source/source_io/test/CMakeLists.txt b/source/source_io/test/CMakeLists.txt index 006c775af9..0c6130c958 100644 --- a/source/source_io/test/CMakeLists.txt +++ b/source/source_io/test/CMakeLists.txt @@ -20,7 +20,7 @@ add_test(NAME MODULE_IO_input_test_para_4 AddTest( TARGET MODULE_IO_read_exit_file_test LIBS parameter ${math_libs} base device - SOURCES read_exit_file_test.cpp ../read_exit_file.cpp + SOURCES read_exit_file_test.cpp ../module_output/read_exit_file.cpp ) add_test(NAME MODULE_IO_read_exit_file_test_para_4 @@ -36,14 +36,14 @@ AddTest( AddTest( TARGET MODULE_IO_binstream_test - SOURCES binstream_test.cpp ../binstream.cpp + SOURCES binstream_test.cpp ../module_output/binstream.cpp ) AddTest( TARGET MODULE_IO_write_eig_occ_test LIBS parameter ${math_libs} base device symmetry SOURCES write_eig_occ_test.cpp ../module_energy/write_eig_occ.cpp ../module_output/output.cpp ../../source_cell/parallel_kpoints.cpp ../../source_cell/klist.cpp ../../source_cell/k_vector_utils.cpp - ../cif_io.cpp + ../module_output/cif_io.cpp ) AddTest( @@ -55,7 +55,7 @@ AddTest( AddTest( TARGET MODULE_IO_write_dos_pw LIBS parameter ${math_libs} base device symmetry - SOURCES write_dos_pw_test.cpp ../module_dos/cal_dos.cpp ../module_dos/write_dos_pw.cpp ../module_output/output.cpp ../../source_cell/parallel_kpoints.cpp ../../source_cell/klist.cpp ../nscf_fermi_surf.cpp ../../source_cell/k_vector_utils.cpp + SOURCES write_dos_pw_test.cpp ../module_dos/cal_dos.cpp ../module_dos/write_dos_pw.cpp ../module_output/output.cpp ../../source_cell/parallel_kpoints.cpp ../../source_cell/klist.cpp ../module_energy/nscf_fermi_surf.cpp ../../source_cell/k_vector_utils.cpp ) AddTest( @@ -67,8 +67,8 @@ AddTest( AddTest( TARGET MODULE_IO_single_R_test LIBS parameter ${math_libs} - SOURCES single_R_io_test.cpp ../single_R_io.cpp - ../../source_base/global_variable.cpp + SOURCES single_R_io_test.cpp ../module_hs/single_R_io.cpp + ../../source_base/global_variable.cpp ../../source_base/parallel_reduce.cpp ../../source_base/parallel_common.cpp ../../source_base/parallel_global.cpp @@ -92,7 +92,7 @@ add_test(NAME MODULE_IO_write_wfc_nao_para AddTest( TARGET MODULE_IO_write_orb_info LIBS parameter ${math_libs} base device cell_info - SOURCES write_orb_info_test.cpp ../write_orb_info.cpp ../module_output/output.cpp + SOURCES write_orb_info_test.cpp ../module_output/write_orb_info.cpp ../module_output/output.cpp ) AddTest( @@ -116,25 +116,25 @@ AddTest( AddTest( TARGET MODULE_IO_sparse_matrix_test LIBS parameter base ${math_libs} device - SOURCES sparse_matrix_test.cpp ../sparse_matrix.cpp + SOURCES sparse_matrix_test.cpp ../module_output/sparse_matrix.cpp ) AddTest( TARGET MODULE_IO_file_reader_test LIBS parameter base ${math_libs} device - SOURCES file_reader_test.cpp ../file_reader.cpp + SOURCES file_reader_test.cpp ../module_output/file_reader.cpp ) AddTest( TARGET MODULE_IO_csr_reader_test LIBS parameter base ${math_libs} device - SOURCES csr_reader_test.cpp ../csr_reader.cpp ../file_reader.cpp ../sparse_matrix.cpp + SOURCES csr_reader_test.cpp ../module_output/csr_reader.cpp ../module_output/file_reader.cpp ../module_output/sparse_matrix.cpp ) AddTest( TARGET MODULE_IO_read_rhog_test LIBS parameter ${math_libs} base device planewave - SOURCES read_rhog_test.cpp ../module_chgpot/rhog_io.cpp ../binstream.cpp ../../source_basis/module_pw/test/test_tool.cpp + SOURCES read_rhog_test.cpp ../module_chgpot/rhog_io.cpp ../module_output/binstream.cpp ../../source_basis/module_pw/test/test_tool.cpp ) if(ENABLE_LCAO) @@ -150,7 +150,7 @@ AddTest( ../../source_cell/parallel_kpoints.cpp ../../source_cell/test/support/mock_unitcell.cpp ../../source_lcao/center2_orb.cpp - ../orb_io.cpp + ../module_output/orb_io.cpp ) endif() @@ -183,7 +183,7 @@ AddTest( SOURCES numerical_basis_test.cpp ../module_bessel/numerical_basis_jyjy.cpp ../../source_lcao/center2_orb.cpp - ../orb_io.cpp + ../module_output/orb_io.cpp ) @@ -193,7 +193,7 @@ AddTest( SOURCES output_mulliken_test.cpp output_mulliken_mock.cpp ../module_mulliken/output_mulliken.cpp ../../source_cell/cell_index.cpp ../../source_basis/module_ao/parallel_orbitals.cpp - ../orb_io.cpp + ../module_output/orb_io.cpp ) #if(ENABLE_LCAO) @@ -213,7 +213,7 @@ AddTest( AddTest( TARGET MODULE_IO_cif_io_test LIBS parameter base ${math_libs} device - SOURCES cif_io_test.cpp ../cif_io.cpp + SOURCES cif_io_test.cpp ../module_output/cif_io.cpp ) add_test(NAME MODULE_IO_cif_io_test_parallel @@ -224,7 +224,7 @@ add_test(NAME MODULE_IO_cif_io_test_parallel AddTest( TARGET MODULE_IO_orb_io_test LIBS parameter base ${math_libs} device - SOURCES orb_io_test.cpp ../orb_io.cpp + SOURCES orb_io_test.cpp ../module_output/orb_io.cpp ) add_test(NAME MODULE_IO_orb_io_test_parallel @@ -262,7 +262,7 @@ AddTest( LIBS parameter base ${math_libs} device neighbor SOURCES cal_pLpR_test.cpp - ../cal_pLpR.cpp + ../module_hs/cal_pLpR.cpp ../../source_basis/module_ao/ORB_atomic_lm.cpp ../../source_basis/module_ao/ORB_atomic.cpp ../../source_basis/module_nao/radial_set.cpp diff --git a/source/source_io/test_serial/CMakeLists.txt b/source/source_io/test_serial/CMakeLists.txt index 24c614067a..838377d9b8 100644 --- a/source/source_io/test_serial/CMakeLists.txt +++ b/source/source_io/test_serial/CMakeLists.txt @@ -47,7 +47,7 @@ AddTest( AddTest( TARGET MODULE_IO_rho_io LIBS parameter ${math_libs} base device cell_info - SOURCES rho_io_test.cpp ../read_cube.cpp ../write_cube.cpp ../module_output/output.cpp + SOURCES rho_io_test.cpp ../module_output/read_cube.cpp ../module_output/write_cube.cpp ../module_output/output.cpp ) AddTest( diff --git a/source/source_lcao/module_deepks/test/CMakeLists.txt b/source/source_lcao/module_deepks/test/CMakeLists.txt index 308889c5f0..2a1dae6e6d 100644 --- a/source/source_lcao/module_deepks/test/CMakeLists.txt +++ b/source/source_lcao/module_deepks/test/CMakeLists.txt @@ -23,7 +23,7 @@ add_executable( ../../../source_cell/sep_cell.cpp ../../../source_pw/module_pwdft/soc.cpp ../../../source_io/module_output/output.cpp - ../../../source_io/sparse_matrix.cpp + ../../../source_io/module_output/sparse_matrix.cpp ../../../source_estate/read_pseudo.cpp ../../../source_estate/cal_wfc.cpp ../../../source_estate/read_orb.cpp diff --git a/source/source_lcao/module_hcontainer/test/CMakeLists.txt b/source/source_lcao/module_hcontainer/test/CMakeLists.txt index bb4733323c..980f65e3b2 100644 --- a/source/source_lcao/module_hcontainer/test/CMakeLists.txt +++ b/source/source_lcao/module_hcontainer/test/CMakeLists.txt @@ -52,7 +52,7 @@ AddTest( ../hcontainer.cpp ../atom_pair.cpp ../../../source_basis/module_ao/parallel_orbitals.cpp - ../../../source_io/sparse_matrix.cpp + ../../../source_io/module_output/sparse_matrix.cpp ) install(DIRECTORY support DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) @@ -66,9 +66,9 @@ AddTest( ../atom_pair.cpp ../output_hcontainer.cpp ../../../source_basis/module_ao/parallel_orbitals.cpp - ../../../source_io/sparse_matrix.cpp - ../../../source_io/csr_reader.cpp - ../../../source_io/file_reader.cpp + ../../../source_io/module_output/sparse_matrix.cpp + ../../../source_io/module_output/csr_reader.cpp + ../../../source_io/module_output/file_reader.cpp ../../../source_io/module_output/output.cpp ) endif() \ No newline at end of file diff --git a/source/source_lcao/module_operator_lcao/test/CMakeLists.txt b/source/source_lcao/module_operator_lcao/test/CMakeLists.txt index 53f6096289..39df2b9b90 100644 --- a/source/source_lcao/module_operator_lcao/test/CMakeLists.txt +++ b/source/source_lcao/module_operator_lcao/test/CMakeLists.txt @@ -7,7 +7,7 @@ AddTest( SOURCES test_overlap.cpp ../overlap.cpp ../operator_force_stress_utils.cpp ../../module_hcontainer/func_folding.cpp ../../module_hcontainer/base_matrix.cpp ../../module_hcontainer/hcontainer.cpp ../../module_hcontainer/atom_pair.cpp ../../module_hcontainer/func_transfer.cpp ../../module_hcontainer/output_hcontainer.cpp ../../module_hcontainer/transfer.cpp - ../../../source_io/sparse_matrix.cpp + ../../../source_io/module_output/sparse_matrix.cpp ../../../source_basis/module_ao/parallel_orbitals.cpp ../../../source_basis/module_ao/ORB_atomic_lm.cpp tmp_mocks.cpp ../../../source_hamilt/operator.cpp @@ -20,7 +20,7 @@ AddTest( SOURCES test_overlap_serial.cpp ../overlap.cpp ../operator_force_stress_utils.cpp ../../module_hcontainer/func_folding.cpp ../../module_hcontainer/base_matrix.cpp ../../module_hcontainer/hcontainer.cpp ../../module_hcontainer/atom_pair.cpp ../../module_hcontainer/func_transfer.cpp ../../module_hcontainer/output_hcontainer.cpp ../../module_hcontainer/transfer.cpp - ../../../source_io/sparse_matrix.cpp + ../../../source_io/module_output/sparse_matrix.cpp ../../../source_basis/module_ao/parallel_orbitals.cpp ../../../source_basis/module_ao/ORB_atomic_lm.cpp tmp_mocks.cpp ../../../source_hamilt/operator.cpp @@ -33,7 +33,7 @@ AddTest( SOURCES test_overlap_cd.cpp ../overlap.cpp ../operator_force_stress_utils.cpp ../../module_hcontainer/func_folding.cpp ../../module_hcontainer/base_matrix.cpp ../../module_hcontainer/hcontainer.cpp ../../module_hcontainer/atom_pair.cpp ../../module_hcontainer/func_transfer.cpp ../../module_hcontainer/output_hcontainer.cpp ../../module_hcontainer/transfer.cpp - ../../../source_io/sparse_matrix.cpp + ../../../source_io/module_output/sparse_matrix.cpp ../../../source_basis/module_ao/parallel_orbitals.cpp ../../../source_basis/module_ao/ORB_atomic_lm.cpp tmp_mocks.cpp ../../../source_hamilt/operator.cpp diff --git a/source/source_relax/test/CMakeLists.txt b/source/source_relax/test/CMakeLists.txt index 52a20a8ccf..c3e0d235a8 100644 --- a/source/source_relax/test/CMakeLists.txt +++ b/source/source_relax/test/CMakeLists.txt @@ -77,7 +77,7 @@ AddTest( ../ions_move_bfgs.cpp ../ions_move_basic.cpp ../bfgs_basic.cpp - ../../source_io/orb_io.cpp + ../../source_io/module_output/orb_io.cpp ${cell_source_files} ) @@ -87,7 +87,7 @@ AddTest( SOURCES ions_move_cg_test.cpp ../ions_move_cg.cpp ../ions_move_basic.cpp - ../../source_io/orb_io.cpp + ../../source_io/module_output/orb_io.cpp ${cell_source_files} ) From e256f0c3ed18aa3919376ea5158fc3523176aeec Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 8 Feb 2026 15:57:47 +0800 Subject: [PATCH 13/32] update CMake and other test files --- CMakeLists.txt | 48 +++++++++++++++---- source/source_io/test/binstream_test.cpp | 2 +- source/source_io/test/cal_pLpR_test.cpp | 2 +- source/source_io/test/cif_io_test.cpp | 2 +- source/source_io/test/file_reader_test.cpp | 2 +- source/source_io/test/orb_io_test.cpp | 2 +- source/source_io/test/read_exit_file_test.cpp | 2 +- source/source_io/test/single_R_io_test.cpp | 2 +- source/source_io/test/sparse_matrix_test.cpp | 2 +- source/source_io/test/write_orb_info_test.cpp | 2 +- source/source_io/test_serial/rho_io_test.cpp | 4 +- 11 files changed, 49 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ad905f43d..f479b527ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,18 +129,46 @@ if(NOT ENABLE_MPI) endif() # Different exe files of ABACUS +unset(ABACUS_BIN_NAME CACHE) + +# Case : LCAO or PW if(ENABLE_LCAO) + # Case: CUDA is enabled (suffix with 'g' for GPU) if(USE_CUDA) if(ENABLE_MPI) - set(ABACUS_BIN_NAME abacus_2g) + if(NOT ENABLE_LIBRI AND NOT ENABLE_MLALGO) + set(ABACUS_BIN_NAME abacus_2g) + elseif(ENABLE_LIBRI AND NOT ENABLE_MLALGO) + set(ABACUS_BIN_NAME abacus_3g) + elseif(NOT ENABLE_LIBRI AND ENABLE_MLALGO) + set(ABACUS_BIN_NAME abacus_4g) + elseif(ENABLE_LIBRI AND ENABLE_MLALGO) + set(ABACUS_BIN_NAME abacus_5g) + endif() endif() + # Case: CPU is enabled (suffix with 'p' for parallel) else() if(ENABLE_MPI) - set(ABACUS_BIN_NAME abacus_2p) + if(NOT ENABLE_LIBRI AND NOT ENABLE_MLALGO) + set(ABACUS_BIN_NAME abacus_2p) + elseif(ENABLE_LIBRI AND NOT ENABLE_MLALGO) + set(ABACUS_BIN_NAME abacus_3p) + elseif(NOT ENABLE_LIBRI AND ENABLE_MLALGO) + set(ABACUS_BIN_NAME abacus_4p) + elseif(ENABLE_LIBRI AND ENABLE_MLALGO) + set(ABACUS_BIN_NAME abacus_5p) else() - set(ABACUS_BIN_NAME abacus_2s) + if(NOT ENABLE_LIBRI AND NOT ENABLE_MLALGO) + set(ABACUS_BIN_NAME abacus_2s) + elseif(ENABLE_LIBRI AND NOT ENABLE_MLALGO) + set(ABACUS_BIN_NAME abacus_3s) + elseif(NOT ENABLE_LIBRI AND ENABLE_MLALGO) + set(ABACUS_BIN_NAME abacus_4s) + elseif(ENABLE_LIBRI AND ENABLE_MLALGO) + set(ABACUS_BIN_NAME abacus_5s) endif() endif() +# Case : PW only else() if(USE_CUDA) if(ENABLE_MPI) @@ -505,12 +533,12 @@ elseif(NOT USE_SW) find_package(Lapack REQUIRED) include_directories(${FFTW3_INCLUDE_DIRS}) list(APPEND math_libs FFTW3::FFTW3 LAPACK::LAPACK BLAS::BLAS) -if(USE_DSP) - target_link_libraries(${ABACUS_BIN_NAME} ${SCALAPACK_LIBRARY_DIR}) -else() - find_package(ScaLAPACK REQUIRED) - list(APPEND math_libs ScaLAPACK::ScaLAPACK) -endif() + if(USE_DSP) + target_link_libraries(${ABACUS_BIN_NAME} ${SCALAPACK_LIBRARY_DIR}) + else() + find_package(ScaLAPACK REQUIRED) + list(APPEND math_libs ScaLAPACK::ScaLAPACK) + endif() if(USE_OPENMP) list(APPEND math_libs FFTW3::FFTW3_OMP) endif() @@ -752,7 +780,7 @@ if(ENABLE_LCAO) target_link_libraries(${ABACUS_BIN_NAME} genelpa) endif() if(USE_CUDA) - target_link_libraries(diag_cusolver) + target_link_libraries(${ABACUS_BIN_NAME} diag_cusolver) endif() endif() if(ENABLE_RAPIDJSON) diff --git a/source/source_io/test/binstream_test.cpp b/source/source_io/test/binstream_test.cpp index c83ea07114..0ecd1d8487 100644 --- a/source/source_io/test/binstream_test.cpp +++ b/source/source_io/test/binstream_test.cpp @@ -12,7 +12,7 @@ * - Close a binary file */ -#include "../binstream.h" +#include "../module_output/binstream.h" class BinstreamTest : public testing::Test { diff --git a/source/source_io/test/cal_pLpR_test.cpp b/source/source_io/test/cal_pLpR_test.cpp index 40d5a976cc..2dad5f663d 100644 --- a/source/source_io/test/cal_pLpR_test.cpp +++ b/source/source_io/test/cal_pLpR_test.cpp @@ -4,7 +4,7 @@ #include #include -#include "source_io/cal_pLpR.h" +#include "source_io/module_hs/cal_pLpR.h" #include "source_basis/module_nao/two_center_integrator.h" #include "source_basis/module_nao/radial_collection.h" #include "source_base/spherical_bessel_transformer.h" diff --git a/source/source_io/test/cif_io_test.cpp b/source/source_io/test/cif_io_test.cpp index c8323f4771..5d7a1c2337 100644 --- a/source/source_io/test/cif_io_test.cpp +++ b/source/source_io/test/cif_io_test.cpp @@ -1,5 +1,5 @@ #include -#include "source_io/cif_io.h" +#include "source_io/module_output/cif_io.h" #include #include #include "source_base/formatter.h" diff --git a/source/source_io/test/file_reader_test.cpp b/source/source_io/test/file_reader_test.cpp index a9479b6d4b..5d132a3a40 100644 --- a/source/source_io/test/file_reader_test.cpp +++ b/source/source_io/test/file_reader_test.cpp @@ -1,4 +1,4 @@ -#include "source_io/file_reader.h" +#include "source_io/module_output/file_reader.h" #include diff --git a/source/source_io/test/orb_io_test.cpp b/source/source_io/test/orb_io_test.cpp index fb26f83850..a17133da67 100644 --- a/source/source_io/test/orb_io_test.cpp +++ b/source/source_io/test/orb_io_test.cpp @@ -1,5 +1,5 @@ #include -#include "source_io/orb_io.h" +#include "source_io/module_output/orb_io.h" #ifdef __MPI #include diff --git a/source/source_io/test/read_exit_file_test.cpp b/source/source_io/test/read_exit_file_test.cpp index b304455930..e12c055576 100644 --- a/source/source_io/test/read_exit_file_test.cpp +++ b/source/source_io/test/read_exit_file_test.cpp @@ -1,4 +1,4 @@ -#include "source_io/read_exit_file.h" +#include "source_io/module_output/read_exit_file.h" #include "source_io/module_parameter/read_input.h" #include "mpi.h" diff --git a/source/source_io/test/single_R_io_test.cpp b/source/source_io/test/single_R_io_test.cpp index 3b378f8801..735ed7f60c 100644 --- a/source/source_io/test/single_R_io_test.cpp +++ b/source/source_io/test/single_R_io_test.cpp @@ -3,7 +3,7 @@ #define private public #include "source_io/module_parameter/parameter.h" #undef private -#include "source_io/single_R_io.h" +#include "source_io/module_hs/single_R_io.h" #include "source_base/global_variable.h" #include "source_basis/module_ao/parallel_orbitals.h" /************************************************ diff --git a/source/source_io/test/sparse_matrix_test.cpp b/source/source_io/test/sparse_matrix_test.cpp index 4ebecd6d12..9287a0981b 100644 --- a/source/source_io/test/sparse_matrix_test.cpp +++ b/source/source_io/test/sparse_matrix_test.cpp @@ -1,4 +1,4 @@ -#include "source_io/sparse_matrix.h" +#include "source_io/module_output/sparse_matrix.h" #include diff --git a/source/source_io/test/write_orb_info_test.cpp b/source/source_io/test/write_orb_info_test.cpp index 4d439ec4b4..c56c772c2f 100644 --- a/source/source_io/test/write_orb_info_test.cpp +++ b/source/source_io/test/write_orb_info_test.cpp @@ -3,7 +3,7 @@ #define private public #include "source_io/module_parameter/parameter.h" #undef private -#include "source_io/write_orb_info.h" +#include "source_io/module_output/write_orb_info.h" #include "source_cell/unitcell.h" #include "prepare_unitcell.h" #include "source_estate/read_pseudo.h" diff --git a/source/source_io/test_serial/rho_io_test.cpp b/source/source_io/test_serial/rho_io_test.cpp index 2b2ed1dd0e..29abde039e 100644 --- a/source/source_io/test_serial/rho_io_test.cpp +++ b/source/source_io/test_serial/rho_io_test.cpp @@ -1,9 +1,9 @@ -#include "source_io/cube_io.h" +#include "source_io/module_output/cube_io.h" #include "gmock/gmock.h" #include "gtest/gtest.h" #include "source_base/global_variable.h" -#include "source_io/cube_io.h" +#include "source_io/module_output/cube_io.h" #include "prepare_unitcell.h" #include "source_pw/module_pwdft/parallel_grid.h" From 33433705c4eb634d897c67c127d58b3e8645509d Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 8 Feb 2026 16:11:35 +0800 Subject: [PATCH 14/32] update cmakelists --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f479b527ed..be44e42b78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,6 +157,7 @@ if(ENABLE_LCAO) set(ABACUS_BIN_NAME abacus_4p) elseif(ENABLE_LIBRI AND ENABLE_MLALGO) set(ABACUS_BIN_NAME abacus_5p) + endif() else() if(NOT ENABLE_LIBRI AND NOT ENABLE_MLALGO) set(ABACUS_BIN_NAME abacus_2s) @@ -166,6 +167,7 @@ if(ENABLE_LCAO) set(ABACUS_BIN_NAME abacus_4s) elseif(ENABLE_LIBRI AND ENABLE_MLALGO) set(ABACUS_BIN_NAME abacus_5s) + endif() endif() endif() # Case : PW only From b6fcfa73be491269ac3172b463afb3817f21ddaf Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 8 Feb 2026 16:48:32 +0800 Subject: [PATCH 15/32] fix bugs --- source/source_io/module_json/general_info.cpp | 4 ++-- source/source_io/module_json/init_info.cpp | 4 ++-- source/source_io/module_json/output_info.cpp | 4 ++-- source/source_io/module_json/para_json.cpp | 4 ---- source/source_io/module_json/readin_info.cpp | 9 ++------- source/source_io/test/CMakeLists.txt | 6 +++--- 6 files changed, 11 insertions(+), 20 deletions(-) diff --git a/source/source_io/module_json/general_info.cpp b/source/source_io/module_json/general_info.cpp index c57a9c5746..8b45c0f192 100644 --- a/source/source_io/module_json/general_info.cpp +++ b/source/source_io/module_json/general_info.cpp @@ -1,6 +1,6 @@ #include "general_info.h" -#include "../para_json.h" +#include "para_json.h" #include "abacusjson.h" #include "source_base/parallel_global.h" #include "source_main/version.h" @@ -68,4 +68,4 @@ void gen_general_info(const Parameter& param) // AbacusJson::add_Json(end_time_str,false,"general_info", "end_time"); } #endif -} // namespace Json \ No newline at end of file +} // namespace Json diff --git a/source/source_io/module_json/init_info.cpp b/source/source_io/module_json/init_info.cpp index 2bcc479659..647df761bb 100644 --- a/source/source_io/module_json/init_info.cpp +++ b/source/source_io/module_json/init_info.cpp @@ -1,7 +1,7 @@ #include "init_info.h" #include "source_io/module_parameter/parameter.h" -#include "../para_json.h" +#include "para_json.h" #include "abacusjson.h" // Add json objects to init @@ -149,4 +149,4 @@ void gen_stru(UnitCell* ucell) } #endif -} // namespace Json \ No newline at end of file +} // namespace Json diff --git a/source/source_io/module_json/output_info.cpp b/source/source_io/module_json/output_info.cpp index 4cc9add9de..0789bf67f5 100644 --- a/source/source_io/module_json/output_info.cpp +++ b/source/source_io/module_json/output_info.cpp @@ -1,5 +1,5 @@ #include "output_info.h" -#include "../para_json.h" +#include "para_json.h" #include "source_io/module_parameter/parameter.h" #include "abacusjson.h" @@ -162,4 +162,4 @@ namespace Json } #endif -} // namespace Json \ No newline at end of file +} // namespace Json diff --git a/source/source_io/module_json/para_json.cpp b/source/source_io/module_json/para_json.cpp index 526567429e..b6b7701a2d 100644 --- a/source/source_io/module_json/para_json.cpp +++ b/source/source_io/module_json/para_json.cpp @@ -1,8 +1,5 @@ - #include "para_json.h" - #include "source_base/global_variable.h" - #include #include #include @@ -12,7 +9,6 @@ #include "json_output/general_info.h" #include "json_output/init_info.h" #include "json_output/readin_info.h" - #endif // __RAPIDJSON namespace Json diff --git a/source/source_io/module_json/readin_info.cpp b/source/source_io/module_json/readin_info.cpp index 88e400026d..a150967af8 100644 --- a/source/source_io/module_json/readin_info.cpp +++ b/source/source_io/module_json/readin_info.cpp @@ -1,16 +1,11 @@ #include "readin_info.h" -#include "../para_json.h" +#include "para_json.h" #include "abacusjson.h" - //Add json objects to init namespace Json { #ifdef __RAPIDJSON - - - - #endif -} // namespace Json \ No newline at end of file +} // namespace Json diff --git a/source/source_io/test/CMakeLists.txt b/source/source_io/test/CMakeLists.txt index 0c6130c958..4bd304a27b 100644 --- a/source/source_io/test/CMakeLists.txt +++ b/source/source_io/test/CMakeLists.txt @@ -79,7 +79,7 @@ AddTest( AddTest( TARGET MODULE_IO_write_wfc_nao LIBS parameter ${math_libs} base psi device - SOURCES write_wfc_nao_test.cpp ../module_output/filename.cpp ../module_wf/write_wfc_nao.cpp ../../source_basis/module_ao/parallel_orbitals.cpp ../binstream.cpp + SOURCES write_wfc_nao_test.cpp ../module_output/filename.cpp ../module_wf/write_wfc_nao.cpp ../../source_basis/module_ao/parallel_orbitals.cpp ../module_output/binstream.cpp ) install(FILES write_wfc_nao_para.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) @@ -157,7 +157,7 @@ endif() AddTest( TARGET MODULE_IO_read_wfc_pw_test LIBS parameter base ${math_libs} device planewave - SOURCES read_wfc_pw_test.cpp ../module_wf/read_wfc_pw.cpp ../binstream.cpp ../../source_basis/module_pw/test/test_tool.cpp + SOURCES read_wfc_pw_test.cpp ../module_wf/read_wfc_pw.cpp ../module_output/binstream.cpp ../../source_basis/module_pw/test/test_tool.cpp ) add_test(NAME MODULE_IO_read_wfc_pw_test_parallel @@ -168,7 +168,7 @@ add_test(NAME MODULE_IO_read_wfc_pw_test_parallel AddTest( TARGET MODULE_IO_read_wf2rho_pw_test LIBS parameter base ${math_libs} device planewave psi - SOURCES read_wf2rho_pw_test.cpp ../module_wf/read_wfc_pw.cpp ../module_wf/read_wf2rho_pw.cpp ../binstream.cpp ../../source_basis/module_pw/test/test_tool.cpp ../../source_estate/module_charge/charge_mpi.cpp ../module_output/filename.cpp ../module_wf/write_wfc_pw.cpp + SOURCES read_wf2rho_pw_test.cpp ../module_wf/read_wfc_pw.cpp ../module_wf/read_wf2rho_pw.cpp ../module_output/binstream.cpp ../../source_basis/module_pw/test/test_tool.cpp ../../source_estate/module_charge/charge_mpi.cpp ../module_output/filename.cpp ../module_wf/write_wfc_pw.cpp ) add_test(NAME MODULE_IO_read_wf2rho_pw_parallel From 80b74c1897ef4e565ae229d90d48e05413d5fe06 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 8 Feb 2026 16:57:02 +0800 Subject: [PATCH 16/32] Fix: Correct para_json.cpp path in test CMakeLists.txt --- source/source_io/module_json/test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/source_io/module_json/test/CMakeLists.txt b/source/source_io/module_json/test/CMakeLists.txt index eb6e5a5d47..3f8ecf2f90 100644 --- a/source/source_io/module_json/test/CMakeLists.txt +++ b/source/source_io/module_json/test/CMakeLists.txt @@ -7,5 +7,5 @@ AddTest( TARGET MODULE_IO_JSON_OUTPUT_TEST LIBS parameter ${math_libs} base device cell_info SOURCES para_json_test.cpp ../general_info.cpp ../init_info.cpp ../readin_info.cpp - ../../para_json.cpp ../abacusjson.cpp ../../module_output/output.cpp + ../para_json.cpp ../abacusjson.cpp ../../module_output/output.cpp ) \ No newline at end of file From b84febd9a7c114b1c8975a42ce7a5a0127211099 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 8 Feb 2026 16:59:43 +0800 Subject: [PATCH 17/32] fix cmake --- source/source_io/module_json/test/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/source_io/module_json/test/CMakeLists.txt b/source/source_io/module_json/test/CMakeLists.txt index 3f8ecf2f90..bb748e7d18 100644 --- a/source/source_io/module_json/test/CMakeLists.txt +++ b/source/source_io/module_json/test/CMakeLists.txt @@ -7,5 +7,5 @@ AddTest( TARGET MODULE_IO_JSON_OUTPUT_TEST LIBS parameter ${math_libs} base device cell_info SOURCES para_json_test.cpp ../general_info.cpp ../init_info.cpp ../readin_info.cpp - ../para_json.cpp ../abacusjson.cpp ../../module_output/output.cpp -) \ No newline at end of file + ../para_json.cpp ../abacusjson.cpp ../output.cpp +) From 7c0865c413c810942d83292aaa1c0a5de0ce33a7 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 8 Feb 2026 17:05:26 +0800 Subject: [PATCH 18/32] fix --- source/source_io/module_json/test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/source_io/module_json/test/CMakeLists.txt b/source/source_io/module_json/test/CMakeLists.txt index bb748e7d18..288009206e 100644 --- a/source/source_io/module_json/test/CMakeLists.txt +++ b/source/source_io/module_json/test/CMakeLists.txt @@ -7,5 +7,5 @@ AddTest( TARGET MODULE_IO_JSON_OUTPUT_TEST LIBS parameter ${math_libs} base device cell_info SOURCES para_json_test.cpp ../general_info.cpp ../init_info.cpp ../readin_info.cpp - ../para_json.cpp ../abacusjson.cpp ../output.cpp + ../para_json.cpp ../abacusjson.cpp ../../module_output/output.cpp ) From 0c811ee1f5993ac57fb9d37285d3b716e11f4c35 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 8 Feb 2026 17:11:50 +0800 Subject: [PATCH 19/32] fix --- source/source_io/module_json/para_json.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/source_io/module_json/para_json.cpp b/source/source_io/module_json/para_json.cpp index b6b7701a2d..f5cdf7be81 100644 --- a/source/source_io/module_json/para_json.cpp +++ b/source/source_io/module_json/para_json.cpp @@ -5,10 +5,10 @@ #include #include #ifdef __RAPIDJSON -#include "json_output/abacusjson.h" -#include "json_output/general_info.h" -#include "json_output/init_info.h" -#include "json_output/readin_info.h" +#include "abacusjson.h" +#include "general_info.h" +#include "init_info.h" +#include "readin_info.h" #endif // __RAPIDJSON namespace Json From e9de93e194e9f161e8abc7d3b22501fa5e08dd18 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 8 Feb 2026 17:19:25 +0800 Subject: [PATCH 20/32] fix --- source/source_hsolver/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/source_hsolver/CMakeLists.txt b/source/source_hsolver/CMakeLists.txt index 568510b603..f4e87cdf94 100644 --- a/source/source_hsolver/CMakeLists.txt +++ b/source/source_hsolver/CMakeLists.txt @@ -37,14 +37,14 @@ if(ENABLE_LCAO) endif () if(USE_CUDA) - list(APPEND objects + set(cuda_objects ./kernels/hegvd_op.cpp ./kernels/cuda/diag_cusolver.cu diago_cusolver.cpp diago_cusolver.h ) if(ENABLE_CUSOLVERMP) - list(APPEND objects + list(APPEND cuda_objects ./kernels/cuda/diag_cusolvermp.cu diago_cusolvermp.cpp diago_cusolvermp.h @@ -53,7 +53,7 @@ if(ENABLE_LCAO) add_library( diag_cusolver OBJECT - ${objects} + ${cuda_objects} ) if(ENABLE_COVERAGE) add_coverage(diag_cusolver) From 468dd53060d3e3fa6b6067e5c2f5a682d8b5ccdc Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 8 Feb 2026 17:25:58 +0800 Subject: [PATCH 21/32] fix --- source/source_io/test/write_wfc_nao_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/source_io/test/write_wfc_nao_test.cpp b/source/source_io/test/write_wfc_nao_test.cpp index b3e901c8cb..d5cf630b86 100644 --- a/source/source_io/test/write_wfc_nao_test.cpp +++ b/source/source_io/test/write_wfc_nao_test.cpp @@ -4,7 +4,7 @@ #define private public #include "source_io/module_parameter/parameter.h" #undef private -#include "../binstream.h" +#include "../module_output/binstream.h" #include "source_base/global_variable.h" #include "source_base/module_external/scalapack_connector.h" From 0a5aaa4dbd6a68f899dee1c5cc84b469da5dd506 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 8 Feb 2026 17:46:25 +0800 Subject: [PATCH 22/32] fix --- source/source_io/module_json/test/para_json_test.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/source_io/module_json/test/para_json_test.cpp b/source/source_io/module_json/test/para_json_test.cpp index 94a1e5e5dd..4c6fd62095 100644 --- a/source/source_io/module_json/test/para_json_test.cpp +++ b/source/source_io/module_json/test/para_json_test.cpp @@ -1,12 +1,12 @@ #include "gtest/gtest.h" #define private public #define __RAPIDJSON 1 -#include "../abacusjson.h" -#include "../general_info.h" -#include "../init_info.h" -#include "../readin_info.h" +#include "source_io/module_json/abacusjson.h" +#include "source_io/module_json/general_info.h" +#include "source_io/module_json/init_info.h" +#include "source_io/module_json/readin_info.h" #include "source_io/module_parameter/parameter.h" -#include "source_io/para_json.h" +#include "source_io/module_json/para_json.h" #include "source_main/version.h" #undef private /************************************************ From 019b50272ebe153590db223021653fde0a8c8d9f Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 8 Feb 2026 17:49:25 +0800 Subject: [PATCH 23/32] json! --- source/source_io/module_json/test/para_json_test.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/source_io/module_json/test/para_json_test.cpp b/source/source_io/module_json/test/para_json_test.cpp index 4c6fd62095..1b6a5b71d2 100644 --- a/source/source_io/module_json/test/para_json_test.cpp +++ b/source/source_io/module_json/test/para_json_test.cpp @@ -1,4 +1,5 @@ #include "gtest/gtest.h" + #define private public #define __RAPIDJSON 1 #include "source_io/module_json/abacusjson.h" From d608d35165d3144cf4f37b25dd55dcee8baee146 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 8 Feb 2026 22:11:27 +0800 Subject: [PATCH 24/32] small updates of mulliken file format --- .../module_mulliken/output_mulliken.h | 48 ++++++++----------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/source/source_io/module_mulliken/output_mulliken.h b/source/source_io/module_mulliken/output_mulliken.h index 5fc1fd7f7c..4b58a7a9b8 100644 --- a/source/source_io/module_mulliken/output_mulliken.h +++ b/source/source_io/module_mulliken/output_mulliken.h @@ -102,11 +102,13 @@ void cal_mag(Parallel_Orbitals* pv, if (PARAM.inp.out_mul) { auto cell_index - = CellIndex(ucell.get_atomLabels(), ucell.get_atomCounts(), ucell.get_lnchiCounts(), PARAM.inp.nspin); + = CellIndex(ucell.get_atomLabels(), + ucell.get_atomCounts(), ucell.get_lnchiCounts(), PARAM.inp.nspin); auto out_s_k = ModuleIO::Output_Sk(p_ham, pv, PARAM.inp.nspin, kv.get_nks()); auto out_dm_k = ModuleIO::Output_DMK(dm, pv, PARAM.inp.nspin, kv.get_nks()); - auto mulp = ModuleIO::Output_Mulliken(&(out_s_k), &(out_dm_k), pv, &cell_index, kv.isk, PARAM.inp.nspin); + auto mulp = ModuleIO::Output_Mulliken(&(out_s_k), + &(out_dm_k), pv, &cell_index, kv.isk, PARAM.inp.nspin); auto atom_chg = mulp.get_atom_chg(); /// used in updating mag info in STRU file ucell.atom_mulliken = mulp.get_atom_mulliken(atom_chg); @@ -131,31 +133,28 @@ void cal_mag(Parallel_Orbitals* pv, std::vector mag_y(ucell.nat, 0.0); std::vector mag_z(ucell.nat, 0.0); auto atomLabels = ucell.get_atomLabels(); + if(PARAM.inp.nspin == 2) { - auto sc_lambda - = new hamilt::DeltaSpin>(nullptr, - kv.kvec_d, - dynamic_cast*>(p_ham)->getHR(), - ucell, - &gd, - two_center_bundle.overlap_orb_onsite.get(), - orb.cutoffs()); - dm->switch_dmr(2); - moments = sc_lambda->cal_moment(dmr, constrain); - dm->switch_dmr(0); - delete sc_lambda; - //const std::vector title = {"Total Magnetism (uB)", ""}; - //const std::vector fmts = {"%-26s", "%20.10f"}; - //FmtTable table(title, ucell.nat, fmts, {FmtTable::Align::RIGHT, FmtTable::Align::LEFT}); + auto sc_lambda = new hamilt::DeltaSpin>(nullptr, + kv.kvec_d, + dynamic_cast*>(p_ham)->getHR(), + ucell, + &gd, + two_center_bundle.overlap_orb_onsite.get(), + orb.cutoffs()); + + dm->switch_dmr(2); + moments = sc_lambda->cal_moment(dmr, constrain); + dm->switch_dmr(0); + + delete sc_lambda; + for(int iat=0;iatcal_moment(dmr, constrain); delete sc_lambda; - //const std::vector title = {"Total Magnetism (uB)", "", "", ""}; - //const std::vector fmts = {"%-26s", "%20.10f", "%20.10f", "%20.10f"}; - //FmtTable table(title, ucell.nat, fmts, {FmtTable::Align::RIGHT, FmtTable::Align::LEFT}); + for(int iat=0;iat Date: Sun, 8 Feb 2026 22:51:21 +0800 Subject: [PATCH 25/32] update mulliken charge output nspin=1 --- source/source_io/module_mulliken/output_dmk.h | 8 +++-- .../module_mulliken/output_mulliken.cpp | 36 ++++++++++++------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/source/source_io/module_mulliken/output_dmk.h b/source/source_io/module_mulliken/output_dmk.h index e49c1140a8..f92be1a8fb 100644 --- a/source/source_io/module_mulliken/output_dmk.h +++ b/source/source_io/module_mulliken/output_dmk.h @@ -10,7 +10,11 @@ template class Output_DMK { public: - Output_DMK(elecstate::DensityMatrix* p_DM, Parallel_Orbitals* ParaV, int nspin, int nks); + Output_DMK(elecstate::DensityMatrix* p_DM, + Parallel_Orbitals* ParaV, + int nspin, + int nks); + TK* get_DMK(int ik); private: @@ -23,4 +27,4 @@ class Output_DMK } // namespace ModuleIO -#endif // MODULE_IO_OUTPUT_DMK_H \ No newline at end of file +#endif // MODULE_IO_OUTPUT_DMK_H diff --git a/source/source_io/module_mulliken/output_mulliken.cpp b/source/source_io/module_mulliken/output_mulliken.cpp index 3acba7bc51..81771c9933 100644 --- a/source/source_io/module_mulliken/output_mulliken.cpp +++ b/source/source_io/module_mulliken/output_mulliken.cpp @@ -17,7 +17,8 @@ Output_Mulliken::Output_Mulliken(Output_Sk* output_sk, CellIndex* cell_index, const std::vector& isk, int nspin) - : output_sk_(output_sk), output_dmk_(output_dmk), ParaV_(ParaV), cell_index_(cell_index), isk_(isk), nspin_(nspin) + : output_sk_(output_sk), output_dmk_(output_dmk), + ParaV_(ParaV), cell_index_(cell_index), isk_(isk), nspin_(nspin) { this->set_nspin(nspin); this->set_ParaV(ParaV); @@ -69,19 +70,20 @@ void Output_Mulliken::write_mulliken_nspin1(int istep, { os << std::setprecision(4); /// step info - os << "STEP: " << istep << std::endl; - os << "CALCULATE THE MULLIkEN ANALYSIS FOR EACH ATOM" << std::endl; - os << " Total charge:\t" << tot_chg[0] << std::endl; + os << " STEP " << istep+1 << std::endl; + os << " Mulliken Analysis for Each Atom" << std::endl; + os << " Total Charge\t" << tot_chg[0] << std::endl; /// orbital decomposed mulliken populations FmtCore fmt_of_chg("%20.4f"); FmtCore fmt_of_label("%-20s"); - FmtCore fmt_of_Z("%20d"); - os << "Decomposed Mulliken populations" << std::endl; + FmtCore fmt_of_Z("%10d"); + os << " Decomposed Mulliken Populations" << std::endl; for (int iat = 0; iat < this->cell_index_->get_nat(); ++iat) { /// header of the table std::string atom_label = this->cell_index_->get_atom_label(iat); - os << FmtCore::format("%-20d", iat) << FmtCore::format("%20s", std::string("Zeta of ") + atom_label) + os << " Atom " << FmtCore::format("%-20d", (iat+1)) + << FmtCore::format("%10s", std::string("Zeta of ") + atom_label) << FmtCore::format("%20s", std::string("Spin 1")) << std::endl; /// loop of L for (int L = 0; L <= this->cell_index_->get_maxL(iat); L++) @@ -91,7 +93,8 @@ void Output_Mulliken::write_mulliken_nspin1(int istep, { for (int M = 0; M < (2 * L + 1); M++) { - os << fmt_of_label.format(ModuleBase::Name_Angular[L][M]) << fmt_of_Z.format(Z) + os << " " + << fmt_of_label.format(ModuleBase::Name_Angular[L][M]) << fmt_of_Z.format(Z) << fmt_of_chg.format(orb_chg[std::vector{iat, 0, L, Z, M}]) << std::endl; } // sum over m @@ -106,18 +109,25 @@ void Output_Mulliken::write_mulliken_nspin1(int istep, } if (L > 0) { - os << fmt_of_label.format(std::string("SUM OVER M")) << std::setw(20) << "" - << fmt_of_chg.format(sum_over_m[0]) << std::endl; + os << " " + << fmt_of_label.format(std::string("SUM OVER M")) + << std::setw(10) << "" + << fmt_of_chg.format(sum_over_m[0]) << std::endl; } } - os << fmt_of_label.format(std::string("SUM OVER M+Zeta")) << std::setw(20) << "" + os << " " + << fmt_of_label.format(std::string("SUM OVER M+Zeta")) + << std::setw(10) << "" << fmt_of_chg.format(sum_over_m_and_z[0]) << std::endl; os << std::endl; } - os << fmt_of_label.format(std::string("SUM OVER M+Zeta+L")) << std::setw(20) << "" + os << " " + << fmt_of_label.format(std::string("SUM OVER M+Zeta+L")) + << std::setw(10) << "" << fmt_of_chg.format(atom_chg[iat][0]) << std::endl; os << std::endl; - os << std::left << std::setw(30) << "Total Charge on atom:" << std::right << std::setw(10) << atom_label + os << std::left << std::setw(30) << " Total Charge on atom " + << std::right << std::setw(6) << atom_label << fmt_of_chg.format(atom_chg[iat][0]) << std::endl; os << std::endl << std::endl; } From 58ce9cae50390cd33242bcbf3b24e509098233b3 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sat, 14 Feb 2026 08:32:18 +0800 Subject: [PATCH 26/32] Fix: Create symbolic link 'abacus' for test compatibility --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index be44e42b78..166814d6f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -805,6 +805,9 @@ install(PROGRAMS ${ABACUS_BIN_PATH} # DESTINATION ${CMAKE_INSTALL_BINDIR} ) +# Create a symbolic link 'abacus' pointing to the actual executable +install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${ABACUS_BIN_NAME} ${CMAKE_INSTALL_PREFIX}/bin/abacus WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin)") + if(ENABLE_COVERAGE) coverage_evaluate() endif() From 23fbce03d49fc04df3e89caf4763b3eef190fd39 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sat, 21 Feb 2026 04:33:18 +0800 Subject: [PATCH 27/32] update mulliken output --- source/source_io/module_mulliken/output_mulliken.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/source_io/module_mulliken/output_mulliken.cpp b/source/source_io/module_mulliken/output_mulliken.cpp index 81771c9933..9e21e8d274 100644 --- a/source/source_io/module_mulliken/output_mulliken.cpp +++ b/source/source_io/module_mulliken/output_mulliken.cpp @@ -70,7 +70,7 @@ void Output_Mulliken::write_mulliken_nspin1(int istep, { os << std::setprecision(4); /// step info - os << " STEP " << istep+1 << std::endl; + os << " Ionic Step " << istep+1 << std::endl; os << " Mulliken Analysis for Each Atom" << std::endl; os << " Total Charge\t" << tot_chg[0] << std::endl; /// orbital decomposed mulliken populations From 27c707998febbbf2db056c65534bf2134c63155a Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sat, 21 Feb 2026 05:23:13 +0800 Subject: [PATCH 28/32] update mulliken spin 2 --- .../module_mulliken/output_mulliken.cpp | 57 ++++++++++++------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/source/source_io/module_mulliken/output_mulliken.cpp b/source/source_io/module_mulliken/output_mulliken.cpp index 9e21e8d274..0e4b7881f7 100644 --- a/source/source_io/module_mulliken/output_mulliken.cpp +++ b/source/source_io/module_mulliken/output_mulliken.cpp @@ -142,23 +142,32 @@ void Output_Mulliken::write_mulliken_nspin2(int istep, { os << std::setprecision(4); /// step info - os << "STEP: " << istep << std::endl; - os << "CALCULATE THE MULLIkEN ANALYSIS FOR EACH ATOM" << std::endl; - os << " Total charge of spin " << 1 << ":\t" << tot_chg[0] << std::endl; - os << " Total charge of spin " << 2 << ":\t" << tot_chg[1] << std::endl; - os << " Total charge:\t" << tot_chg[0] + tot_chg[1] << std::endl; + os << " --- Ionic Step ---" << istep+1 << std::endl; + os << " Total charge " << tot_chg[0] + tot_chg[1] << std::endl; + os << " Total charge of spin1 " << tot_chg[0] << std::endl; + os << " Total charge of spin2 " << tot_chg[1] << std::endl; /// orbital decomposed mulliken populations - FmtCore fmt_of_chg("%20.4f"); - FmtCore fmt_of_label("%-20s"); - FmtCore fmt_of_Z("%20d"); - os << "Decomposed Mulliken populations" << std::endl; + FmtCore fmt_of_chg("%10.4f"); + FmtCore fmt_of_label("%6s"); + FmtCore fmt_of_Z("%2d"); + FmtCore fmt_of_sum("%8s"); + os << " Decomposed Mulliken population analysis for each atom" << std::endl; + os << " l and m from Ylm, z stands for zeta orbital" << std::endl; + os << std::endl; + for (int iat = 0; iat < this->cell_index_->get_nat(); ++iat) { /// header of the table std::string atom_label = this->cell_index_->get_atom_label(iat); - os << FmtCore::format("%-20d", iat) << FmtCore::format("%20s", std::string("Zeta of ") + atom_label) - << FmtCore::format("%20s", std::string("Spin 1")) << FmtCore::format("%20s", std::string("Spin 2")) - << FmtCore::format("%20s", std::string("Sum")) << FmtCore::format("%20s", std::string("Diff")) << std::endl; + os << " ------------------" << std::endl; + os << " Atom " << iat+1 << " is " << atom_label << std::endl; + os << " ------------------" << std::endl; + os << FmtCore::format("%8s", std::string("zeta")) + << FmtCore::format("%10s", std::string("spin1")) + << FmtCore::format("%10s", std::string("spin2")) + << FmtCore::format("%10s", std::string("sum")) + << FmtCore::format("%10s", std::string("diff")) << std::endl; + /// loop of L for (int L = 0; L <= this->cell_index_->get_maxL(iat); L++) { @@ -167,7 +176,8 @@ void Output_Mulliken::write_mulliken_nspin2(int istep, { for (int M = 0; M < (2 * L + 1); M++) { - os << fmt_of_label.format(ModuleBase::Name_Angular[L][M]) << fmt_of_Z.format(Z) + os << fmt_of_label.format(ModuleBase::Name_Angular[L][M]) + << fmt_of_Z.format(Z+1) // be careful, Z+1, modified by mohan 2026-02-21 << fmt_of_chg.format(orb_chg[std::vector{iat, 0, L, Z, M}]) << fmt_of_chg.format(orb_chg[std::vector{iat, 1, L, Z, M}]) << fmt_of_chg.format(orb_chg[std::vector{iat, 0, L, Z, M}] @@ -188,28 +198,31 @@ void Output_Mulliken::write_mulliken_nspin2(int istep, } if (L > 0) { - os << fmt_of_label.format(std::string("SUM OVER M")) << std::setw(20) << "" - << fmt_of_chg.format(sum_over_m[0]) << fmt_of_chg.format(sum_over_m[1]) + os << fmt_of_sum.format(std::string(" sum m")) + << fmt_of_chg.format(sum_over_m[0]) + << fmt_of_chg.format(sum_over_m[1]) << fmt_of_chg.format(sum_over_m[0] + sum_over_m[1]) << fmt_of_chg.format(sum_over_m[0] - sum_over_m[1]) << std::endl; } } - os << fmt_of_label.format(std::string("SUM OVER M+Zeta")) << std::setw(20) << "" - << fmt_of_chg.format(sum_over_m_and_z[0]) << fmt_of_chg.format(sum_over_m_and_z[1]) + os << fmt_of_sum.format(std::string(" sum mz")) + << fmt_of_chg.format(sum_over_m_and_z[0]) + << fmt_of_chg.format(sum_over_m_and_z[1]) << fmt_of_chg.format(sum_over_m_and_z[0] + sum_over_m_and_z[1]) << fmt_of_chg.format(sum_over_m_and_z[0] - sum_over_m_and_z[1]) << std::endl; os << std::endl; } - os << fmt_of_label.format(std::string("SUM OVER M+Zeta+L")) << std::setw(20) << "" - << fmt_of_chg.format(atom_chg[iat][0]) << fmt_of_chg.format(atom_chg[iat][1]) + os << fmt_of_sum.format(std::string(" sum lmz")) + << fmt_of_chg.format(atom_chg[iat][0]) + << fmt_of_chg.format(atom_chg[iat][1]) << fmt_of_chg.format(atom_chg[iat][0] + atom_chg[iat][1]) << fmt_of_chg.format(atom_chg[iat][0] - atom_chg[iat][1]) << std::endl; os << std::endl; - os << std::left << std::setw(30) << "Total Charge on atom:" << std::right << std::setw(10) << atom_label + os << std::left << " total charge on atom " << iat+1 << " " << fmt_of_chg.format(atom_chg[iat][0] + atom_chg[iat][1]) << std::endl; - os << std::left << std::setw(30) << "Total Magnetism on atom: " << std::right << std::setw(10) << atom_label + os << std::left << " total magnetism on atom " << iat+1 << " " << fmt_of_chg.format(atom_chg[iat][0] - atom_chg[iat][1]) << std::endl; - os << std::endl << std::endl; + os << std::endl; } } From 76e9e606bd2cd6679ec7c34610f91cd40d9de8e9 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sat, 21 Feb 2026 05:44:22 +0800 Subject: [PATCH 29/32] update mulliken 4 --- .../module_mulliken/output_mulliken.cpp | 68 ++++++++++++------- 1 file changed, 42 insertions(+), 26 deletions(-) diff --git a/source/source_io/module_mulliken/output_mulliken.cpp b/source/source_io/module_mulliken/output_mulliken.cpp index 0e4b7881f7..dceae8586c 100644 --- a/source/source_io/module_mulliken/output_mulliken.cpp +++ b/source/source_io/module_mulliken/output_mulliken.cpp @@ -142,7 +142,7 @@ void Output_Mulliken::write_mulliken_nspin2(int istep, { os << std::setprecision(4); /// step info - os << " --- Ionic Step ---" << istep+1 << std::endl; + os << " --- Ionic Step " << istep+1 << " ---" << std::endl; os << " Total charge " << tot_chg[0] + tot_chg[1] << std::endl; os << " Total charge of spin1 " << tot_chg[0] << std::endl; os << " Total charge of spin2 " << tot_chg[1] << std::endl; @@ -235,22 +235,30 @@ void Output_Mulliken::write_mulliken_nspin4(int istep, { os << std::setprecision(4); /// step info - os << "STEP: " << istep << std::endl; - os << "CALCULATE THE MULLIkEN ANALYSIS FOR EACH ATOM" << std::endl; - os << " Total charge:\t" << tot_chg[0] << std::endl; + os << " --- Ionic Step " << istep+1 << " ---" << std::endl; + os << " Total charge " << tot_chg[0] << std::endl; /// orbital decomposed mulliken populations - FmtCore fmt_of_chg("%20.4f"); - FmtCore fmt_of_label("%-20s"); - FmtCore fmt_of_Z("%20d"); - os << "Decomposed Mulliken populations" << std::endl; + FmtCore fmt_of_chg("%10.4f"); + FmtCore fmt_of_label("%6s"); + FmtCore fmt_of_Z("%2d"); + FmtCore fmt_of_sum("%8s"); + os << " Decomposed Mulliken population analysis for each atom" << std::endl; + os << " l and m from Ylm, z stands for zeta orbital" << std::endl; + os << std::endl; + for (int iat = 0; iat < this->cell_index_->get_nat(); ++iat) { /// header of the table std::string atom_label = this->cell_index_->get_atom_label(iat); - os << FmtCore::format("%-20d", iat) << FmtCore::format("%20s", std::string("Zeta of ") + atom_label) - << FmtCore::format("%20s", std::string("Spin 1")) << FmtCore::format("%20s", std::string("Spin 2")) - << FmtCore::format("%20s", std::string("Spin 3")) << FmtCore::format("%20s", std::string("Spin 4")) - << std::endl; + os << " ------------------" << std::endl; + os << " Atom " << iat+1 << " is " << atom_label << std::endl; + os << " ------------------" << std::endl; + os << FmtCore::format("%8s", std::string("zeta")) + << FmtCore::format("%10s", std::string("spin1")) + << FmtCore::format("%10s", std::string("spin2")) + << FmtCore::format("%10s", std::string("spin3")) + << FmtCore::format("%10s", std::string("spin4")) << std::endl; + /// loop of L for (int L = 0; L <= this->cell_index_->get_maxL(iat); L++) { @@ -259,7 +267,8 @@ void Output_Mulliken::write_mulliken_nspin4(int istep, { for (int M = 0; M < (2 * L + 1); M++) { - os << fmt_of_label.format(ModuleBase::Name_Angular[L][M]) << fmt_of_Z.format(Z) + os << fmt_of_label.format(ModuleBase::Name_Angular[L][M]) + << fmt_of_Z.format(Z+1) << fmt_of_chg.format(orb_chg[std::vector{iat, 0, L, Z, M}]) << fmt_of_chg.format(orb_chg[std::vector{iat, 1, L, Z, M}]) << fmt_of_chg.format(orb_chg[std::vector{iat, 2, L, Z, M}]) @@ -277,26 +286,33 @@ void Output_Mulliken::write_mulliken_nspin4(int istep, } if (L > 0) { - os << fmt_of_label.format(std::string("SUM OVER M")) << std::setw(20) << "" - << fmt_of_chg.format(sum_over_m[0]) << fmt_of_chg.format(sum_over_m[1]) - << fmt_of_chg.format(sum_over_m[2]) << fmt_of_chg.format(sum_over_m[3]) << std::endl; + os << fmt_of_sum.format(std::string(" sum m")) + << fmt_of_chg.format(sum_over_m[0]) + << fmt_of_chg.format(sum_over_m[1]) + << fmt_of_chg.format(sum_over_m[2]) + << fmt_of_chg.format(sum_over_m[3]) << std::endl; } } - os << fmt_of_label.format(std::string("SUM OVER M+Zeta")) << std::setw(20) << "" - << fmt_of_chg.format(sum_over_m_and_z[0]) << fmt_of_chg.format(sum_over_m_and_z[1]) - << fmt_of_chg.format(sum_over_m_and_z[2]) << fmt_of_chg.format(sum_over_m_and_z[3]) << std::endl; + os << fmt_of_sum.format(std::string(" sum mz")) + << fmt_of_chg.format(sum_over_m_and_z[0]) + << fmt_of_chg.format(sum_over_m_and_z[1]) + << fmt_of_chg.format(sum_over_m_and_z[2]) + << fmt_of_chg.format(sum_over_m_and_z[3]) << std::endl; os << std::endl; } - os << fmt_of_label.format(std::string("SUM OVER M+Zeta+L")) << std::setw(20) << "" - << fmt_of_chg.format(atom_chg[iat][0]) << fmt_of_chg.format(atom_chg[iat][1]) - << fmt_of_chg.format(atom_chg[iat][2]) << fmt_of_chg.format(atom_chg[iat][3]) << std::endl; + os << fmt_of_sum.format(std::string(" sum lmz")) + << fmt_of_chg.format(atom_chg[iat][0]) + << fmt_of_chg.format(atom_chg[iat][1]) + << fmt_of_chg.format(atom_chg[iat][2]) + << fmt_of_chg.format(atom_chg[iat][3]) << std::endl; os << std::endl; - os << std::left << std::setw(30) << "Total Charge on atom:" << std::right << std::setw(10) << atom_label + os << std::left << " total charge on atom " << iat+1 << " " << fmt_of_chg.format(atom_chg[iat][0]) << std::endl; - os << std::left << std::setw(30) << "Total Magnetism on atom: " << std::right << std::setw(10) << atom_label - << fmt_of_chg.format(atom_chg[iat][1]) << fmt_of_chg.format(atom_chg[iat][2]) + os << std::left << " total magnetism on atom " << iat+1 << " " + << fmt_of_chg.format(atom_chg[iat][1]) << " " + << fmt_of_chg.format(atom_chg[iat][2]) << " " << fmt_of_chg.format(atom_chg[iat][3]) << std::endl; - os << std::endl << std::endl; + os << std::endl; } } From dba2cd7876e3d2231a14009bf0a81b75a2d9ef57 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sat, 21 Feb 2026 05:49:11 +0800 Subject: [PATCH 30/32] mulliken for spin 1 --- .../module_mulliken/output_mulliken.cpp | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/source/source_io/module_mulliken/output_mulliken.cpp b/source/source_io/module_mulliken/output_mulliken.cpp index dceae8586c..4a87346a07 100644 --- a/source/source_io/module_mulliken/output_mulliken.cpp +++ b/source/source_io/module_mulliken/output_mulliken.cpp @@ -70,21 +70,27 @@ void Output_Mulliken::write_mulliken_nspin1(int istep, { os << std::setprecision(4); /// step info - os << " Ionic Step " << istep+1 << std::endl; - os << " Mulliken Analysis for Each Atom" << std::endl; - os << " Total Charge\t" << tot_chg[0] << std::endl; + os << " --- Ionic Step " << istep+1 << " ---" << std::endl; + os << " Total charge " << tot_chg[0] << std::endl; /// orbital decomposed mulliken populations - FmtCore fmt_of_chg("%20.4f"); - FmtCore fmt_of_label("%-20s"); - FmtCore fmt_of_Z("%10d"); - os << " Decomposed Mulliken Populations" << std::endl; + FmtCore fmt_of_chg("%10.4f"); + FmtCore fmt_of_label("%6s"); + FmtCore fmt_of_Z("%2d"); + FmtCore fmt_of_sum("%8s"); + os << " Decomposed Mulliken population analysis for each atom" << std::endl; + os << " l and m from Ylm, z stands for zeta orbital" << std::endl; + os << std::endl; + for (int iat = 0; iat < this->cell_index_->get_nat(); ++iat) { /// header of the table std::string atom_label = this->cell_index_->get_atom_label(iat); - os << " Atom " << FmtCore::format("%-20d", (iat+1)) - << FmtCore::format("%10s", std::string("Zeta of ") + atom_label) - << FmtCore::format("%20s", std::string("Spin 1")) << std::endl; + os << " ------------------" << std::endl; + os << " Atom " << iat+1 << " is " << atom_label << std::endl; + os << " ------------------" << std::endl; + os << FmtCore::format("%8s", std::string("zeta")) + << FmtCore::format("%10s", std::string("spin1")) << std::endl; + /// loop of L for (int L = 0; L <= this->cell_index_->get_maxL(iat); L++) { @@ -93,8 +99,8 @@ void Output_Mulliken::write_mulliken_nspin1(int istep, { for (int M = 0; M < (2 * L + 1); M++) { - os << " " - << fmt_of_label.format(ModuleBase::Name_Angular[L][M]) << fmt_of_Z.format(Z) + os << fmt_of_label.format(ModuleBase::Name_Angular[L][M]) + << fmt_of_Z.format(Z+1) << fmt_of_chg.format(orb_chg[std::vector{iat, 0, L, Z, M}]) << std::endl; } // sum over m @@ -109,27 +115,20 @@ void Output_Mulliken::write_mulliken_nspin1(int istep, } if (L > 0) { - os << " " - << fmt_of_label.format(std::string("SUM OVER M")) - << std::setw(10) << "" - << fmt_of_chg.format(sum_over_m[0]) << std::endl; + os << fmt_of_sum.format(std::string(" sum m")) + << fmt_of_chg.format(sum_over_m[0]) << std::endl; } } - os << " " - << fmt_of_label.format(std::string("SUM OVER M+Zeta")) - << std::setw(10) << "" + os << fmt_of_sum.format(std::string(" sum mz")) << fmt_of_chg.format(sum_over_m_and_z[0]) << std::endl; os << std::endl; } - os << " " - << fmt_of_label.format(std::string("SUM OVER M+Zeta+L")) - << std::setw(10) << "" + os << fmt_of_sum.format(std::string(" sum lmz")) << fmt_of_chg.format(atom_chg[iat][0]) << std::endl; os << std::endl; - os << std::left << std::setw(30) << " Total Charge on atom " - << std::right << std::setw(6) << atom_label + os << std::left << " total charge on atom " << iat+1 << " " << fmt_of_chg.format(atom_chg[iat][0]) << std::endl; - os << std::endl << std::endl; + os << std::endl; } } From 40b6fa508c42f141881f3aa6479d08d1e84dbc32 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sat, 21 Feb 2026 06:11:34 +0800 Subject: [PATCH 31/32] update mulliken and refs --- source/source_base/name_angular.h | 2 +- .../module_mulliken/output_mulliken.cpp | 18 +- .../115_NO_GO_mulliken/mulliken.txt.ref | 75 ++++---- .../144_NO_GO_AF_mag/mulliken.txt.ref | 179 +++++++++--------- .../11_NO_KP_AFM/mulliken.txt.ref | 179 +++++++++--------- .../14_NO_KP_NC/mulliken.txt.ref | 175 ++++++++--------- .../31_NO_KP_nupdown0/mulliken.txt.ref | 111 +++++------ .../36_NO_KP_MU/mulliken.txt.ref | 75 ++++---- .../37_NO_KP_MU_nscf/mulliken.txt.ref | 75 ++++---- 9 files changed, 462 insertions(+), 427 deletions(-) diff --git a/source/source_base/name_angular.h b/source/source_base/name_angular.h index 06627c8e22..48b9dae152 100644 --- a/source/source_base/name_angular.h +++ b/source/source_base/name_angular.h @@ -10,7 +10,7 @@ namespace ModuleBase {"dz^2", "dxz", "dyz", "dx^2-y^2", "dxy"}, {"fz^3", "fxz^2", "fyz^2", "fzx^2-zy^2", "fxyz", "fx^3-3*xy^2", "f3yx^2-y^3"}, {"g1", "g2", "g3", "g4", "g5", "g6", "g7", "g8", "g9"} - }; // name of atomic orbital jiyy add 2022-05-10 + }; // name of atomic orbital jiyy add 2022-05-10 } #endif diff --git a/source/source_io/module_mulliken/output_mulliken.cpp b/source/source_io/module_mulliken/output_mulliken.cpp index 4a87346a07..624bbcd3dc 100644 --- a/source/source_io/module_mulliken/output_mulliken.cpp +++ b/source/source_io/module_mulliken/output_mulliken.cpp @@ -74,9 +74,9 @@ void Output_Mulliken::write_mulliken_nspin1(int istep, os << " Total charge " << tot_chg[0] << std::endl; /// orbital decomposed mulliken populations FmtCore fmt_of_chg("%10.4f"); - FmtCore fmt_of_label("%6s"); + FmtCore fmt_of_label("%12s"); FmtCore fmt_of_Z("%2d"); - FmtCore fmt_of_sum("%8s"); + FmtCore fmt_of_sum("%14s"); os << " Decomposed Mulliken population analysis for each atom" << std::endl; os << " l and m from Ylm, z stands for zeta orbital" << std::endl; os << std::endl; @@ -88,7 +88,7 @@ void Output_Mulliken::write_mulliken_nspin1(int istep, os << " ------------------" << std::endl; os << " Atom " << iat+1 << " is " << atom_label << std::endl; os << " ------------------" << std::endl; - os << FmtCore::format("%8s", std::string("zeta")) + os << FmtCore::format("%14s", std::string("zeta")) << FmtCore::format("%10s", std::string("spin1")) << std::endl; /// loop of L @@ -147,9 +147,9 @@ void Output_Mulliken::write_mulliken_nspin2(int istep, os << " Total charge of spin2 " << tot_chg[1] << std::endl; /// orbital decomposed mulliken populations FmtCore fmt_of_chg("%10.4f"); - FmtCore fmt_of_label("%6s"); + FmtCore fmt_of_label("%12s"); FmtCore fmt_of_Z("%2d"); - FmtCore fmt_of_sum("%8s"); + FmtCore fmt_of_sum("%14s"); os << " Decomposed Mulliken population analysis for each atom" << std::endl; os << " l and m from Ylm, z stands for zeta orbital" << std::endl; os << std::endl; @@ -161,7 +161,7 @@ void Output_Mulliken::write_mulliken_nspin2(int istep, os << " ------------------" << std::endl; os << " Atom " << iat+1 << " is " << atom_label << std::endl; os << " ------------------" << std::endl; - os << FmtCore::format("%8s", std::string("zeta")) + os << FmtCore::format("%14s", std::string("zeta")) << FmtCore::format("%10s", std::string("spin1")) << FmtCore::format("%10s", std::string("spin2")) << FmtCore::format("%10s", std::string("sum")) @@ -238,9 +238,9 @@ void Output_Mulliken::write_mulliken_nspin4(int istep, os << " Total charge " << tot_chg[0] << std::endl; /// orbital decomposed mulliken populations FmtCore fmt_of_chg("%10.4f"); - FmtCore fmt_of_label("%6s"); + FmtCore fmt_of_label("%12s"); FmtCore fmt_of_Z("%2d"); - FmtCore fmt_of_sum("%8s"); + FmtCore fmt_of_sum("%14s"); os << " Decomposed Mulliken population analysis for each atom" << std::endl; os << " l and m from Ylm, z stands for zeta orbital" << std::endl; os << std::endl; @@ -252,7 +252,7 @@ void Output_Mulliken::write_mulliken_nspin4(int istep, os << " ------------------" << std::endl; os << " Atom " << iat+1 << " is " << atom_label << std::endl; os << " ------------------" << std::endl; - os << FmtCore::format("%8s", std::string("zeta")) + os << FmtCore::format("%14s", std::string("zeta")) << FmtCore::format("%10s", std::string("spin1")) << FmtCore::format("%10s", std::string("spin2")) << FmtCore::format("%10s", std::string("spin3")) diff --git a/tests/02_NAO_Gamma/115_NO_GO_mulliken/mulliken.txt.ref b/tests/02_NAO_Gamma/115_NO_GO_mulliken/mulliken.txt.ref index 008254a350..2b675eaa17 100644 --- a/tests/02_NAO_Gamma/115_NO_GO_mulliken/mulliken.txt.ref +++ b/tests/02_NAO_Gamma/115_NO_GO_mulliken/mulliken.txt.ref @@ -1,36 +1,41 @@ -STEP: 0 -CALCULATE THE MULLIkEN ANALYSIS FOR EACH ATOM - Total charge: 2 -Decomposed Mulliken populations -0 Zeta of H Spin 1 -s 0 0.9980 -s 1 -0.0052 -SUM OVER M+Zeta 0.9928 - -pz 0 0.0072 -px 0 0.0000 -py 0 0.0000 -SUM OVER M 0.0072 -SUM OVER M+Zeta 0.0072 - -SUM OVER M+Zeta+L 1.0000 - -Total Charge on atom: H 1.0000 - - -1 Zeta of H Spin 1 -s 0 0.9980 -s 1 -0.0052 -SUM OVER M+Zeta 0.9928 - -pz 0 0.0072 -px 0 0.0000 -py 0 0.0000 -SUM OVER M 0.0072 -SUM OVER M+Zeta 0.0072 - -SUM OVER M+Zeta+L 1.0000 - -Total Charge on atom: H 1.0000 - + --- Ionic Step 1 --- + Total charge 2 + Decomposed Mulliken population analysis for each atom + l and m from Ylm, z stands for zeta orbital + + ------------------ + Atom 1 is H + ------------------ + zeta spin1 + s 1 0.9980 + s 2 -0.0052 + sum mz 0.9928 + + pz 1 0.0072 + px 1 0.0000 + py 1 0.0000 + sum m 0.0072 + sum mz 0.0072 + + sum lmz 1.0000 + + total charge on atom 1 1.0000 + + ------------------ + Atom 2 is H + ------------------ + zeta spin1 + s 1 0.9980 + s 2 -0.0052 + sum mz 0.9928 + + pz 1 0.0072 + px 1 0.0000 + py 1 0.0000 + sum m 0.0072 + sum mz 0.0072 + + sum lmz 1.0000 + + total charge on atom 2 1.0000 diff --git a/tests/02_NAO_Gamma/144_NO_GO_AF_mag/mulliken.txt.ref b/tests/02_NAO_Gamma/144_NO_GO_AF_mag/mulliken.txt.ref index fbe2e8e218..a2c31534af 100644 --- a/tests/02_NAO_Gamma/144_NO_GO_AF_mag/mulliken.txt.ref +++ b/tests/02_NAO_Gamma/144_NO_GO_AF_mag/mulliken.txt.ref @@ -1,100 +1,105 @@ -STEP: 0 -CALCULATE THE MULLIkEN ANALYSIS FOR EACH ATOM - Total charge of spin 1: 16 - Total charge of spin 2: 16 - Total charge: 32 -Decomposed Mulliken populations -0 Zeta of Fe1 Spin 1 Spin 2 Sum Diff -s 0 0.9437 0.8381 1.7818 0.1056 -s 1 0.7227 0.6130 1.3357 0.1097 -s 2 0.3242 0.3234 0.6477 0.0008 -s 3 0.0058 0.0045 0.0103 0.0012 -SUM OVER M+Zeta 1.9963 1.7790 3.7754 0.2173 + --- Ionic Step 1 --- + Total charge 32 + Total charge of spin1 16 + Total charge of spin2 16 + Decomposed Mulliken population analysis for each atom + l and m from Ylm, z stands for zeta orbital -pz 0 0.1306 0.1312 0.2619 -0.0006 -px 0 0.1306 0.1312 0.2619 -0.0006 -py 0 0.1306 0.1312 0.2619 -0.0006 -SUM OVER M 0.3918 0.3937 0.7856 -0.0019 -pz 1 0.8694 0.8688 1.7381 0.0006 -px 1 0.8694 0.8688 1.7381 0.0006 -py 1 0.8694 0.8688 1.7381 0.0006 -SUM OVER M 2.6081 2.6063 5.2144 0.0019 -SUM OVER M+Zeta 3.0000 3.0000 5.9999 -0.0000 + ------------------ + Atom 1 is Fe1 + ------------------ + zeta spin1 spin2 sum diff + s 1 0.9437 0.8381 1.7818 0.1056 + s 2 0.7227 0.6130 1.3357 0.1097 + s 3 0.3242 0.3234 0.6477 0.0008 + s 4 0.0058 0.0045 0.0103 0.0012 + sum mz 1.9963 1.7790 3.7754 0.2173 -dz^2 0 0.9999 0.0361 1.0360 0.9637 -dxz 0 0.9997 0.3842 1.3839 0.6156 -dyz 0 0.9997 0.3842 1.3839 0.6156 -dx^2-y^2 0 0.9999 0.0361 1.0360 0.9637 -dxy 0 0.9997 0.3842 1.3839 0.6156 -SUM OVER M 4.9990 1.2248 6.2238 3.7742 -dz^2 1 0.0000 0.0000 0.0000 0.0000 -dxz 1 0.0001 0.0001 0.0003 -0.0000 -dyz 1 0.0001 0.0001 0.0003 -0.0000 -dx^2-y^2 1 0.0000 0.0000 0.0000 0.0000 -dxy 1 0.0001 0.0001 0.0003 -0.0000 -SUM OVER M 0.0005 0.0004 0.0009 0.0000 -SUM OVER M+Zeta 4.9994 1.2252 6.2246 3.7742 + pz 1 0.1306 0.1312 0.2619 -0.0006 + px 1 0.1306 0.1312 0.2619 -0.0006 + py 1 0.1306 0.1312 0.2619 -0.0006 + sum m 0.3918 0.3937 0.7856 -0.0019 + pz 2 0.8694 0.8688 1.7381 0.0006 + px 2 0.8694 0.8688 1.7381 0.0006 + py 2 0.8694 0.8688 1.7381 0.0006 + sum m 2.6081 2.6063 5.2144 0.0019 + sum mz 3.0000 3.0000 5.9999 -0.0000 -fz^3 0 0.0000 0.0000 0.0000 0.0000 -fxz^2 0 0.0000 0.0000 0.0000 -0.0000 -fyz^2 0 0.0000 0.0000 0.0000 -0.0000 -fzx^2-zy^2 0 0.0000 0.0000 0.0000 -0.0000 -fxyz 0 0.0000 0.0000 0.0000 0.0000 -fx^3-3*xy^2 0 0.0000 0.0000 0.0000 -0.0000 -f3yx^2-y^3 0 0.0000 0.0000 0.0000 -0.0000 -SUM OVER M 0.0000 0.0000 0.0001 0.0000 -SUM OVER M+Zeta 0.0000 0.0000 0.0001 0.0000 + dz^2 1 0.9999 0.0361 1.0360 0.9637 + dxz 1 0.9997 0.3842 1.3839 0.6156 + dyz 1 0.9997 0.3842 1.3839 0.6156 + dx^2-y^2 1 0.9999 0.0361 1.0360 0.9637 + dxy 1 0.9997 0.3842 1.3839 0.6156 + sum m 4.9990 1.2248 6.2238 3.7742 + dz^2 2 0.0000 0.0000 0.0000 0.0000 + dxz 2 0.0001 0.0001 0.0003 -0.0000 + dyz 2 0.0001 0.0001 0.0003 -0.0000 + dx^2-y^2 2 0.0000 0.0000 0.0000 0.0000 + dxy 2 0.0001 0.0001 0.0003 -0.0000 + sum m 0.0005 0.0004 0.0009 0.0000 + sum mz 4.9994 1.2252 6.2246 3.7742 -SUM OVER M+Zeta+L 9.9958 6.0042 16.0000 3.9915 + fz^3 1 0.0000 0.0000 0.0000 0.0000 + fxz^2 1 0.0000 0.0000 0.0000 -0.0000 + fyz^2 1 0.0000 0.0000 0.0000 -0.0000 + fzx^2-zy^2 1 0.0000 0.0000 0.0000 -0.0000 + fxyz 1 0.0000 0.0000 0.0000 0.0000 + fx^3-3*xy^2 1 0.0000 0.0000 0.0000 -0.0000 + f3yx^2-y^3 1 0.0000 0.0000 0.0000 -0.0000 + sum m 0.0000 0.0000 0.0001 0.0000 + sum mz 0.0000 0.0000 0.0001 0.0000 -Total Charge on atom: Fe1 16.0000 -Total Magnetism on atom: Fe1 3.9915 + sum lmz 9.9958 6.0042 16.0000 3.9915 + total charge on atom 1 16.0000 + total magnetism on atom 1 3.9915 -1 Zeta of Fe2 Spin 1 Spin 2 Sum Diff -s 0 0.8381 0.9437 1.7818 -0.1056 -s 1 0.6130 0.7227 1.3357 -0.1097 -s 2 0.3234 0.3242 0.6477 -0.0008 -s 3 0.0045 0.0058 0.0103 -0.0012 -SUM OVER M+Zeta 1.7790 1.9963 3.7754 -0.2173 + ------------------ + Atom 2 is Fe2 + ------------------ + zeta spin1 spin2 sum diff + s 1 0.8381 0.9437 1.7818 -0.1056 + s 2 0.6130 0.7227 1.3357 -0.1097 + s 3 0.3234 0.3242 0.6477 -0.0008 + s 4 0.0045 0.0058 0.0103 -0.0012 + sum mz 1.7790 1.9963 3.7754 -0.2173 -pz 0 0.1312 0.1306 0.2619 0.0006 -px 0 0.1312 0.1306 0.2619 0.0006 -py 0 0.1312 0.1306 0.2619 0.0006 -SUM OVER M 0.3937 0.3918 0.7856 0.0019 -pz 1 0.8688 0.8694 1.7381 -0.0006 -px 1 0.8688 0.8694 1.7381 -0.0006 -py 1 0.8688 0.8694 1.7381 -0.0006 -SUM OVER M 2.6063 2.6081 5.2144 -0.0019 -SUM OVER M+Zeta 3.0000 3.0000 5.9999 0.0000 + pz 1 0.1312 0.1306 0.2619 0.0006 + px 1 0.1312 0.1306 0.2619 0.0006 + py 1 0.1312 0.1306 0.2619 0.0006 + sum m 0.3937 0.3918 0.7856 0.0019 + pz 2 0.8688 0.8694 1.7381 -0.0006 + px 2 0.8688 0.8694 1.7381 -0.0006 + py 2 0.8688 0.8694 1.7381 -0.0006 + sum m 2.6063 2.6081 5.2144 -0.0019 + sum mz 3.0000 3.0000 5.9999 0.0000 -dz^2 0 0.0361 0.9999 1.0360 -0.9637 -dxz 0 0.3842 0.9997 1.3839 -0.6156 -dyz 0 0.3842 0.9997 1.3839 -0.6156 -dx^2-y^2 0 0.0361 0.9999 1.0360 -0.9637 -dxy 0 0.3842 0.9997 1.3839 -0.6156 -SUM OVER M 1.2248 4.9990 6.2238 -3.7742 -dz^2 1 0.0000 0.0000 0.0000 -0.0000 -dxz 1 0.0001 0.0001 0.0003 0.0000 -dyz 1 0.0001 0.0001 0.0003 0.0000 -dx^2-y^2 1 0.0000 0.0000 0.0000 -0.0000 -dxy 1 0.0001 0.0001 0.0003 0.0000 -SUM OVER M 0.0004 0.0005 0.0009 -0.0000 -SUM OVER M+Zeta 1.2252 4.9994 6.2246 -3.7742 + dz^2 1 0.0361 0.9999 1.0360 -0.9637 + dxz 1 0.3842 0.9997 1.3839 -0.6156 + dyz 1 0.3842 0.9997 1.3839 -0.6156 + dx^2-y^2 1 0.0361 0.9999 1.0360 -0.9637 + dxy 1 0.3842 0.9997 1.3839 -0.6156 + sum m 1.2248 4.9990 6.2238 -3.7742 + dz^2 2 0.0000 0.0000 0.0000 -0.0000 + dxz 2 0.0001 0.0001 0.0003 0.0000 + dyz 2 0.0001 0.0001 0.0003 0.0000 + dx^2-y^2 2 0.0000 0.0000 0.0000 -0.0000 + dxy 2 0.0001 0.0001 0.0003 0.0000 + sum m 0.0004 0.0005 0.0009 -0.0000 + sum mz 1.2252 4.9994 6.2246 -3.7742 -fz^3 0 0.0000 0.0000 0.0000 -0.0000 -fxz^2 0 0.0000 0.0000 0.0000 0.0000 -fyz^2 0 0.0000 0.0000 0.0000 0.0000 -fzx^2-zy^2 0 0.0000 0.0000 0.0000 0.0000 -fxyz 0 0.0000 0.0000 0.0000 -0.0000 -fx^3-3*xy^2 0 0.0000 0.0000 0.0000 0.0000 -f3yx^2-y^3 0 0.0000 0.0000 0.0000 0.0000 -SUM OVER M 0.0000 0.0000 0.0001 -0.0000 -SUM OVER M+Zeta 0.0000 0.0000 0.0001 -0.0000 + fz^3 1 0.0000 0.0000 0.0000 -0.0000 + fxz^2 1 0.0000 0.0000 0.0000 0.0000 + fyz^2 1 0.0000 0.0000 0.0000 0.0000 + fzx^2-zy^2 1 0.0000 0.0000 0.0000 0.0000 + fxyz 1 0.0000 0.0000 0.0000 -0.0000 + fx^3-3*xy^2 1 0.0000 0.0000 0.0000 0.0000 + f3yx^2-y^3 1 0.0000 0.0000 0.0000 0.0000 + sum m 0.0000 0.0000 0.0001 -0.0000 + sum mz 0.0000 0.0000 0.0001 -0.0000 -SUM OVER M+Zeta+L 6.0042 9.9958 16.0000 -3.9915 - -Total Charge on atom: Fe2 16.0000 -Total Magnetism on atom: Fe2 -3.9915 + sum lmz 6.0042 9.9958 16.0000 -3.9915 + total charge on atom 2 16.0000 + total magnetism on atom 2 -3.9915 diff --git a/tests/03_NAO_multik/11_NO_KP_AFM/mulliken.txt.ref b/tests/03_NAO_multik/11_NO_KP_AFM/mulliken.txt.ref index 76bb8d2130..e5f742addb 100644 --- a/tests/03_NAO_multik/11_NO_KP_AFM/mulliken.txt.ref +++ b/tests/03_NAO_multik/11_NO_KP_AFM/mulliken.txt.ref @@ -1,100 +1,105 @@ -STEP: 0 -CALCULATE THE MULLIkEN ANALYSIS FOR EACH ATOM - Total charge of spin 1: 16 - Total charge of spin 2: 16 - Total charge: 32 -Decomposed Mulliken populations -0 Zeta of Fe Spin 1 Spin 2 Sum Diff -s 0 0.8060 0.8060 1.6120 0.0000 -s 1 0.6171 0.6171 1.2342 -0.0000 -s 2 0.2479 0.2479 0.4958 0.0000 -s 3 -0.0100 -0.0100 -0.0199 -0.0000 -SUM OVER M+Zeta 1.6610 1.6610 3.3220 0.0000 + --- Ionic Step 1 --- + Total charge 32 + Total charge of spin1 16 + Total charge of spin2 16 + Decomposed Mulliken population analysis for each atom + l and m from Ylm, z stands for zeta orbital -pz 0 0.1563 0.1563 0.3126 0.0000 -px 0 0.1223 0.1223 0.2445 -0.0000 -py 0 0.1223 0.1223 0.2445 -0.0000 -SUM OVER M 0.4008 0.4008 0.8016 0.0000 -pz 1 0.9180 0.9180 1.8360 -0.0000 -px 1 0.8774 0.8774 1.7549 -0.0000 -py 1 0.8774 0.8774 1.7549 -0.0000 -SUM OVER M 2.6729 2.6729 5.3458 -0.0000 -SUM OVER M+Zeta 3.0737 3.0737 6.1474 0.0000 + ------------------ + Atom 1 is Fe + ------------------ + zeta spin1 spin2 sum diff + s 1 0.8060 0.8060 1.6120 0.0000 + s 2 0.6171 0.6171 1.2342 -0.0000 + s 3 0.2479 0.2479 0.4958 0.0000 + s 4 -0.0100 -0.0100 -0.0199 -0.0000 + sum mz 1.6610 1.6610 3.3220 0.0000 -dz^2 0 1.0103 1.0103 2.0207 -0.0000 -dxz 0 0.4572 0.4572 0.9145 -0.0000 -dyz 0 0.4572 0.4572 0.9145 -0.0000 -dx^2-y^2 0 1.0436 1.0436 2.0871 -0.0000 -dxy 0 0.0513 0.0513 0.1026 0.0000 -SUM OVER M 3.0197 3.0197 6.0394 0.0000 -dz^2 1 0.0083 0.0083 0.0165 0.0000 -dxz 1 0.0060 0.0060 0.0121 -0.0000 -dyz 1 0.0060 0.0060 0.0121 -0.0000 -dx^2-y^2 1 -0.0011 -0.0011 -0.0023 0.0000 -dxy 1 0.0097 0.0097 0.0195 -0.0000 -SUM OVER M 0.0289 0.0289 0.0578 -0.0000 -SUM OVER M+Zeta 3.0486 3.0486 6.0973 0.0000 + pz 1 0.1563 0.1563 0.3126 0.0000 + px 1 0.1223 0.1223 0.2445 -0.0000 + py 1 0.1223 0.1223 0.2445 -0.0000 + sum m 0.4008 0.4008 0.8016 0.0000 + pz 2 0.9180 0.9180 1.8360 -0.0000 + px 2 0.8774 0.8774 1.7549 -0.0000 + py 2 0.8774 0.8774 1.7549 -0.0000 + sum m 2.6729 2.6729 5.3458 -0.0000 + sum mz 3.0737 3.0737 6.1474 0.0000 -fz^3 0 0.0329 0.0329 0.0659 -0.0000 -fxz^2 0 -0.0003 -0.0003 -0.0005 -0.0000 -fyz^2 0 -0.0003 -0.0003 -0.0005 -0.0000 -fzx^2-zy^2 0 0.3515 0.3515 0.7029 0.0000 -fxyz 0 0.0119 0.0119 0.0238 -0.0000 -fx^3-3*xy^2 0 0.0325 0.0325 0.0651 0.0000 -f3yx^2-y^3 0 0.0325 0.0325 0.0651 0.0000 -SUM OVER M 0.4608 0.4608 0.9216 0.0000 -SUM OVER M+Zeta 0.4608 0.4608 0.9216 0.0000 + dz^2 1 1.0103 1.0103 2.0207 -0.0000 + dxz 1 0.4572 0.4572 0.9145 -0.0000 + dyz 1 0.4572 0.4572 0.9145 -0.0000 + dx^2-y^2 1 1.0436 1.0436 2.0871 -0.0000 + dxy 1 0.0513 0.0513 0.1026 0.0000 + sum m 3.0197 3.0197 6.0394 0.0000 + dz^2 2 0.0083 0.0083 0.0165 0.0000 + dxz 2 0.0060 0.0060 0.0121 -0.0000 + dyz 2 0.0060 0.0060 0.0121 -0.0000 + dx^2-y^2 2 -0.0011 -0.0011 -0.0023 0.0000 + dxy 2 0.0097 0.0097 0.0195 -0.0000 + sum m 0.0289 0.0289 0.0578 -0.0000 + sum mz 3.0486 3.0486 6.0973 0.0000 -SUM OVER M+Zeta+L 8.2441 8.2441 16.4883 0.0000 + fz^3 1 0.0329 0.0329 0.0659 -0.0000 + fxz^2 1 -0.0003 -0.0003 -0.0005 -0.0000 + fyz^2 1 -0.0003 -0.0003 -0.0005 -0.0000 + fzx^2-zy^2 1 0.3515 0.3515 0.7029 0.0000 + fxyz 1 0.0119 0.0119 0.0238 -0.0000 + fx^3-3*xy^2 1 0.0325 0.0325 0.0651 0.0000 + f3yx^2-y^3 1 0.0325 0.0325 0.0651 0.0000 + sum m 0.4608 0.4608 0.9216 0.0000 + sum mz 0.4608 0.4608 0.9216 0.0000 -Total Charge on atom: Fe 16.4883 -Total Magnetism on atom: Fe 0.0000 + sum lmz 8.2441 8.2441 16.4883 0.0000 + total charge on atom 1 16.4883 + total magnetism on atom 1 0.0000 -1 Zeta of Fe Spin 1 Spin 2 Sum Diff -s 0 0.8385 0.8385 1.6770 -0.0000 -s 1 0.5180 0.5180 1.0361 0.0000 -s 2 0.2561 0.2561 0.5121 -0.0000 -s 3 -0.0025 -0.0025 -0.0050 0.0000 -SUM OVER M+Zeta 1.6101 1.6101 3.2201 -0.0000 + ------------------ + Atom 2 is Fe + ------------------ + zeta spin1 spin2 sum diff + s 1 0.8385 0.8385 1.6770 -0.0000 + s 2 0.5180 0.5180 1.0361 0.0000 + s 3 0.2561 0.2561 0.5121 -0.0000 + s 4 -0.0025 -0.0025 -0.0050 0.0000 + sum mz 1.6101 1.6101 3.2201 -0.0000 -pz 0 0.1330 0.1330 0.2659 -0.0000 -px 0 0.1277 0.1277 0.2554 0.0000 -py 0 0.1277 0.1277 0.2554 0.0000 -SUM OVER M 0.3884 0.3884 0.7767 0.0000 -pz 1 0.9200 0.9200 1.8401 0.0000 -px 1 0.8966 0.8966 1.7932 0.0000 -py 1 0.8966 0.8966 1.7932 0.0000 -SUM OVER M 2.7132 2.7132 5.4264 0.0000 -SUM OVER M+Zeta 3.1016 3.1016 6.2031 0.0000 + pz 1 0.1330 0.1330 0.2659 -0.0000 + px 1 0.1277 0.1277 0.2554 0.0000 + py 1 0.1277 0.1277 0.2554 0.0000 + sum m 0.3884 0.3884 0.7767 0.0000 + pz 2 0.9200 0.9200 1.8401 0.0000 + px 2 0.8966 0.8966 1.7932 0.0000 + py 2 0.8966 0.8966 1.7932 0.0000 + sum m 2.7132 2.7132 5.4264 0.0000 + sum mz 3.1016 3.1016 6.2031 0.0000 -dz^2 0 0.0199 0.0199 0.0397 -0.0000 -dxz 0 0.8896 0.8896 1.7793 0.0000 -dyz 0 0.8896 0.8896 1.7793 0.0000 -dx^2-y^2 0 0.1493 0.1493 0.2987 -0.0000 -dxy 0 0.9083 0.9083 1.8167 0.0000 -SUM OVER M 2.8568 2.8568 5.7136 0.0000 -dz^2 1 0.0004 0.0004 0.0007 -0.0000 -dxz 1 0.0145 0.0145 0.0291 -0.0000 -dyz 1 0.0145 0.0145 0.0291 -0.0000 -dx^2-y^2 1 -0.0061 -0.0061 -0.0121 -0.0000 -dxy 1 0.0199 0.0199 0.0399 -0.0000 -SUM OVER M 0.0433 0.0433 0.0867 -0.0000 -SUM OVER M+Zeta 2.9001 2.9001 5.8003 -0.0000 + dz^2 1 0.0199 0.0199 0.0397 -0.0000 + dxz 1 0.8896 0.8896 1.7793 0.0000 + dyz 1 0.8896 0.8896 1.7793 0.0000 + dx^2-y^2 1 0.1493 0.1493 0.2987 -0.0000 + dxy 1 0.9083 0.9083 1.8167 0.0000 + sum m 2.8568 2.8568 5.7136 0.0000 + dz^2 2 0.0004 0.0004 0.0007 -0.0000 + dxz 2 0.0145 0.0145 0.0291 -0.0000 + dyz 2 0.0145 0.0145 0.0291 -0.0000 + dx^2-y^2 2 -0.0061 -0.0061 -0.0121 -0.0000 + dxy 2 0.0199 0.0199 0.0399 -0.0000 + sum m 0.0433 0.0433 0.0867 -0.0000 + sum mz 2.9001 2.9001 5.8003 -0.0000 -fz^3 0 0.0299 0.0299 0.0598 -0.0000 -fxz^2 0 0.0059 0.0059 0.0118 0.0000 -fyz^2 0 0.0059 0.0059 0.0118 0.0000 -fzx^2-zy^2 0 -0.0386 -0.0386 -0.0773 0.0000 -fxyz 0 0.0001 0.0001 0.0001 0.0000 -fx^3-3*xy^2 0 0.0705 0.0705 0.1410 0.0000 -f3yx^2-y^3 0 0.0705 0.0705 0.1410 0.0000 -SUM OVER M 0.1441 0.1441 0.2882 0.0000 -SUM OVER M+Zeta 0.1441 0.1441 0.2882 0.0000 + fz^3 1 0.0299 0.0299 0.0598 -0.0000 + fxz^2 1 0.0059 0.0059 0.0118 0.0000 + fyz^2 1 0.0059 0.0059 0.0118 0.0000 + fzx^2-zy^2 1 -0.0386 -0.0386 -0.0773 0.0000 + fxyz 1 0.0001 0.0001 0.0001 0.0000 + fx^3-3*xy^2 1 0.0705 0.0705 0.1410 0.0000 + f3yx^2-y^3 1 0.0705 0.0705 0.1410 0.0000 + sum m 0.1441 0.1441 0.2882 0.0000 + sum mz 0.1441 0.1441 0.2882 0.0000 -SUM OVER M+Zeta+L 7.7559 7.7559 15.5117 -0.0000 - -Total Charge on atom: Fe 15.5117 -Total Magnetism on atom: Fe -0.0000 + sum lmz 7.7559 7.7559 15.5117 -0.0000 + total charge on atom 2 15.5117 + total magnetism on atom 2 -0.0000 diff --git a/tests/03_NAO_multik/14_NO_KP_NC/mulliken.txt.ref b/tests/03_NAO_multik/14_NO_KP_NC/mulliken.txt.ref index 2322f10724..837fb51bfa 100644 --- a/tests/03_NAO_multik/14_NO_KP_NC/mulliken.txt.ref +++ b/tests/03_NAO_multik/14_NO_KP_NC/mulliken.txt.ref @@ -1,98 +1,103 @@ -STEP: 0 -CALCULATE THE MULLIkEN ANALYSIS FOR EACH ATOM - Total charge: 32 -Decomposed Mulliken populations -0 Zeta of Fe Spin 1 Spin 2 Spin 3 Spin 4 -s 0 1.4819 -0.0042 -0.0000 0.0000 -s 1 1.1240 0.0128 0.0000 0.0000 -s 2 0.4194 -0.0019 0.0000 -0.0000 -s 3 -0.0253 0.0009 0.0000 -0.0000 -SUM OVER M+Zeta 3.0000 0.0075 -0.0000 0.0000 + --- Ionic Step 1 --- + Total charge 32 + Decomposed Mulliken population analysis for each atom + l and m from Ylm, z stands for zeta orbital -pz 0 0.2288 0.0004 0.0000 -0.0000 -px 0 0.2288 0.0004 0.0000 -0.0000 -py 0 0.2288 0.0004 0.0000 -0.0000 -SUM OVER M 0.6863 0.0011 0.0000 -0.0000 -pz 1 1.7550 0.0005 0.0000 0.0000 -px 1 1.7550 0.0005 0.0000 0.0000 -py 1 1.7550 0.0005 0.0000 0.0000 -SUM OVER M 5.2650 0.0016 0.0000 0.0000 -SUM OVER M+Zeta 5.9514 0.0026 0.0000 0.0000 + ------------------ + Atom 1 is Fe + ------------------ + zeta spin1 spin2 spin3 spin4 + s 1 1.4819 -0.0042 0.0000 -0.0000 + s 2 1.1240 0.0128 0.0000 -0.0000 + s 3 0.4194 -0.0019 -0.0000 -0.0000 + s 4 -0.0253 0.0009 0.0000 0.0000 + sum mz 3.0000 0.0075 -0.0000 -0.0000 -dz^2 0 1.8128 0.0191 0.0000 0.0000 -dxz 0 1.0631 0.3911 -0.0000 0.0000 -dyz 0 1.0631 0.3911 -0.0000 0.0000 -dx^2-y^2 0 1.8128 0.0191 0.0000 0.0000 -dxy 0 1.0631 0.3911 -0.0000 0.0000 -SUM OVER M 6.8147 1.2116 0.0000 0.0000 -dz^2 1 0.0040 0.0000 0.0000 0.0000 -dxz 1 0.0591 -0.0100 0.0000 0.0000 -dyz 1 0.0591 -0.0100 0.0000 0.0000 -dx^2-y^2 1 0.0040 0.0000 0.0000 0.0000 -dxy 1 0.0591 -0.0100 0.0000 0.0000 -SUM OVER M 0.1853 -0.0298 0.0000 0.0000 -SUM OVER M+Zeta 7.0000 1.1818 0.0000 0.0000 + pz 1 0.2288 0.0004 0.0000 -0.0000 + px 1 0.2288 0.0004 0.0000 -0.0000 + py 1 0.2288 0.0004 0.0000 -0.0000 + sum m 0.6863 0.0011 0.0000 -0.0000 + pz 2 1.7550 0.0005 0.0000 0.0000 + px 2 1.7550 0.0005 0.0000 0.0000 + py 2 1.7550 0.0005 0.0000 0.0000 + sum m 5.2650 0.0016 0.0000 0.0000 + sum mz 5.9514 0.0026 0.0000 -0.0000 -fz^3 0 0.0162 0.0017 0.0000 0.0000 -fxz^2 0 0.0061 0.0006 0.0000 0.0000 -fyz^2 0 0.0061 0.0006 0.0000 0.0000 -fzx^2-zy^2 0 0.0000 0.0000 0.0000 0.0000 -fxyz 0 0.0000 0.0000 0.0000 0.0000 -fx^3-3*xy^2 0 0.0101 0.0011 0.0000 0.0000 -f3yx^2-y^3 0 0.0101 0.0011 0.0000 0.0000 -SUM OVER M 0.0486 0.0051 0.0000 0.0000 -SUM OVER M+Zeta 0.0486 0.0051 0.0000 0.0000 + dz^2 1 1.8128 0.0191 -0.0000 -0.0000 + dxz 1 1.0631 0.3911 0.0000 0.0000 + dyz 1 1.0631 0.3911 0.0000 0.0000 + dx^2-y^2 1 1.8128 0.0191 -0.0000 -0.0000 + dxy 1 1.0631 0.3911 0.0000 0.0000 + sum m 6.8147 1.2116 -0.0000 -0.0000 + dz^2 2 0.0040 0.0000 0.0000 0.0000 + dxz 2 0.0591 -0.0100 0.0000 0.0000 + dyz 2 0.0591 -0.0100 0.0000 0.0000 + dx^2-y^2 2 0.0040 0.0000 0.0000 0.0000 + dxy 2 0.0591 -0.0100 0.0000 0.0000 + sum m 0.1853 -0.0298 0.0000 0.0000 + sum mz 7.0000 1.1818 -0.0000 -0.0000 -SUM OVER M+Zeta+L 16.0000 1.1970 0.0000 0.0000 + fz^3 1 0.0162 0.0017 0.0000 0.0000 + fxz^2 1 0.0061 0.0006 0.0000 0.0000 + fyz^2 1 0.0061 0.0006 0.0000 0.0000 + fzx^2-zy^2 1 0.0000 0.0000 0.0000 0.0000 + fxyz 1 0.0000 0.0000 0.0000 0.0000 + fx^3-3*xy^2 1 0.0101 0.0011 0.0000 0.0000 + f3yx^2-y^3 1 0.0101 0.0011 0.0000 0.0000 + sum m 0.0486 0.0051 0.0000 0.0000 + sum mz 0.0486 0.0051 0.0000 0.0000 -Total Charge on atom: Fe 16.0000 -Total Magnetism on atom: Fe 1.1970 0.0000 0.0000 + sum lmz 16.0000 1.1970 -0.0000 -0.0000 + total charge on atom 1 16.0000 + total magnetism on atom 1 1.1970 -0.0000 -0.0000 -1 Zeta of Fe Spin 1 Spin 2 Spin 3 Spin 4 -s 0 1.4819 0.0042 -0.0000 0.0000 -s 1 1.1240 -0.0128 0.0000 0.0000 -s 2 0.4194 0.0019 0.0000 -0.0000 -s 3 -0.0253 -0.0009 0.0000 -0.0000 -SUM OVER M+Zeta 3.0000 -0.0075 -0.0000 -0.0000 + ------------------ + Atom 2 is Fe + ------------------ + zeta spin1 spin2 spin3 spin4 + s 1 1.4819 0.0042 0.0000 0.0000 + s 2 1.1240 -0.0128 0.0000 0.0000 + s 3 0.4194 0.0019 0.0000 -0.0000 + s 4 -0.0253 -0.0009 0.0000 -0.0000 + sum mz 3.0000 -0.0075 0.0000 0.0000 -pz 0 0.2288 -0.0004 0.0000 -0.0000 -px 0 0.2288 -0.0004 0.0000 -0.0000 -py 0 0.2288 -0.0004 0.0000 -0.0000 -SUM OVER M 0.6863 -0.0011 0.0000 -0.0000 -pz 1 1.7550 -0.0005 0.0000 0.0000 -px 1 1.7550 -0.0005 0.0000 0.0000 -py 1 1.7550 -0.0005 0.0000 0.0000 -SUM OVER M 5.2650 -0.0016 0.0000 0.0000 -SUM OVER M+Zeta 5.9514 -0.0026 0.0000 -0.0000 + pz 1 0.2288 -0.0004 0.0000 0.0000 + px 1 0.2288 -0.0004 0.0000 0.0000 + py 1 0.2288 -0.0004 0.0000 0.0000 + sum m 0.6863 -0.0011 0.0000 0.0000 + pz 2 1.7550 -0.0005 0.0000 0.0000 + px 2 1.7550 -0.0005 0.0000 0.0000 + py 2 1.7550 -0.0005 0.0000 0.0000 + sum m 5.2650 -0.0016 0.0000 0.0000 + sum mz 5.9514 -0.0026 0.0000 0.0000 -dz^2 0 1.8128 -0.0191 0.0000 -0.0000 -dxz 0 1.0631 -0.3911 -0.0000 0.0000 -dyz 0 1.0631 -0.3911 -0.0000 0.0000 -dx^2-y^2 0 1.8128 -0.0191 0.0000 -0.0000 -dxy 0 1.0631 -0.3911 -0.0000 0.0000 -SUM OVER M 6.8147 -1.2116 0.0000 -0.0000 -dz^2 1 0.0040 -0.0000 0.0000 0.0000 -dxz 1 0.0591 0.0100 0.0000 0.0000 -dyz 1 0.0591 0.0100 0.0000 0.0000 -dx^2-y^2 1 0.0040 -0.0000 0.0000 0.0000 -dxy 1 0.0591 0.0100 0.0000 0.0000 -SUM OVER M 0.1853 0.0298 0.0000 0.0000 -SUM OVER M+Zeta 7.0000 -1.1818 0.0000 -0.0000 + dz^2 1 1.8128 -0.0191 -0.0000 0.0000 + dxz 1 1.0631 -0.3911 0.0000 -0.0000 + dyz 1 1.0631 -0.3911 0.0000 -0.0000 + dx^2-y^2 1 1.8128 -0.0191 -0.0000 0.0000 + dxy 1 1.0631 -0.3911 0.0000 -0.0000 + sum m 6.8147 -1.2116 -0.0000 0.0000 + dz^2 2 0.0040 -0.0000 0.0000 0.0000 + dxz 2 0.0591 0.0100 0.0000 0.0000 + dyz 2 0.0591 0.0100 0.0000 0.0000 + dx^2-y^2 2 0.0040 -0.0000 0.0000 0.0000 + dxy 2 0.0591 0.0100 0.0000 0.0000 + sum m 0.1853 0.0298 0.0000 0.0000 + sum mz 7.0000 -1.1818 -0.0000 0.0000 -fz^3 0 0.0162 -0.0017 0.0000 0.0000 -fxz^2 0 0.0061 -0.0006 0.0000 0.0000 -fyz^2 0 0.0061 -0.0006 0.0000 0.0000 -fzx^2-zy^2 0 0.0000 0.0000 0.0000 0.0000 -fxyz 0 0.0000 0.0000 0.0000 0.0000 -fx^3-3*xy^2 0 0.0101 -0.0011 0.0000 0.0000 -f3yx^2-y^3 0 0.0101 -0.0011 0.0000 0.0000 -SUM OVER M 0.0486 -0.0051 0.0000 0.0000 -SUM OVER M+Zeta 0.0486 -0.0051 0.0000 0.0000 + fz^3 1 0.0162 -0.0017 0.0000 -0.0000 + fxz^2 1 0.0061 -0.0006 0.0000 0.0000 + fyz^2 1 0.0061 -0.0006 0.0000 0.0000 + fzx^2-zy^2 1 0.0000 0.0000 0.0000 0.0000 + fxyz 1 0.0000 0.0000 0.0000 0.0000 + fx^3-3*xy^2 1 0.0101 -0.0011 0.0000 -0.0000 + f3yx^2-y^3 1 0.0101 -0.0011 0.0000 -0.0000 + sum m 0.0486 -0.0051 0.0000 -0.0000 + sum mz 0.0486 -0.0051 0.0000 -0.0000 -SUM OVER M+Zeta+L 16.0000 -1.1970 0.0000 -0.0000 - -Total Charge on atom: Fe 16.0000 -Total Magnetism on atom: Fe -1.1970 0.0000 -0.0000 + sum lmz 16.0000 -1.1970 -0.0000 0.0000 + total charge on atom 2 16.0000 + total magnetism on atom 2 -1.1970 -0.0000 0.0000 diff --git a/tests/03_NAO_multik/31_NO_KP_nupdown0/mulliken.txt.ref b/tests/03_NAO_multik/31_NO_KP_nupdown0/mulliken.txt.ref index 89b3f5b3ab..6b62c3db24 100644 --- a/tests/03_NAO_multik/31_NO_KP_nupdown0/mulliken.txt.ref +++ b/tests/03_NAO_multik/31_NO_KP_nupdown0/mulliken.txt.ref @@ -1,64 +1,69 @@ -STEP: 0 -CALCULATE THE MULLIkEN ANALYSIS FOR EACH ATOM - Total charge of spin 1: 4.5 - Total charge of spin 2: 4.5 - Total charge: 9 -Decomposed Mulliken populations -0 Zeta of Si Spin 1 Spin 2 Sum Diff -s 0 0.6711 0.6711 1.3422 0.0000 -s 1 0.0029 0.0029 0.0058 -0.0000 -SUM OVER M+Zeta 0.6740 0.6740 1.3480 0.0000 + --- Ionic Step 1 --- + Total charge 9 + Total charge of spin1 4.5 + Total charge of spin2 4.5 + Decomposed Mulliken population analysis for each atom + l and m from Ylm, z stands for zeta orbital -pz 0 0.3982 0.3982 0.7964 -0.0000 -px 0 0.3836 0.3836 0.7673 -0.0000 -py 0 0.3836 0.3836 0.7673 -0.0000 -SUM OVER M 1.1655 1.1655 2.3310 -0.0000 -pz 1 0.0542 0.0542 0.1084 -0.0000 -px 1 0.0519 0.0519 0.1037 0.0000 -py 1 0.0519 0.0519 0.1037 0.0000 -SUM OVER M 0.1579 0.1579 0.3158 0.0000 -SUM OVER M+Zeta 1.3234 1.3234 2.6468 -0.0000 + ------------------ + Atom 1 is Si + ------------------ + zeta spin1 spin2 sum diff + s 1 0.6711 0.6711 1.3422 0.0000 + s 2 0.0029 0.0029 0.0058 -0.0000 + sum mz 0.6740 0.6740 1.3480 0.0000 -dz^2 0 0.0051 0.0051 0.0102 0.0000 -dxz 0 0.0814 0.0814 0.1629 0.0000 -dyz 0 0.0814 0.0814 0.1629 0.0000 -dx^2-y^2 0 0.0079 0.0079 0.0157 -0.0000 -dxy 0 0.0779 0.0779 0.1557 -0.0000 -SUM OVER M 0.2537 0.2537 0.5075 0.0000 -SUM OVER M+Zeta 0.2537 0.2537 0.5075 0.0000 + pz 1 0.3982 0.3982 0.7964 -0.0000 + px 1 0.3836 0.3836 0.7673 -0.0000 + py 1 0.3836 0.3836 0.7673 -0.0000 + sum m 1.1655 1.1655 2.3310 -0.0000 + pz 2 0.0542 0.0542 0.1084 -0.0000 + px 2 0.0519 0.0519 0.1037 0.0000 + py 2 0.0519 0.0519 0.1037 0.0000 + sum m 0.1579 0.1579 0.3158 0.0000 + sum mz 1.3234 1.3234 2.6468 -0.0000 -SUM OVER M+Zeta+L 2.2512 2.2512 4.5023 -0.0000 + dz^2 1 0.0051 0.0051 0.0102 0.0000 + dxz 1 0.0814 0.0814 0.1629 0.0000 + dyz 1 0.0814 0.0814 0.1629 0.0000 + dx^2-y^2 1 0.0079 0.0079 0.0157 -0.0000 + dxy 1 0.0779 0.0779 0.1557 -0.0000 + sum m 0.2537 0.2537 0.5075 0.0000 + sum mz 0.2537 0.2537 0.5075 0.0000 -Total Charge on atom: Si 4.5023 -Total Magnetism on atom: Si -0.0000 + sum lmz 2.2512 2.2512 4.5023 -0.0000 + total charge on atom 1 4.5023 + total magnetism on atom 1 -0.0000 -1 Zeta of Si Spin 1 Spin 2 Sum Diff -s 0 0.6704 0.6704 1.3407 0.0000 -s 1 0.0021 0.0021 0.0041 -0.0000 -SUM OVER M+Zeta 0.6724 0.6724 1.3449 0.0000 + ------------------ + Atom 2 is Si + ------------------ + zeta spin1 spin2 sum diff + s 1 0.6704 0.6704 1.3407 0.0000 + s 2 0.0021 0.0021 0.0041 -0.0000 + sum mz 0.6724 0.6724 1.3449 0.0000 -pz 0 0.3958 0.3958 0.7917 -0.0000 -px 0 0.3828 0.3828 0.7657 -0.0000 -py 0 0.3828 0.3828 0.7657 -0.0000 -SUM OVER M 1.1615 1.1615 2.3230 -0.0000 -pz 1 0.0548 0.0548 0.1095 -0.0000 -px 1 0.0527 0.0527 0.1055 0.0000 -py 1 0.0527 0.0527 0.1055 0.0000 -SUM OVER M 0.1602 0.1602 0.3205 0.0000 -SUM OVER M+Zeta 1.3217 1.3217 2.6435 -0.0000 + pz 1 0.3958 0.3958 0.7917 -0.0000 + px 1 0.3828 0.3828 0.7657 -0.0000 + py 1 0.3828 0.3828 0.7657 -0.0000 + sum m 1.1615 1.1615 2.3230 -0.0000 + pz 2 0.0548 0.0548 0.1095 -0.0000 + px 2 0.0527 0.0527 0.1055 0.0000 + py 2 0.0527 0.0527 0.1055 0.0000 + sum m 0.1602 0.1602 0.3205 0.0000 + sum mz 1.3217 1.3217 2.6435 -0.0000 -dz^2 0 0.0051 0.0051 0.0103 0.0000 -dxz 0 0.0817 0.0817 0.1634 0.0000 -dyz 0 0.0817 0.0817 0.1634 0.0000 -dx^2-y^2 0 0.0079 0.0079 0.0158 -0.0000 -dxy 0 0.0783 0.0783 0.1565 -0.0000 -SUM OVER M 0.2547 0.2547 0.5093 0.0000 -SUM OVER M+Zeta 0.2547 0.2547 0.5093 0.0000 + dz^2 1 0.0051 0.0051 0.0103 0.0000 + dxz 1 0.0817 0.0817 0.1634 0.0000 + dyz 1 0.0817 0.0817 0.1634 0.0000 + dx^2-y^2 1 0.0079 0.0079 0.0158 -0.0000 + dxy 1 0.0783 0.0783 0.1565 -0.0000 + sum m 0.2547 0.2547 0.5093 0.0000 + sum mz 0.2547 0.2547 0.5093 0.0000 -SUM OVER M+Zeta+L 2.2488 2.2488 4.4977 0.0000 - -Total Charge on atom: Si 4.4977 -Total Magnetism on atom: Si 0.0000 + sum lmz 2.2488 2.2488 4.4977 0.0000 + total charge on atom 2 4.4977 + total magnetism on atom 2 0.0000 diff --git a/tests/03_NAO_multik/36_NO_KP_MU/mulliken.txt.ref b/tests/03_NAO_multik/36_NO_KP_MU/mulliken.txt.ref index 32e657b09e..54b2d9a58c 100644 --- a/tests/03_NAO_multik/36_NO_KP_MU/mulliken.txt.ref +++ b/tests/03_NAO_multik/36_NO_KP_MU/mulliken.txt.ref @@ -1,36 +1,41 @@ -STEP: 0 -CALCULATE THE MULLIkEN ANALYSIS FOR EACH ATOM - Total charge: 2 -Decomposed Mulliken populations -0 Zeta of H Spin 1 -s 0 0.9980 -s 1 -0.0051 -SUM OVER M+Zeta 0.9929 - -pz 0 0.0071 -px 0 0.0000 -py 0 0.0000 -SUM OVER M 0.0071 -SUM OVER M+Zeta 0.0071 - -SUM OVER M+Zeta+L 1.0000 - -Total Charge on atom: H 1.0000 - - -1 Zeta of H Spin 1 -s 0 0.9980 -s 1 -0.0051 -SUM OVER M+Zeta 0.9929 - -pz 0 0.0071 -px 0 0.0000 -py 0 0.0000 -SUM OVER M 0.0071 -SUM OVER M+Zeta 0.0071 - -SUM OVER M+Zeta+L 1.0000 - -Total Charge on atom: H 1.0000 - + --- Ionic Step 1 --- + Total charge 2 + Decomposed Mulliken population analysis for each atom + l and m from Ylm, z stands for zeta orbital + + ------------------ + Atom 1 is H + ------------------ + zeta spin1 + s 1 0.9980 + s 2 -0.0051 + sum mz 0.9929 + + pz 1 0.0071 + px 1 0.0000 + py 1 0.0000 + sum m 0.0071 + sum mz 0.0071 + + sum lmz 1.0000 + + total charge on atom 1 1.0000 + + ------------------ + Atom 2 is H + ------------------ + zeta spin1 + s 1 0.9980 + s 2 -0.0051 + sum mz 0.9929 + + pz 1 0.0071 + px 1 0.0000 + py 1 0.0000 + sum m 0.0071 + sum mz 0.0071 + + sum lmz 1.0000 + + total charge on atom 2 1.0000 diff --git a/tests/03_NAO_multik/37_NO_KP_MU_nscf/mulliken.txt.ref b/tests/03_NAO_multik/37_NO_KP_MU_nscf/mulliken.txt.ref index 0d258f425a..63c759e0d5 100644 --- a/tests/03_NAO_multik/37_NO_KP_MU_nscf/mulliken.txt.ref +++ b/tests/03_NAO_multik/37_NO_KP_MU_nscf/mulliken.txt.ref @@ -1,36 +1,41 @@ -STEP: 0 -CALCULATE THE MULLIkEN ANALYSIS FOR EACH ATOM - Total charge: 2 -Decomposed Mulliken populations -0 Zeta of H Spin 1 -s 0 1.6850 -s 1 -0.6850 -SUM OVER M+Zeta 1.0000 - -pz 0 0.0000 -px 0 0.0000 -py 0 0.0000 -SUM OVER M 0.0000 -SUM OVER M+Zeta 0.0000 - -SUM OVER M+Zeta+L 1.0000 - -Total Charge on atom: H 1.0000 - - -1 Zeta of H Spin 1 -s 0 1.6850 -s 1 -0.6850 -SUM OVER M+Zeta 1.0000 - -pz 0 0.0000 -px 0 0.0000 -py 0 0.0000 -SUM OVER M 0.0000 -SUM OVER M+Zeta 0.0000 - -SUM OVER M+Zeta+L 1.0000 - -Total Charge on atom: H 1.0000 - + --- Ionic Step 1 --- + Total charge 2 + Decomposed Mulliken population analysis for each atom + l and m from Ylm, z stands for zeta orbital + + ------------------ + Atom 1 is H + ------------------ + zeta spin1 + s 1 1.6850 + s 2 -0.6850 + sum mz 1.0000 + + pz 1 0.0000 + px 1 0.0000 + py 1 0.0000 + sum m 0.0000 + sum mz 0.0000 + + sum lmz 1.0000 + + total charge on atom 1 1.0000 + + ------------------ + Atom 2 is H + ------------------ + zeta spin1 + s 1 1.6850 + s 2 -0.6850 + sum mz 1.0000 + + pz 1 0.0000 + px 1 0.0000 + py 1 0.0000 + sum m 0.0000 + sum mz 0.0000 + + sum lmz 1.0000 + + total charge on atom 2 1.0000 From 58f40b1f90013f8d13c61699454554c75cfb7712 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sat, 21 Feb 2026 06:33:45 +0800 Subject: [PATCH 32/32] update mulliken test to match new output format --- .../source_io/test/output_mulliken_test.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source/source_io/test/output_mulliken_test.cpp b/source/source_io/test/output_mulliken_test.cpp index a4938ecaba..56a53d0ed9 100644 --- a/source/source_io/test/output_mulliken_test.cpp +++ b/source/source_io/test/output_mulliken_test.cpp @@ -49,8 +49,8 @@ TYPED_TEST(OutputMullikenTest, nspin1) EXPECT_NEAR(tot_chg[0], 4.0, 1e-5); std::ifstream ifs("./mulliken.txt"); std::string str((std::istreambuf_iterator(ifs)), std::istreambuf_iterator()); - EXPECT_THAT(str, testing::HasSubstr("Total charge:\t4")); - EXPECT_THAT(str, testing::HasSubstr("Total Charge on atom: Si 4.0000")); + EXPECT_THAT(str, testing::HasSubstr(" Total charge 4")); + EXPECT_THAT(str, testing::HasSubstr(" total charge on atom 1 4.0000")); remove("./mulliken.txt"); } @@ -69,11 +69,11 @@ TYPED_TEST(OutputMullikenTest, nspin2) EXPECT_NEAR(tot_chg[1], 1.0, 1e-5); std::ifstream ifs("./mulliken.txt"); std::string str((std::istreambuf_iterator(ifs)), std::istreambuf_iterator()); - EXPECT_THAT(str, testing::HasSubstr("Total charge:\t4")); - EXPECT_THAT(str, testing::HasSubstr("Total charge of spin 1:\t3")); - EXPECT_THAT(str, testing::HasSubstr("Total charge of spin 2:\t1")); - EXPECT_THAT(str, testing::HasSubstr("Total Charge on atom: Si 4.0000")); - EXPECT_THAT(str, testing::HasSubstr("Total Magnetism on atom: Si 2.0000")); + EXPECT_THAT(str, testing::HasSubstr(" Total charge 4")); + EXPECT_THAT(str, testing::HasSubstr(" Total charge of spin1 3")); + EXPECT_THAT(str, testing::HasSubstr(" Total charge of spin2 1")); + EXPECT_THAT(str, testing::HasSubstr(" total charge on atom 1 4.0000")); + EXPECT_THAT(str, testing::HasSubstr(" total magnetism on atom 1 2.0000")); remove("./mulliken.txt"); } @@ -95,12 +95,12 @@ TYPED_TEST(OutputMullikenTest, nspin4) EXPECT_NEAR(tot_chg[3], 2.0, 1e-5); std::ifstream ifs("./mulliken.txt"); std::string str((std::istreambuf_iterator(ifs)), std::istreambuf_iterator()); - EXPECT_THAT(str, testing::HasSubstr("Total charge:\t4")); - EXPECT_THAT(str, testing::HasSubstr("Total Charge on atom: Si 4.0000")); + EXPECT_THAT(str, testing::HasSubstr(" Total charge 4")); + EXPECT_THAT(str, testing::HasSubstr(" total charge on atom 1 4.0000")); EXPECT_THAT( str, testing::HasSubstr( - "Total Magnetism on atom: Si 0.0000 0.0000 2.0000")); + " total magnetism on atom 1 0.0000 0.0000 2.0000")); remove("./mulliken.txt"); }