Skip to content

Commit

Permalink
update the printing information for get_S function
Browse files Browse the repository at this point in the history
  • Loading branch information
mohanchen committed Jun 9, 2024
1 parent 9555a9b commit 681d658
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
6 changes: 3 additions & 3 deletions source/module_esolver/esolver_ks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,8 @@ void ESolver_KS<T, Device>::print_wfcfft(Input& inp, std::ofstream &ofs)
//------------------------------------------------------------------------------
//! the 7th function of ESolver_KS: run
//! mohan add 2024-05-11
//! 1) run others except scf, md, relax, cell-relax
//! 2) before_scf (electronic iteration loops)
//! 3) print head
//! 3) run charge density
//! 4) SCF iterations
//! 5) write head
//! 6) initialization of SCF iterations
Expand All @@ -440,14 +439,15 @@ void ESolver_KS<T, Device>::runner(const int istep, UnitCell& ucell)
// 2) before_scf (electronic iteration loops)
this->before_scf(istep);

// 3) write charge density
if(GlobalV::dm_to_rho)
{
ModuleBase::timer::tick(this->classname, "runner");
return; //nothing further is needed
}

ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "INIT SCF");


bool firstscf = true;
this->conv_elec = false;
this->niter = this->maxniter;
Expand Down
21 changes: 19 additions & 2 deletions source/module_esolver/esolver_ks_lcao_elec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,15 @@ void ESolver_KS_LCAO<TK, TR>::others(const int istep)

if (cal_type == "get_S")
{
std::cout << "\n * * * * * *" << std::endl;
std::cout << " << Start writing the overlap matrix." << std::endl;
this->get_S();
std::cout << " >> Finish writing the overlap matrix." << std::endl;
std::cout << " * * * * * *\n" << std::endl;

ModuleBase::QUIT();

// return; // use 'return' will cause segmentation fault. by mohan 2024-06-09
}
else if (cal_type == "test_memory")
{
Expand Down Expand Up @@ -499,7 +506,12 @@ void ESolver_KS_LCAO<std::complex<double>, double>::get_S(void)
dynamic_cast<hamilt::OperatorLCAO<std::complex<double>, double>*>(this->p_hamilt->ops)->contributeHR();
}

ModuleIO::output_SR(orb_con.ParaV, this->LM, GlobalC::GridD, this->p_hamilt, "SR.csr");
// mohan add 2024-06-09
const std::string fn = GlobalV::global_out_dir + "SR.csr";

std::cout << " The file is saved in " << fn << std::endl;

ModuleIO::output_SR(orb_con.ParaV, this->LM, GlobalC::GridD, this->p_hamilt, fn);

return;
}
Expand Down Expand Up @@ -531,7 +543,12 @@ void ESolver_KS_LCAO<std::complex<double>, std::complex<double>>::get_S(void)
->contributeHR();
}

ModuleIO::output_SR(orb_con.ParaV, this->LM, GlobalC::GridD, this->p_hamilt, "SR.csr");
// mohan add 2024-06-09
const std::string fn = GlobalV::global_out_dir + "SR.csr";

std::cout << " The file is saved in " << fn << std::endl;

ModuleIO::output_SR(orb_con.ParaV, this->LM, GlobalC::GridD, this->p_hamilt, fn);

return;
}
Expand Down

0 comments on commit 681d658

Please sign in to comment.