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 23, 2024
1 parent e3c525b commit dee36c9
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 16 deletions.
2 changes: 1 addition & 1 deletion source/module_hamilt_general/module_xc/test/test_xc1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace ModuleBase
namespace GlobalV
{
std::string BASIS_TYPE = "";
bool CAL_STRESS = 0;
bool CAL_STRESS = false;
int CAL_FORCE = 0;
int NSPIN = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion source/module_hamilt_general/module_xc/test/xc3_mock.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ namespace ModuleBase
namespace GlobalV
{
std::string BASIS_TYPE = "";
bool CAL_STRESS = 0;
bool CAL_STRESS = false;
int CAL_FORCE = 0;
int NSPIN;
int NPOL;
Expand Down
2 changes: 1 addition & 1 deletion source/module_hamilt_general/module_xc/xc_functional.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class XC_Functional
ModulePW::PW_Basis* rhopw,
const UnitCell* ucell,
std::vector<double>& stress_gga,
const bool is_stress = 0);
const bool is_stress = false);
template <typename T, typename Device,
typename Real = typename GetTypeReal<T>::type>
static void grad_wfc(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ namespace hamilt
}
}
}
if (need_allocate) hR->allocate(nullptr, true);
if (need_allocate) { hR->allocate(nullptr, true);
}
}
/// allocate according to BvK cells, used in scf
template <typename TR>
Expand Down Expand Up @@ -64,7 +65,8 @@ namespace hamilt
}
}
}
if (need_allocate) hR->allocate(nullptr, true);
if (need_allocate) { hR->allocate(nullptr, true);
}
}

template <typename TK, typename TR>
Expand Down Expand Up @@ -148,7 +150,8 @@ OperatorEXX<OperatorLCAO<TK, TR>>::OperatorEXX(HS_Matrix_K<TK>* hsk_in,
this->restart = GlobalC::restart.load_disk(
"Hexx", ik,
pv->get_local_size(), this->Hexxd_k_load[ik].data(), false);
if (!this->restart) break;
if (!this->restart) { break;
}
}
}
else
Expand All @@ -160,7 +163,8 @@ OperatorEXX<OperatorLCAO<TK, TR>>::OperatorEXX(HS_Matrix_K<TK>* hsk_in,
this->restart = GlobalC::restart.load_disk(
"Hexx", ik,
pv->get_local_size(), this->Hexxc_k_load[ik].data(), false);
if (!this->restart) break;
if (!this->restart) { break;
}
}
}
}
Expand All @@ -176,9 +180,10 @@ OperatorEXX<OperatorLCAO<TK, TR>>::OperatorEXX(HS_Matrix_K<TK>* hsk_in,
}
}

if (!this->restart)
if (!this->restart) {
std::cout << "WARNING: Hexx not found, restart from the non-exx loop." << std::endl
<< "If the loaded charge density is EXX-solved, this may lead to poor convergence." << std::endl;
}
GlobalC::restart.info_load.load_H_finish = this->restart;
}
}
Expand All @@ -189,11 +194,12 @@ void OperatorEXX<OperatorLCAO<TK, TR>>::contributeHR()
{
ModuleBase::TITLE("OperatorEXX", "contributeHR");
// Peize Lin add 2016-12-03
if (GlobalV::CALCULATION != "nscf" && this->two_level_step != nullptr && *this->two_level_step == 0 && !this->restart) return; //in the non-exx loop, do nothing
if (GlobalV::CALCULATION != "nscf" && this->two_level_step != nullptr && *this->two_level_step == 0 && !this->restart) { return; //in the non-exx loop, do nothing
}
if (XC_Functional::get_func_type() == 4 || XC_Functional::get_func_type() == 5)
{
// add H(R) normally
if (PARAM.exx_info.info_ri.real_number)
if (PARAM.exx_info.info_ri.real_number) {
RI_2D_Comm::add_HexxR(
this->current_spin,
PARAM.exx_info.info_global.hybrid_alpha,
Expand All @@ -202,7 +208,7 @@ void OperatorEXX<OperatorLCAO<TK, TR>>::contributeHR()
GlobalV::NPOL,
*this->hR,
this->use_cell_nearest ? &this->cell_nearest : nullptr);
else
} else {
RI_2D_Comm::add_HexxR(
this->current_spin,
PARAM.exx_info.info_global.hybrid_alpha,
Expand All @@ -211,16 +217,19 @@ void OperatorEXX<OperatorLCAO<TK, TR>>::contributeHR()
GlobalV::NPOL,
*this->hR,
this->use_cell_nearest ? &this->cell_nearest : nullptr);
}
}
if (GlobalV::NSPIN == 2) this->current_spin = 1 - this->current_spin;
if (GlobalV::NSPIN == 2) { this->current_spin = 1 - this->current_spin;
}
}

template<typename TK, typename TR>
void OperatorEXX<OperatorLCAO<TK, TR>>::contributeHk(int ik)
{
ModuleBase::TITLE("OperatorEXX", "constributeHR");
// Peize Lin add 2016-12-03
if (GlobalV::CALCULATION != "nscf" && this->two_level_step != nullptr && *this->two_level_step == 0 && !this->restart) return; //in the non-exx loop, do nothing
if (GlobalV::CALCULATION != "nscf" && this->two_level_step != nullptr && *this->two_level_step == 0 && !this->restart) { return; //in the non-exx loop, do nothing
}
if (XC_Functional::get_func_type() == 4 || XC_Functional::get_func_type() == 5)
{
if (this->restart && this->two_level_step != nullptr)
Expand All @@ -246,22 +255,23 @@ void OperatorEXX<OperatorLCAO<TK, TR>>::contributeHk(int ik)
}
// cal H(k) from H(R) normally

if (PARAM.exx_info.info_ri.real_number)
if (PARAM.exx_info.info_ri.real_number) {
RI_2D_Comm::add_Hexx(
this->kv,
ik,
PARAM.exx_info.info_global.hybrid_alpha,
*this->Hexxd,
*this->hR->get_paraV(),
this->hsk->get_hk());
else
} else {
RI_2D_Comm::add_Hexx(
this->kv,
ik,
PARAM.exx_info.info_global.hybrid_alpha,
*this->Hexxc,
*this->hR->get_paraV(),
this->hsk->get_hk());
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion source/module_io/test_serial/read_input_item_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ TEST_F(InputTest, Item_test)
output = testing::internal::GetCapturedStdout();
EXPECT_THAT(output, testing::HasSubstr("NOTICE"));

param.input.exx_separate_loop = 0;
param.input.exx_separate_loop = false;
param.input.exx_hybrid_step = 2;
it->second.reset_value(it->second, param);
EXPECT_EQ(param.input.exx_hybrid_step, 1);
Expand Down

0 comments on commit dee36c9

Please sign in to comment.