From b83d5ab848badf30cb01544e06632dc6002f2582 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Sun, 7 Jul 2024 04:50:34 +0000 Subject: [PATCH] [pre-commit.ci lite] apply automatic fixes --- source/module_io/restart_exx_csr.hpp | 20 +++++++++++++------- source/module_ri/Exx_LRI_interface.hpp | 16 +++++++++------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/source/module_io/restart_exx_csr.hpp b/source/module_io/restart_exx_csr.hpp index e6c34a544f..33b9bfb68a 100644 --- a/source/module_io/restart_exx_csr.hpp +++ b/source/module_io/restart_exx_csr.hpp @@ -21,17 +21,19 @@ namespace ModuleIO int nR = csr.getNumberOfR(); int nbasis = csr.getMatrixDimension(); // allocate Hexxs[is] - for (int iat1 = 0; iat1 < ucell.nat; ++iat1) - for (int iat2 = 0;iat2 < ucell.nat;++iat2) + for (int iat1 = 0; iat1 < ucell.nat; ++iat1) { + for (int iat2 = 0;iat2 < ucell.nat;++iat2) { for (int iR = 0;iR < nR;++iR) { const std::vector& R = csr.getRCoordinate(iR); TC dR({ R[0], R[1], R[2] }); Hexxs[is][iat1][{iat2, dR}] = RI::Tensor({ static_cast(ucell.atoms[ucell.iat2it[iat1]].nw), static_cast(ucell.atoms[ucell.iat2it[iat2]].nw) }); } +} +} // read Hexxs[is] - for (int i = 0;i < nbasis;++i) - for (int j = 0;j < nbasis;++j) + for (int i = 0;i < nbasis;++i) { + for (int j = 0;j < nbasis;++j) { for (int iR = 0;iR < nR;++iR) { int iat1 = ucell.iwt2iat[i]; @@ -41,6 +43,8 @@ namespace ModuleIO TC dR({ R[0], R[1], R[2] }); Hexxs.at(is).at(iat1).at({ iat2, dR })(ucell.iwt2iw[i], ucell.iwt2iw[j]) = matrix(i, j); } +} +} } } @@ -64,11 +68,13 @@ namespace ModuleIO int start2 = ucell.atoms[ucell.iat2it[iat2]].stapos_wf + ucell.iat2ia[iat2] * nw2; const TC& R = a2R_data.first.second; - auto& matrix = a2R_danta.second; + a2R_datatrix = a2R_data.second; Abfs::Vector3_Order dR(R[0], R[1], R[2]); - for (int i = 0;i < nw1;++i) - for (int j = 0;j < nw2;++j) + for (int i = 0;i < nw1;++i) { + for (int j = 0;j < nw2;++j) { target[dR][start1 + i][start2 + j] = ((std::abs(matrix(i, j)) > sparse_threshold) ? matrix(i, j) : static_cast(0)); +} +} } } return target; diff --git a/source/module_ri/Exx_LRI_interface.hpp b/source/module_ri/Exx_LRI_interface.hpp index bf1fbe587d..78febdb312 100644 --- a/source/module_ri/Exx_LRI_interface.hpp +++ b/source/module_ri/Exx_LRI_interface.hpp @@ -39,8 +39,8 @@ void Exx_LRI_Interface::exx_beforescf(const K_Vectors& kv, const Charg #ifdef __MPI if (GlobalC::exx_info.info_global.cal_exx) { - if (GlobalC::restart.info_load.load_H_finish && !GlobalC::restart.info_load.restart_exx) XC_Functional::set_xc_type(GlobalC::ucell.atoms[0].ncpp.xc_func); - else + if (GlobalC::restart.info_load.load_H_finish && !GlobalC::restart.info_load.restart_exx) { XC_Functional::set_xc_type(GlobalC::ucell.atoms[0].ncpp.xc_func); + } else { if (GlobalC::ucell.atoms[0].ncpp.xc_func == "HF" || GlobalC::ucell.atoms[0].ncpp.xc_func == "PBE0" || GlobalC::ucell.atoms[0].ncpp.xc_func == "HSE") { @@ -67,10 +67,11 @@ void Exx_LRI_Interface::exx_beforescf(const K_Vectors& kv, const Charg if(GlobalC::exx_info.info_global.cal_exx) { this->mix_DMk_2D.set_nks(kv.get_nks(), GlobalV::GAMMA_ONLY_LOCAL); - if(GlobalC::exx_info.info_global.separate_loop) + if(GlobalC::exx_info.info_global.separate_loop) { this->mix_DMk_2D.set_mixing(nullptr); - else + } else { this->mix_DMk_2D.set_mixing(chgmix.get_mixing()); +} } // for exx two_level scf this->two_level_step = 0; @@ -106,7 +107,8 @@ void Exx_LRI_Interface::exx_hamilt2density(elecstate::ElecState& elec, if (GlobalC::restart.info_load.load_H_finish && !GlobalC::restart.info_load.restart_exx && this->two_level_step == 0 && iter == 1) { - if (GlobalV::MY_RANK == 0)GlobalC::restart.load_disk("Eexx", 0, 1, &this->exx_ptr->Eexx); + if (GlobalV::MY_RANK == 0) {GlobalC::restart.load_disk("Eexx", 0, 1, &this->exx_ptr->Eexx); +} Parallel_Common::bcast_double(this->exx_ptr->Eexx); this->exx_ptr->Eexx /= GlobalC::exx_info.info_global.hybrid_alpha; } @@ -174,7 +176,7 @@ bool Exx_LRI_Interface::exx_after_converge( } std::cout << " Updating EXX " << std::flush; - timeval t_start; gettimeofday(&t_start, NULL); + timeval t_start; gettimeofday(&t_start, nullptr); const bool flag_restart = (this->two_level_step == 0) ? true : false; this->mix_DMk_2D.mix(dm.get_DMK_vector(), flag_restart); @@ -188,7 +190,7 @@ bool Exx_LRI_Interface::exx_after_converge( iter = 0; this->two_level_step++; - timeval t_end; gettimeofday(&t_end, NULL); + timeval t_end; gettimeofday(&t_end, nullptr); std::cout << "and rerun SCF\t" << std::setprecision(3) << std::setiosflags(std::ios::scientific) << (double)(t_end.tv_sec-t_start.tv_sec) + (double)(t_end.tv_usec-t_start.tv_usec)/1000000.0