Skip to content

Commit

Permalink
Delete code related to parameter chg_extrap=dm since it is not used a…
Browse files Browse the repository at this point in the history
…ny more (deepmodeling#4285)
  • Loading branch information
AsTonyshment authored Jun 1, 2024
1 parent 37a1d4b commit 1f10f3a
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 86 deletions.
72 changes: 1 addition & 71 deletions source/module_esolver/esolver_ks_lcao_elec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void ESolver_KS_LCAO<TK, TR>::beforesolver(const int istep)
{
nsk = GlobalV::NSPIN;
ncol = this->LOWF.ParaV->ncol_bands;
if (GlobalV::KS_SOLVER == "genelpa" || GlobalV::KS_SOLVER == "lapack_gvx" || GlobalV::KS_SOLVER=="pexsi"
if (GlobalV::KS_SOLVER == "genelpa" || GlobalV::KS_SOLVER == "lapack_gvx" || GlobalV::KS_SOLVER == "pexsi"
|| GlobalV::KS_SOLVER == "cusolver")
{
ncol = this->LOWF.ParaV->ncol;
Expand Down Expand Up @@ -158,76 +158,6 @@ void ESolver_KS_LCAO<TK, TR>::beforesolver(const int istep)
// init density kernel and wave functions.
this->LOC.allocate_dm_wfc(this->GridT, this->pelec, this->LOWF, this->psi, this->kv, istep);

//======================================
// do the charge extrapolation before the density matrix is regenerated.
// mohan add 2011-04-08
// because once atoms are moving out of this processor,
// the density matrix will not std::map the new atomic configuration,
//======================================
// THIS IS A BUG, BECAUSE THE INDEX GlobalC::GridT.trace_lo
// HAS BEEN REGENERATED, SO WE NEED TO
// REALLOCATE DENSITY MATRIX FIRST, THEN READ IN DENSITY MATRIX,
// AND USE DENSITY MATRIX TO DO RHO GlobalV::CALCULATION.-- mohan 2013-03-31
//======================================
if (GlobalV::chg_extrap == "dm" && istep > 1) // xiaohui modify 2015-02-01
{
for (int is = 0; is < GlobalV::NSPIN; is++)
{
ModuleBase::GlobalFunc::ZEROS(this->pelec->charge->rho[is], this->pw_rho->nrxx);
std::stringstream ssd;
ssd << GlobalV::global_out_dir << "SPIN" << is + 1 << "_DM";
// reading density matrix,
double& ef_tmp = this->pelec->eferm.get_ef(is);
ModuleIO::read_dm(
#ifdef __MPI
this->GridT.nnrg,
this->GridT.trace_lo,
#endif
GlobalV::GAMMA_ONLY_LOCAL,
GlobalV::NLOCAL,
GlobalV::NSPIN,
is,
ssd.str(),
this->LOC.DM,
this->LOC.DM_R,
ef_tmp,
&(GlobalC::ucell));
}

// calculate the charge density
if (GlobalV::GAMMA_ONLY_LOCAL)
{
Gint_inout inout(this->LOC.DM, this->pelec->charge->rho, Gint_Tools::job_type::rho);
this->GG.cal_gint(&inout);
if (XC_Functional::get_func_type() == 3 || XC_Functional::get_func_type() == 5)
{
for (int is = 0; is < GlobalV::NSPIN; is++)
{
ModuleBase::GlobalFunc::ZEROS(this->pelec->charge->kin_r[0], this->pw_rho->nrxx);
}
Gint_inout inout1(this->LOC.DM, this->pelec->charge->kin_r, Gint_Tools::job_type::tau);
this->GG.cal_gint(&inout1);
}
}
else
{
Gint_inout inout(this->LOC.DM_R, this->pelec->charge->rho, Gint_Tools::job_type::rho);
this->GK.cal_gint(&inout);
if (XC_Functional::get_func_type() == 3 || XC_Functional::get_func_type() == 5)
{
for (int is = 0; is < GlobalV::NSPIN; is++)
{
ModuleBase::GlobalFunc::ZEROS(this->pelec->charge->kin_r[0], this->pw_rho->nrxx);
}
Gint_inout inout1(this->LOC.DM_R, this->pelec->charge->kin_r, Gint_Tools::job_type::tau);
this->GK.cal_gint(&inout1);
}
}

// renormalize the charge density
this->pelec->charge->renormalize_rho();
}

#ifdef __DEEPKS
// for each ionic step, the overlap <psi|alpha> must be rebuilt
// since it depends on ionic positions
Expand Down
7 changes: 0 additions & 7 deletions source/module_io/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4108,13 +4108,6 @@ void Input::Check(void)
}
}

if (chg_extrap == "dm" && basis_type == "pw") // xiaohui add 2013-09-01, xiaohui modify 2015-02-01
{
ModuleBase::WARNING_QUIT(
"Input",
"wrong 'chg_extrap=dm' is only available for local orbitals."); // xiaohui modify 2015-02-01
}

if ((init_wfc != "atomic") && (init_wfc != "random") && (init_wfc != "atomic+random") && (init_wfc != "nao")
&& (init_wfc != "nao+random") && (init_wfc != "file"))
{
Expand Down
8 changes: 0 additions & 8 deletions source/module_io/test/input_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1202,14 +1202,6 @@ TEST_F(InputTest, Check)
INPUT.gamma_only_local = 0;
INPUT.out_dm1 = 0;
//
INPUT.basis_type = "pw";
INPUT.chg_extrap = "dm";
testing::internal::CaptureStdout();
EXPECT_EXIT(INPUT.Check(),::testing::ExitedWithCode(0), "");
output = testing::internal::GetCapturedStdout();
EXPECT_THAT(output,testing::HasSubstr("wrong 'chg_extrap=dm' is only available for local orbitals."));
INPUT.chg_extrap = "atomic";
//
INPUT.nbands = 100001;
testing::internal::CaptureStdout();
EXPECT_EXIT(INPUT.Check(),::testing::ExitedWithCode(0), "");
Expand Down

0 comments on commit 1f10f3a

Please sign in to comment.