Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion source/module_elecstate/module_charge/charge_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,25 @@ void Charge::init_rho(elecstate::efermi& eferm_iout,
{
for (int is = 0; is < PARAM.inp.nspin; ++is)
{
GlobalC::restart.load_disk("charge", is, this->nrxx, rho[is]);
try
{
GlobalC::restart.load_disk("charge", is, this->nrxx, rho[is]);
}
catch (const std::exception& e)
{
// try to load from the output of `out_chg`
std::stringstream ssc;
ssc << PARAM.globalv.global_readin_dir << "SPIN" << is + 1 << "_CHG.cube";
if (ModuleIO::read_vdata_palgrid(GlobalC::Pgrid,
(PARAM.inp.esolver_type == "sdft" ? GlobalV::RANK_IN_STOGROUP : GlobalV::MY_RANK),
GlobalV::ofs_running,
ssc.str(),
this->rho[is],
GlobalC::ucell.nat))
{
GlobalV::ofs_running << " Read in the charge density: " << ssc.str() << std::endl;
}
}
}
GlobalC::restart.info_load.load_charge_finish = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ OperatorEXX<OperatorLCAO<TK, TR>>::OperatorEXX(HS_Matrix_K<TK>* hsk_in,
else if (this->add_hexx_type == Add_Hexx_Type::R)
{
// read in Hexx(R)
const std::string restart_HR_path = GlobalC::restart.folder + "HexxR" + std::to_string(GlobalV::MY_RANK);
const std::string restart_HR_path = PARAM.globalv.global_readin_dir + "HexxR" + std::to_string(GlobalV::MY_RANK);
bool all_exist = true;
for (int is = 0; is < PARAM.inp.nspin; ++is)
{
Expand Down
10 changes: 8 additions & 2 deletions source/module_ri/Exx_LRI_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,14 @@ 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)
{
try { GlobalC::restart.load_disk("Eexx", 0, 1, &this->exx_ptr->Eexx); }
catch (const std::exception& e)
{
std::cout << "WARNING: Cannot read Eexx from disk, the energy of the 1st loop will be wrong, sbut it does not influence the subsequent loops." << std::endl;
}
}
Parallel_Common::bcast_double(this->exx_ptr->Eexx);
this->exx_ptr->Eexx /= GlobalC::exx_info.info_global.hybrid_alpha;
}
Expand Down
Loading