forked from abacusmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: remove some variables from
LCAO_Matrix
class (#4568)
* delete unused save_HSR_tr() * delete unused set_HR_tr_soc() in LM * remove HR_tr_soc from LM * remove SlocR_tr_soc from LM * remove Hloc_fixedR_tr_soc from LM * remove set_HR_tr() from LM * remove Hloc_fixedR_tr from LM * remove SlocR_tr from LM * remove HR_tr from LM * remove unused update_Hloc & update_Hloc2 from LM * remove unused output_HSK from LM * fix a bug in formatter.h * remove divide_HS_in_frag from LM * remove allocate_HS_k & allocate_HS_gamma from LM * [pre-commit.ci lite] apply automatic fixes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
- Loading branch information
1 parent
28a9f96
commit 88ce35c
Showing
10 changed files
with
154 additions
and
485 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
source/module_hamilt_lcao/hamilt_lcaodft/LCAO_allocate.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
#include "module_hamilt_lcao/hamilt_lcaodft/LCAO_domain.h" | ||
#include "module_base/timer.h" | ||
#include "module_hamilt_pw/hamilt_pwdft/global.h" | ||
#include "module_hamilt_lcao/module_deepks/LCAO_deepks.h" | ||
|
||
namespace LCAO_domain | ||
{ | ||
|
||
void divide_HS_in_frag(LCAO_Matrix& lm, const bool isGamma, Parallel_Orbitals& pv,const int& nks) { | ||
ModuleBase::TITLE("LCAO_Matrix", "divide_HS_in_frag"); | ||
|
||
//(1), (2): set up matrix division have been moved into ORB_control | ||
// just pass `ParaV` as pointer is enough | ||
lm.ParaV = &pv; | ||
// (3) allocate for S, H_fixed, H, and S_diag | ||
if (isGamma) { | ||
LCAO_domain::allocate_HS_gamma(lm, lm.ParaV->nloc); | ||
} else { | ||
LCAO_domain::allocate_HS_k(lm, lm.ParaV->nloc); | ||
} | ||
#ifdef __DEEPKS | ||
// wenfei 2021-12-19 | ||
// preparation for DeePKS | ||
|
||
if (GlobalV::deepks_out_labels || GlobalV::deepks_scf) { | ||
// allocate relevant data structures for calculating descriptors | ||
std::vector<int> na; | ||
na.resize(GlobalC::ucell.ntype); | ||
for (int it = 0; it < GlobalC::ucell.ntype; it++) { | ||
na[it] = GlobalC::ucell.atoms[it].na; | ||
} | ||
|
||
GlobalC::ld.init(GlobalC::ORB, | ||
GlobalC::ucell.nat, | ||
GlobalC::ucell.ntype, | ||
pv, | ||
na); | ||
|
||
if (GlobalV::deepks_scf) { | ||
if (isGamma) { | ||
GlobalC::ld.allocate_V_delta(GlobalC::ucell.nat); | ||
} else { | ||
GlobalC::ld.allocate_V_delta(GlobalC::ucell.nat, nks); | ||
} | ||
} | ||
} | ||
#endif | ||
return; | ||
} | ||
|
||
void allocate_HS_gamma(LCAO_Matrix& lm, const long& nloc) { | ||
ModuleBase::TITLE("LCAO_Matrix", "allocate_HS_gamma"); | ||
|
||
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "nloc", nloc); | ||
|
||
if (nloc == 0) { | ||
return; | ||
} | ||
|
||
// because we initilize in the constructor function | ||
// with dimension '1', so here we reconstruct these | ||
// matrices | ||
|
||
lm.Sloc.resize(nloc); | ||
lm.Hloc_fixed.resize(nloc); | ||
lm.Hloc.resize(nloc); | ||
|
||
ModuleBase::GlobalFunc::ZEROS(lm.Sloc.data(), nloc); | ||
ModuleBase::GlobalFunc::ZEROS(lm.Hloc_fixed.data(), nloc); | ||
ModuleBase::GlobalFunc::ZEROS(lm.Hloc.data(), nloc); | ||
|
||
return; | ||
} | ||
|
||
void allocate_HS_k(LCAO_Matrix& lm, const long& nloc) { | ||
ModuleBase::TITLE("LCAO_Matrix", "allocate_HS_k"); | ||
|
||
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "nloc", nloc); | ||
|
||
if (nloc == 0) { | ||
return; // mohan fix bug 2012-05-25 | ||
} | ||
|
||
// because we initilize in the constructor function | ||
// with dimension '1', so here we reconstruct these | ||
// matrices | ||
lm.Sloc2.resize(nloc); | ||
lm.Hloc_fixed2.resize(nloc); | ||
lm.Hloc2.resize(nloc); | ||
|
||
ModuleBase::GlobalFunc::ZEROS(lm.Sloc2.data(), nloc); | ||
ModuleBase::GlobalFunc::ZEROS(lm.Hloc_fixed2.data(), nloc); | ||
ModuleBase::GlobalFunc::ZEROS(lm.Hloc2.data(), nloc); | ||
|
||
return; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.