From b4365854374e0287980434817bae41cddfb18f9e Mon Sep 17 00:00:00 2001 From: maki49 <1579492865@qq.com> Date: Fri, 26 Jul 2024 21:58:29 +0800 Subject: [PATCH] add .dat and rename eband_separate_term as eband_terms --- docs/advanced/input_files/input-main.md | 8 ++++---- source/module_esolver/esolver_ks_lcao.cpp | 6 +++--- source/module_io/read_input_item_output.cpp | 4 ++-- source/module_io/test/read_input_ptest.cpp | 4 ++-- source/module_io/write_Vxc.hpp | 2 +- source/module_io/write_Vxc_lip.hpp | 2 +- ...e_eband_separate_term.hpp => write_eband_terms.hpp} | 8 ++++---- source/module_parameter/input_parameter.h | 2 +- tests/integrate/207_NO_KP_OXC/INPUT | 2 +- tests/integrate/307_NO_GO_OXC/INPUT | 2 +- tests/integrate/tools/catch_properties.sh | 10 +++++----- 11 files changed, 25 insertions(+), 25 deletions(-) rename source/module_io/{write_eband_separate_term.hpp => write_eband_terms.hpp} (95%) diff --git a/docs/advanced/input_files/input-main.md b/docs/advanced/input_files/input-main.md index cc38059a64..2395c02212 100644 --- a/docs/advanced/input_files/input-main.md +++ b/docs/advanced/input_files/input-main.md @@ -147,7 +147,7 @@ - [out\_mat\_t](#out_mat_t) - [out\_mat\_dh](#out_mat_dh) - [out\_mat\_xc](#out_mat_xc) - - [out\_eband\_separate\_term](#out_eband_separate_term) + - [out\_eband\_separate\_term](#out_eband_terms) - [out\_hr\_npz/out\_dm\_npz](#out_hr_npzout_dm_npz) - [dm\_to\_rho](#dm_to_rho) - [out\_app\_flag](#out_app_flag) @@ -1683,14 +1683,14 @@ These variables are used to control the output of properties. - **Type**: Boolean - **Availability**: Numerical atomic orbital (NAO) and NAO-in-PW basis - **Description**: Whether to print the upper triangular part of the exchange-correlation matrices in **Kohn-Sham orbital representation** (unit: Ry): $\braket{\psi_i|V_\text{xc}^\text{(semi-)local}+V_\text{exx}+V_\text{DFTU}|\psi_j}$ for each k point into files in the directory `OUT.${suffix}`, which is useful for the subsequent GW calculation. (Note that currently DeePKS term is not included. ) The files are named `k-$k-Vxc`, the meaning of `$k`corresponding to k point and spin is same as [hs_matrix.md](../elec_properties/hs_matrix.md#out_mat_hs). -The band (KS orbital) energy for each (k-point, spin, band) will be printed in the file `OUT.${suffix}/vxc_out`. If EXX is calculated, the local and EXX part of band energy will also be printed in `OUT.${suffix}/vxc_local_out`and `OUT.${suffix}/vxc_exx_out`, respectively. All the `vxc*_out` files contains 3 integers (nk, nspin, nband) followed by nk\*nspin\*nband lines of energy Hartree and eV. +The band (KS orbital) energy for each (k-point, spin, band) will be printed in the file `OUT.${suffix}/vxc_out.dat`. If EXX is calculated, the local and EXX part of band energy will also be printed in `OUT.${suffix}/vxc_local_out.dat`and `OUT.${suffix}/vxc_exx_out.dat`, respectively. All the `vxc*_out.dat` files contains 3 integers (nk, nspin, nband) followed by nk\*nspin\*nband lines of energy Hartree and eV. - **Default**: False -### out_eband_separate_term +### out_eband_terms - **Type**: Boolean - **Availability**: Numerical atomic orbital basis -- **Description**: Whether to print the band energy terms separately in the file `OUT.${suffix}/${term}_out`. The terms include the kinetic, pseudopotential (local + nonlocal), Hartree and exchange-correlation (including exact exchange if calculated). +- **Description**: Whether to print the band energy terms separately in the file `OUT.${suffix}/${term}_out.dat`. The terms include the kinetic, pseudopotential (local + nonlocal), Hartree and exchange-correlation (including exact exchange if calculated). - **Default**: False ### out_hr_npz/out_dm_npz diff --git a/source/module_esolver/esolver_ks_lcao.cpp b/source/module_esolver/esolver_ks_lcao.cpp index 0cec8e3c38..abe368aa5f 100644 --- a/source/module_esolver/esolver_ks_lcao.cpp +++ b/source/module_esolver/esolver_ks_lcao.cpp @@ -11,7 +11,7 @@ #include "module_io/to_qo.h" #include "module_io/write_HS.h" #include "module_io/write_Vxc.hpp" -#include "module_io/write_eband_separate_term.hpp" +#include "module_io/write_eband_terms.hpp" #include "module_io/write_istate_info.h" #include "module_io/write_proj_band_lcao.h" #include "module_parameter/parameter.h" @@ -522,9 +522,9 @@ void ESolver_KS_LCAO::after_all_runners() ); } - if (PARAM.inp.out_eband_separate_term) + if (PARAM.inp.out_eband_terms) { - ModuleIO::write_eband_separate_term(GlobalV::NSPIN, + ModuleIO::write_eband_terms(GlobalV::NSPIN, GlobalV::NLOCAL, GlobalV::DRANK, &this->ParaV, diff --git a/source/module_io/read_input_item_output.cpp b/source/module_io/read_input_item_output.cpp index 8c3dd0c7db..16ab5e6f79 100644 --- a/source/module_io/read_input_item_output.cpp +++ b/source/module_io/read_input_item_output.cpp @@ -268,9 +268,9 @@ void ReadInput::item_output() this->add_item(item); } { - Input_Item item("out_eband_separate_term"); + Input_Item item("out_eband_terms"); item.annotation = "output the band energy terms separately"; - read_sync_bool(input.out_eband_separate_term); + read_sync_bool(input.out_eband_terms); this->add_item(item); } { diff --git a/source/module_io/test/read_input_ptest.cpp b/source/module_io/test/read_input_ptest.cpp index 63d4335582..63c80b456c 100644 --- a/source/module_io/test/read_input_ptest.cpp +++ b/source/module_io/test/read_input_ptest.cpp @@ -196,8 +196,8 @@ TEST_F(InputParaTest, ParaRead) EXPECT_EQ(param.inp.out_mat_hs[0], 0); EXPECT_EQ(param.inp.out_mat_hs[1], 8); EXPECT_EQ(param.inp.out_mat_hs2, 0); - EXPECT_EQ(param.inp.out_mat_xc, 0); - EXPECT_EQ(param.inp.out_eband_separate_term, 0); + EXPECT_FALSE(param.inp.out_mat_xc); + EXPECT_FALSE(param.inp.out_eband_terms); EXPECT_EQ(param.inp.out_interval, 1); EXPECT_EQ(param.inp.out_app_flag, 0); EXPECT_EQ(param.inp.out_mat_r, 0); diff --git a/source/module_io/write_Vxc.hpp b/source/module_io/write_Vxc.hpp index 433a6d6ab3..d1820b287e 100644 --- a/source/module_io/write_Vxc.hpp +++ b/source/module_io/write_Vxc.hpp @@ -161,7 +161,7 @@ inline void write_orb_energy(const K_Vectors& kv, assert(e_orb.size() == kv.get_nks()); const int nk = kv.get_nks() / nspin0; std::ofstream ofs; - ofs.open(GlobalV::global_out_dir + term + "_" + (label == "" ? "out" : label + "_out"), + ofs.open(GlobalV::global_out_dir + term + "_" + (label == "" ? "out.dat" : label + "_out.dat"), app ? std::ios::app : std::ios::out); ofs << nk << "\n" << nspin0 << "\n" << nbands << "\n"; ofs << std::scientific << std::setprecision(16); diff --git a/source/module_io/write_Vxc_lip.hpp b/source/module_io/write_Vxc_lip.hpp index bf640ba70d..ef3f1f855b 100644 --- a/source/module_io/write_Vxc_lip.hpp +++ b/source/module_io/write_Vxc_lip.hpp @@ -221,7 +221,7 @@ namespace ModuleIO assert(e_orb.size() == kv.get_nks()); const int nk = kv.get_nks() / nspin0; std::ofstream ofs; - ofs.open(GlobalV::global_out_dir + "vxc_" + (label == "" ? "out" : label + "_out"), + ofs.open(GlobalV::global_out_dir + "vxc_" + (label == "" ? "out.dat" : label + "_out.dat"), app ? std::ios::app : std::ios::out); ofs << nk << "\n" << nspin0 << "\n" << nbands << "\n"; ofs << std::scientific << std::setprecision(16); diff --git a/source/module_io/write_eband_separate_term.hpp b/source/module_io/write_eband_terms.hpp similarity index 95% rename from source/module_io/write_eband_separate_term.hpp rename to source/module_io/write_eband_terms.hpp index e93cacc7d4..df60c00b46 100644 --- a/source/module_io/write_eband_separate_term.hpp +++ b/source/module_io/write_eband_terms.hpp @@ -7,7 +7,7 @@ namespace ModuleIO { template - void write_eband_separate_term(const int nspin, + void write_eband_terms(const int nspin, const int nbasis, const int drank, const Parallel_Orbitals* pv, @@ -71,7 +71,7 @@ namespace ModuleIO } write_orb_energy(kv, nspin0, nbands, e_orb_kinetic, "kinetic", ""); // ======test======= - std::cout << "e_kinetic:" << all_k_all_band_energy(e_orb_kinetic) << std::endl; + // std::cout << "e_kinetic:" << all_k_all_band_energy(e_orb_kinetic) << std::endl; // ======test======= } @@ -95,7 +95,7 @@ namespace ModuleIO } write_orb_energy(kv, nspin0, nbands, e_orb_pp_local, "vpp_local", ""); // ======test======= - std::cout << "e_pp_local:" << all_k_all_band_energy(e_orb_pp_local) << std::endl; + // std::cout << "e_pp_local:" << all_k_all_band_energy(e_orb_pp_local) << std::endl; // ======test======= } @@ -150,7 +150,7 @@ namespace ModuleIO for (auto& op : v_hartree_op) { delete op; } write_orb_energy(kv, nspin0, nbands, e_orb_hartree, "vhartree", ""); // ======test======= - std::cout << "e_hartree:" << all_k_all_band_energy(e_orb_hartree) << std::endl; + // std::cout << "e_hartree:" << all_k_all_band_energy(e_orb_hartree) << std::endl; // ======test======= } diff --git a/source/module_parameter/input_parameter.h b/source/module_parameter/input_parameter.h index 4df44f068a..e84ae1719f 100644 --- a/source/module_parameter/input_parameter.h +++ b/source/module_parameter/input_parameter.h @@ -328,7 +328,7 @@ struct Input_para bool out_mat_dh = false; bool out_mat_xc = false; ///< output exchange-correlation matrix in ///< KS-orbital representation. - bool out_eband_separate_term; ///< output the band energy terms separately + bool out_eband_terms = false; ///< output the band energy terms separately bool out_hr_npz = false; ///< output exchange-correlation matrix in ///< KS-orbital representation. bool out_dm_npz = false; diff --git a/tests/integrate/207_NO_KP_OXC/INPUT b/tests/integrate/207_NO_KP_OXC/INPUT index 6615880f2a..06090b7479 100644 --- a/tests/integrate/207_NO_KP_OXC/INPUT +++ b/tests/integrate/207_NO_KP_OXC/INPUT @@ -26,7 +26,7 @@ mixing_type broyden mixing_beta 0.7 out_mat_xc 1 -out_eband_separate_term 1 +out_eband_terms 1 ks_solver scalapack_gvx dft_functional hse diff --git a/tests/integrate/307_NO_GO_OXC/INPUT b/tests/integrate/307_NO_GO_OXC/INPUT index eb5a67a376..be4873f986 100644 --- a/tests/integrate/307_NO_GO_OXC/INPUT +++ b/tests/integrate/307_NO_GO_OXC/INPUT @@ -23,7 +23,7 @@ smearing_method gauss smearing_sigma 0.002 out_mat_xc 1 -out_eband_separate_term 1 +out_eband_terms 1 #Parameters (5.Mixing) mixing_type broyden diff --git a/tests/integrate/tools/catch_properties.sh b/tests/integrate/tools/catch_properties.sh index e7f84d67fd..e336150826 100755 --- a/tests/integrate/tools/catch_properties.sh +++ b/tests/integrate/tools/catch_properties.sh @@ -240,7 +240,7 @@ if ! test -z "$has_xc" && [ $has_xc == 1 ]; then xccal=OUT.autotest/k-1-Vxc fi oeref=vxc_out.ref - oecal=OUT.autotest/vxc_out + oecal=OUT.autotest/vxc_out.dat python3 ../tools/CompareFile.py $xcref $xccal 4 echo "CompareVXC_pass $?" >>$1 python3 ../tools/CompareFile.py $oeref $oecal 5 @@ -249,19 +249,19 @@ fi if ! test -z "$has_eband_separate" && [ $has_eband_separate == 1 ]; then ekref=kinetic_out.ref - ekcal=OUT.autotest/kinetic_out + ekcal=OUT.autotest/kinetic_out.dat python3 ../tools/CompareFile.py $ekref $ekcal 4 echo "CompareOrbKinetic_pass $?" >>$1 vlref=vpp_local_out.ref - vlcal=OUT.autotest/vpp_local_out + vlcal=OUT.autotest/vpp_local_out.dat python3 ../tools/CompareFile.py $vlref $vlcal 4 echo "CompareOrbVL_pass $?" >>$1 vnlref=vpp_nonlocal_out.ref - vnlcal=OUT.autotest/vpp_nonlocal_out + vnlcal=OUT.autotest/vpp_nonlocal_out.dat python3 ../tools/CompareFile.py $vnlref $vnlcal 4 echo "CompareOrbVNL_pass $?" >>$1 vhref=vhartree_out.ref - vhcal=OUT.autotest/vhartree_out + vhcal=OUT.autotest/vhartree_out.dat python3 ../tools/CompareFile.py $vhref $vhcal 4 echo "CompareOrbVHartree_pass $?" >>$1 fi