Skip to content

Commit cada33d

Browse files
authored
Refactor: remove out_mat_dh, out_mat_t, out_mat_hsR, out_mat_hs from HSolverLCAO (#5058)
* remove out_mat_dh in hsolver-lcao * remove out_mat_t, out_mat_hsR, out_mat_hs from HSolverLCAO
1 parent 087c437 commit cada33d

File tree

6 files changed

+26
-45
lines changed

6 files changed

+26
-45
lines changed

source/module_esolver/esolver_ks_lcao.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -808,13 +808,13 @@ void ESolver_KS_LCAO<TK, TR>::update_pot(const int istep, const int iter)
808808
// 1) print Hamiltonian and Overlap matrix
809809
if (this->conv_elec || iter == GlobalV::SCF_NMAX)
810810
{
811-
if (!GlobalV::GAMMA_ONLY_LOCAL && (hsolver::HSolverLCAO<TK>::out_mat_hs[0] || GlobalV::deepks_v_delta))
811+
if (!GlobalV::GAMMA_ONLY_LOCAL && (PARAM.inp.out_mat_hs[0] || GlobalV::deepks_v_delta))
812812
{
813813
this->GK.renew(true);
814814
}
815815
for (int ik = 0; ik < this->kv.get_nks(); ++ik)
816816
{
817-
if (hsolver::HSolverLCAO<TK>::out_mat_hs[0]|| GlobalV::deepks_v_delta)
817+
if (PARAM.inp.out_mat_hs[0]|| GlobalV::deepks_v_delta)
818818
{
819819
this->p_hamilt->updateHk(ik);
820820
}
@@ -828,13 +828,13 @@ void ESolver_KS_LCAO<TK, TR>::update_pot(const int istep, const int iter)
828828

829829
this->p_hamilt->matrix(h_mat, s_mat);
830830

831-
if (hsolver::HSolverLCAO<TK>::out_mat_hs[0])
831+
if (PARAM.inp.out_mat_hs[0])
832832
{
833833
ModuleIO::save_mat(istep,
834834
h_mat.p,
835835
GlobalV::NLOCAL,
836836
bit,
837-
hsolver::HSolverLCAO<TK>::out_mat_hs[1],
837+
PARAM.inp.out_mat_hs[1],
838838
1,
839839
PARAM.inp.out_app_flag,
840840
"H",
@@ -845,7 +845,7 @@ void ESolver_KS_LCAO<TK, TR>::update_pot(const int istep, const int iter)
845845
s_mat.p,
846846
GlobalV::NLOCAL,
847847
bit,
848-
hsolver::HSolverLCAO<TK>::out_mat_hs[1],
848+
PARAM.inp.out_mat_hs[1],
849849
1,
850850
PARAM.inp.out_app_flag,
851851
"S",

source/module_esolver/esolver_ks_lcao_tddft.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ void ESolver_KS_LCAO_TDDFT::update_pot(const int istep, const int iter)
239239
}
240240
for (int ik = 0; ik < kv.get_nks(); ++ik)
241241
{
242-
if (hsolver::HSolverLCAO<std::complex<double>>::out_mat_hs[0])
242+
if (PARAM.inp.out_mat_hs[0])
243243
{
244244
this->p_hamilt->updateHk(ik);
245245
}
@@ -250,13 +250,13 @@ void ESolver_KS_LCAO_TDDFT::update_pot(const int istep, const int iter)
250250
{
251251
hamilt::MatrixBlock<complex<double>> h_mat, s_mat;
252252
this->p_hamilt->matrix(h_mat, s_mat);
253-
if (hsolver::HSolverLCAO<std::complex<double>>::out_mat_hs[0])
253+
if (PARAM.inp.out_mat_hs[0])
254254
{
255255
ModuleIO::save_mat(istep,
256256
h_mat.p,
257257
GlobalV::NLOCAL,
258258
bit,
259-
hsolver::HSolverLCAO<std::complex<double>>::out_mat_hs[1],
259+
PARAM.inp.out_mat_hs[1],
260260
1,
261261
PARAM.inp.out_app_flag,
262262
"H",
@@ -268,7 +268,7 @@ void ESolver_KS_LCAO_TDDFT::update_pot(const int istep, const int iter)
268268
s_mat.p,
269269
GlobalV::NLOCAL,
270270
bit,
271-
hsolver::HSolverLCAO<std::complex<double>>::out_mat_hs[1],
271+
PARAM.inp.out_mat_hs[1],
272272
1,
273273
PARAM.inp.out_app_flag,
274274
"S",

source/module_esolver/lcao_fun.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,19 @@ namespace ModuleESolver
5252
template <typename TK, typename TR>
5353
ModuleIO::Output_Mat_Sparse<TK> ESolver_KS_LCAO<TK, TR>::create_Output_Mat_Sparse(int istep)
5454
{
55-
return ModuleIO::Output_Mat_Sparse<TK>(hsolver::HSolverLCAO<TK>::out_mat_hsR,
56-
hsolver::HSolverLCAO<TK>::out_mat_dh,
57-
hsolver::HSolverLCAO<TK>::out_mat_t,
58-
PARAM.inp.out_mat_r,
59-
istep,
60-
this->pelec->pot->get_effective_v(),
61-
this->pv,
62-
this->GK, // mohan add 2024-04-01
63-
two_center_bundle_,
64-
orb_,
65-
GlobalC::GridD, // mohan add 2024-04-06
66-
this->kv,
67-
this->p_hamilt);
55+
return ModuleIO::Output_Mat_Sparse<TK>(PARAM.inp.out_mat_hs2,
56+
PARAM.inp.out_mat_dh,
57+
PARAM.inp.out_mat_t,
58+
PARAM.inp.out_mat_r,
59+
istep,
60+
this->pelec->pot->get_effective_v(),
61+
this->pv,
62+
this->GK, // mohan add 2024-04-01
63+
two_center_bundle_,
64+
orb_,
65+
GlobalC::GridD, // mohan add 2024-04-06
66+
this->kv,
67+
this->p_hamilt);
6868
}
6969

7070
//------------------------------------------------------------------------------

source/module_hamilt_lcao/hamilt_lcaodft/operator_lcao/operator_lcao.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include "module_hamilt_lcao/module_hcontainer/hcontainer_funcs.h"
66
#include "module_hsolver/hsolver_lcao.h"
77

8+
#include "module_parameter/parameter.h"
9+
810
#ifdef __ELPA
911
#include "module_hsolver/diago_elpa.h"
1012
#include "module_hsolver/diago_elpa_native.h"
@@ -16,7 +18,7 @@ template <>
1618
void OperatorLCAO<double, double>::get_hs_pointers() {
1719
ModuleBase::timer::tick("OperatorLCAO", "get_hs_pointers");
1820
this->hmatrix_k = this->hsk->get_hk();
19-
if ((this->new_e_iteration && ik == 0) || hsolver::HSolverLCAO<double>::out_mat_hs[0])
21+
if ((this->new_e_iteration && ik == 0) || PARAM.inp.out_mat_hs[0])
2022
{
2123
if (this->smatrix_k == nullptr)
2224
{

source/module_hsolver/hsolver_lcao.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ class HSolverLCAO
1919
const std::string method_in,
2020
const bool skip_charge);
2121

22-
static std::vector<int> out_mat_hs; // mohan add 2010-09-02
23-
static int out_mat_hsR; // LiuXh add 2019-07-16
24-
static int out_mat_t;
25-
static int out_mat_dh;
26-
2722
private:
2823
void hamiltSolvePsiK(hamilt::Hamilt<T>* hm, psi::Psi<T>& psi, double* eigenvalue);
2924

@@ -41,15 +36,6 @@ class HSolverLCAO
4136
std::string method = "none";
4237
};
4338

44-
template <typename T, typename Device>
45-
std::vector<int> HSolverLCAO<T, Device>::out_mat_hs = {0, 8};
46-
template <typename T, typename Device>
47-
int HSolverLCAO<T, Device>::out_mat_hsR = 0;
48-
template <typename T, typename Device>
49-
int HSolverLCAO<T, Device>::out_mat_t = 0;
50-
template <typename T, typename Device>
51-
int HSolverLCAO<T, Device>::out_mat_dh = 0;
52-
5339
template <typename T>
5440
inline T my_conj(T value)
5541
{

source/module_io/input_conv.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -549,14 +549,7 @@ void Input_Conv::Convert()
549549
GlobalV::out_pot = PARAM.inp.out_pot;
550550

551551
#ifdef __LCAO
552-
hsolver::HSolverLCAO<double>::out_mat_hs = PARAM.inp.out_mat_hs;
553-
hsolver::HSolverLCAO<double>::out_mat_hsR = PARAM.inp.out_mat_hs2; // LiuXh add 2019-07-16
554-
hsolver::HSolverLCAO<double>::out_mat_t = PARAM.inp.out_mat_t;
555-
hsolver::HSolverLCAO<double>::out_mat_dh = PARAM.inp.out_mat_dh;
556-
hsolver::HSolverLCAO<std::complex<double>>::out_mat_hs = PARAM.inp.out_mat_hs;
557-
hsolver::HSolverLCAO<std::complex<double>>::out_mat_hsR = PARAM.inp.out_mat_hs2; // LiuXh add 2019-07-16
558-
hsolver::HSolverLCAO<std::complex<double>>::out_mat_t = PARAM.inp.out_mat_t;
559-
hsolver::HSolverLCAO<std::complex<double>>::out_mat_dh = PARAM.inp.out_mat_dh;
552+
560553
if (GlobalV::GAMMA_ONLY_LOCAL)
561554
{
562555
elecstate::ElecStateLCAO<double>::out_wfc_lcao = PARAM.inp.out_wfc_lcao;

0 commit comments

Comments
 (0)