Skip to content

Commit

Permalink
try to remove spin_now (#5689)
Browse files Browse the repository at this point in the history
  • Loading branch information
maki49 authored Dec 6, 2024
1 parent 3fec10a commit d3cb289
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 46 deletions.
9 changes: 0 additions & 9 deletions source/module_esolver/esolver_ks_lcao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,11 +660,6 @@ void ESolver_KS_LCAO<TK, TR>::iter_init(UnitCell& ucell, const int istep, const

if (PARAM.inp.vl_in_h)
{
// update Gint_K
if (!PARAM.globalv.gamma_only_local)
{
this->GK.renew();
}
// update real space Hamiltonian
this->p_hamilt->refresh();
}
Expand Down Expand Up @@ -961,10 +956,6 @@ void ESolver_KS_LCAO<TK, TR>::after_scf(UnitCell& ucell, const int istep)
#endif

// 6) write Hamiltonian and Overlap matrix
if (!PARAM.globalv.gamma_only_local && (PARAM.inp.out_mat_hs[0] || PARAM.inp.deepks_v_delta))
{
this->GK.renew(true);
}
for (int ik = 0; ik < this->kv.get_nks(); ++ik)
{
if (PARAM.inp.out_mat_hs[0] || PARAM.inp.deepks_v_delta)
Expand Down
4 changes: 1 addition & 3 deletions source/module_hamilt_lcao/hamilt_lcaodft/hamilt_lcao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,7 @@ HamiltLCAO<TK, TR>::HamiltLCAO(Gint_Gamma* GG_in,
orb.cutoffs(),
&grid_d,
PARAM.inp.nspin);
// reset spin index and real space Hamiltonian matrix
int start_spin = -1;
GK_in->reset_spin(start_spin);

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ void Veff<OperatorLCAO<TK, TR>>::contributeHR()
// pvpR = < phi0 | v(spin) | phiR> for a new spin.
//--------------------------------------------
// GlobalV::ofs_running << " (spin change)" << std::endl;
this->GK->reset_spin(this->current_spin);

// if you change the place of the following code,
// rememeber to delete the #include
Expand Down
21 changes: 0 additions & 21 deletions source/module_hamilt_lcao/module_gint/gint_k.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,6 @@ class Gint_k : public Gint {
// pvpR and reset_spin/get_spin : auxilliary methods
// for calculating hamiltonian

// reset the spin.
void reset_spin(const int& spin_now_in) { this->spin_now = spin_now_in; };
// get the spin.
int get_spin() const { return spin_now; }

// renew gint index for new iteration
void renew(const bool& soft = false) {
if (soft
&& this->spin_now
== 0) { // in this case, gint will not be recalculated
return;
} else if (this->spin_now != -1) {
int start_spin = -1;
this->reset_spin(start_spin);
}
return;
}

// allocate the <phi_0 | V | dphi_R> matrix element.
void allocate_pvdpR();
// destroy the temporary <phi_0 | V | dphi_R> matrix element.
Expand Down Expand Up @@ -102,9 +84,6 @@ class Gint_k : public Gint {
//----------------------------
// key variable
//----------------------------

// used only in vlocal.
int spin_now = -1;
};

#endif
2 changes: 0 additions & 2 deletions source/module_rdmft/rdmft_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,6 @@ void Veff_rdmft<TK, TR>::contributeHR()
ModuleBase::TITLE("Veff", "contributeHR");
ModuleBase::timer::tick("Veff", "contributeHR");

this->GK->reset_spin(this->current_spin);

double* vr_eff_rdmft = nullptr;

// calculate v_hartree(r) or v_local(r) or v_xc(r)
Expand Down
10 changes: 0 additions & 10 deletions source/module_rdmft/update_state_rdmft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,6 @@ void RDMFT<TK, TR>::update_charge()
srho.begin(is, *(this->charge), rho_basis, GlobalC::ucell.symm);
}

// what this? it seems that it needs to be updated at each iteration
if (PARAM.inp.vl_in_h)
{
// update Gint_K
if (!PARAM.globalv.gamma_only_local)
{
this->GK->renew();
}
}

}


Expand Down

0 comments on commit d3cb289

Please sign in to comment.