Skip to content

Commit

Permalink
[pre-commit.ci lite] apply automatic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci-lite[bot] authored Jul 7, 2024
1 parent 6d69d36 commit dc37108
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
18 changes: 12 additions & 6 deletions source/module_io/restart_exx_csr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>& R = csr.getRCoordinate(iR);
TC dR({ R[0], R[1], R[2] });
Hexxs[is][iat1][{iat2, dR}] = RI::Tensor<Tdata>({ static_cast<size_t>(ucell.atoms[ucell.iat2it[iat1]].nw), static_cast<size_t>(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];
Expand All @@ -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);
}
}
}
}
}

Expand All @@ -66,9 +70,11 @@ namespace ModuleIO
const TC& R = a2R_data.first.second;
auto& matrix = a2R_data.second;
Abfs::Vector3_Order<int> 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<Tdata>(0));
}
}
}
}
return target;
Expand Down
16 changes: 9 additions & 7 deletions source/module_ri/Exx_LRI_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ void Exx_LRI_Interface<T, Tdata>::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")
{
Expand All @@ -67,10 +67,11 @@ void Exx_LRI_Interface<T, Tdata>::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;
Expand Down Expand Up @@ -106,7 +107,8 @@ void Exx_LRI_Interface<T, Tdata>::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;
}
Expand Down Expand Up @@ -174,7 +176,7 @@ bool Exx_LRI_Interface<T, Tdata>::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);
Expand All @@ -188,7 +190,7 @@ bool Exx_LRI_Interface<T, Tdata>::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
Expand Down

0 comments on commit dc37108

Please sign in to comment.