Skip to content

Commit 50a186f

Browse files
authored
Refactor: remove old gint module code (#6635)
* remove some old_gint code * remove olg_gint code in cal_ldos.cpp * remove old_gint in get_pchg_lcao * remove old_gint code in veff_lcao * remove old_gint in pulay_fs_gint * remove old_gint in spar_dh * remove old_gint in veff_lcao.h * remove old_gint in rdmft_tools * remove old_gint in operator_lr_hxc * remove old_gint in module_lr * remove old_gint in get_wf_lcao * remove ifndef old_gint * remove gk gg in ctrl_runner_lcao * remove gg gk in ctrl_runner_lcao.h * remove gk gt in ctrl_scf_lcao.cpp * remove gk in ctrl_scf_lcao.h * rm gk in get_pchg_lcao.cpp * rm gk in get_pchg_lcao.h * rm gk in get_wf_lcao.cpp * rm gk in get_wf_lcao * rm gk in esolver_ks_lcao.h * rm gk in elecstate_lcao.h * remove gint_k in output_mat_sparse.cpp * rm gint_k in output_mat_sparse.h * rm gint_k in write_eband_terms.hpp * remove gint_k in write_HS_R.cpp * rm gint_k in write_HS_R.h * rm gint_k in write_vxc_r.hpp * rm gint_k in get_wf_lcao.h * rm gint in write_vxc.hpp * remove old gint in FORCE.h * delete grid_init.cpp * rm old_gint in hamilt_lcao.cpp * rm old_gint in hamilt_lcao.h * rm old_gint in LCAO_domain.h * rm old_gint in spar_dh.cpp * rm olg gint in spar_dh.h * rm old gint in rdmft.h * rm old gint in rdmft.cpp * rm old gint in rdmft_tools.h * rm old gint in esolver_lrtd_lcao.h * remove gint_template.h * rm olg_gint in veff_lcao.h * detele gint_move.hpp * remove gint_gamma in get_pchg_lcao * remove gk in get_wf_lcao.cpp * rm grid_tech in elecstate_lcao.cpp * remove grid technique in berryphase.cpp * remove grid tech in berryphase.h * remove grid tech in to_wannier90_lcao_in_pw.h * rm grid tech in to_wannier90_lcao.h * remove grid tech in unk_overlap_lcao.cpp * remove grid tech in unk_overlap_lcao.h * delete for_grid function in record_adj * remove old_gint in operator_lr_hxc.h * rm old_gint in hamilt_casida * rm old_gint in hamilt_ulr.hpp * rm old gint in lr_spectrum.h * rm old gint in esolver_lrtd_lcao.cpp * rm old gint in veff_lcao.h * rm old gint in rdmft_pot.cpp * rm old gint in rdmft_tools.h * rm olg gint in veff_lcao.h * add missing header * rm olg gint in hamilt_lcao.cpp * rm old gint in esolver_double_xc.cpp * rm old gint in esolver_ks_lcao.cpp * rm old gint in lcao_before_scf.cpp and lcao_others.cpp * rm some comments * rm old_gint in lcao_others.cpp * rm some comments * add missing header * add missing header * add missing header * add missing header * rm old gint in esolver_gets.cpp and lcao_after_scf.cpp * add missing headers * modify cmakelist * remove old cuda code in gint module * delete files of old gint module * remove legacy code * modify makefile * remove legacy code * move files from temp_gint to module_gint * modify headers and makefile * remove legacy code * delete compilation option "OLD_GINT"
1 parent 8d16c36 commit 50a186f

File tree

222 files changed

+278
-17632
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+278
-17632
lines changed

CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,6 @@ if(ENABLE_LCAO)
253253
add_compile_definitions(__PEXSI)
254254
set(CMAKE_CXX_STANDARD 14)
255255
endif()
256-
if(OLD_GINT)
257-
add_compile_definitions(__OLD_GINT)
258-
endif()
259256
else()
260257
set(ENABLE_MLALGO OFF)
261258
set(ENABLE_LIBRI OFF)

source/Makefile.Objects

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ VPATH=./src_global:\
6262
./source_lcao/module_deltaspin:\
6363
./source_lcao/module_operator_lcao:\
6464
./source_lcao/module_gint:\
65-
./source_lcao/module_gint/temp_gint:\
6665
./source_relax:\
6766
./source_hamilt/module_vdw:\
6867
./source_io:\
@@ -282,32 +281,7 @@ OBJS_ESOLVER_LCAO=esolver_ks_lcao.o\
282281
esolver_dm2rho.o\
283282
esolver_double_xc.o\
284283

285-
OBJS_GINT=gint_old.o\
286-
gint_gamma_env.o\
287-
gint_gamma_vl.o\
288-
gint_fvl_old.o\
289-
gint_rho_old.o\
290-
gint_tau_old.o\
291-
gint_vl_old.o\
292-
gint_k_env.o\
293-
gint_k_sparse1.o\
294-
gint_k_pvpr.o\
295-
gint_k_pvdpr.o\
296-
gint_tools.o\
297-
grid_bigcell.o\
298-
grid_meshball.o\
299-
grid_meshcell.o\
300-
grid_meshk.o\
301-
grid_technique.o\
302-
gint_force_cpu_interface.o\
303-
gint_rho_cpu_interface.o\
304-
gint_vl_cpu_interface.o\
305-
cal_psir_ylm.o\
306-
cal_dpsir_ylm.o\
307-
cal_ddpsir_ylm.o\
308-
mult_psi_dmr.o\
309-
init_orb.o\
310-
batch_biggrid.o\
284+
OBJS_GINT=batch_biggrid.o\
311285
big_grid.o\
312286
biggrid_info.o\
313287
divide_info.o\
@@ -655,7 +629,6 @@ OBJS_LCAO=evolve_elec.o\
655629
stress_tools.o\
656630
edm.o\
657631
pulay_fs_center2.o\
658-
grid_init.o\
659632
spar_dh.o\
660633
spar_exx.o\
661634
spar_hsr.o\

source/source_esolver/esolver_double_xc.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ void ESolver_DoubleXC<TK, TR>::before_all_runners(UnitCell& ucell, const Input_p
5151
this->pelec_base = new elecstate::ElecStateLCAO<TK>(&(this->chr_base), // use which parameter?
5252
&(this->kv),
5353
this->kv.get_nks(),
54-
&(this->GG),
55-
&(this->GK),
5654
this->pw_rho,
5755
this->pw_big);
5856
}
@@ -145,8 +143,6 @@ void ESolver_DoubleXC<TK, TR>::before_scf(UnitCell& ucell, const int istep)
145143
elecstate::DensityMatrix<TK, double>* DM = dynamic_cast<elecstate::ElecStateLCAO<TK>*>(this->pelec_base)->get_DM();
146144

147145
this->p_hamilt_base = new hamilt::HamiltLCAO<TK, TR>(
148-
PARAM.globalv.gamma_only_local ? &(this->GG) : nullptr,
149-
PARAM.globalv.gamma_only_local ? nullptr : &(this->GK),
150146
ucell,
151147
this->gd,
152148
&this->pv,

source/source_esolver/esolver_gets.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ void ESolver_GetS::before_all_runners(UnitCell& ucell, const Input_para& inp)
5353
this->pelec = new elecstate::ElecStateLCAO<std::complex<double>>(&(this->chr), // use which parameter?
5454
&(this->kv),
5555
this->kv.get_nks(),
56-
nullptr, // mohan add 2024-04-01
57-
nullptr, // mohan add 2024-04-01
5856
this->pw_rho,
5957
this->pw_big);
6058
}

source/source_esolver/esolver_ks_lcao.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(UnitCell& ucell, const Input_pa
5757
{
5858
// TK stands for double and std::complex<double>?
5959
this->pelec = new elecstate::ElecStateLCAO<TK>(&(this->chr), &(this->kv),
60-
this->kv.get_nks(), &(this->GG), &(this->GK), this->pw_rho, this->pw_big);
60+
this->kv.get_nks(), this->pw_rho, this->pw_big);
6161
}
6262

6363
// 3) read LCAO orbitals/projectors and construct the interpolation tables.
@@ -136,7 +136,7 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(UnitCell& ucell, const Input_pa
136136
// 16) init rdmft, added by jghan
137137
if (inp.rdmft == true)
138138
{
139-
rdmft_solver.init(this->GG, this->GK, this->pv, ucell,
139+
rdmft_solver.init(this->pv, ucell,
140140
this->gd, this->kv, *(this->pelec), this->orb_,
141141
two_center_bundle_, inp.dft_functional, inp.rdmft_power_alpha);
142142
}
@@ -198,8 +198,6 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(UnitCell& ucell, const int istep)
198198
elecstate::DensityMatrix<TK, double>* DM = estate->get_DM();
199199

200200
this->p_hamilt = new hamilt::HamiltLCAO<TK, TR>(
201-
PARAM.globalv.gamma_only_local ? &(this->GG) : nullptr,
202-
PARAM.globalv.gamma_only_local ? nullptr : &(this->GK),
203201
ucell, this->gd, &this->pv, this->pelec->pot, this->kv,
204202
two_center_bundle_, orb_, DM, this->deepks
205203
#ifdef __EXX
@@ -371,7 +369,7 @@ void ESolver_KS_LCAO<TK, TR>::after_all_runners(UnitCell& ucell)
371369
ModuleIO::ctrl_runner_lcao<TK, TR>(ucell,
372370
PARAM.inp, this->kv, estate, this->pv, this->Pgrid,
373371
this->gd, this->psi, this->chr, hamilt_lcao,
374-
this->two_center_bundle_, this->GG, this->GK,
372+
this->two_center_bundle_,
375373
this->orb_, this->pw_rho, this->pw_rhod,
376374
this->sf, this->locpp.vloc, this->exx_nao, this->solvent);
377375

@@ -639,9 +637,9 @@ void ESolver_KS_LCAO<TK, TR>::after_scf(UnitCell& ucell, const int istep, const
639637
ModuleIO::ctrl_scf_lcao<TK, TR>(ucell,
640638
PARAM.inp, this->kv, estate, this->pv,
641639
this->gd, this->psi, hamilt_lcao,
642-
this->two_center_bundle_, this->GK,
640+
this->two_center_bundle_,
643641
this->orb_, this->pw_wfc, this->pw_rho,
644-
this->GridT, this->pw_big, this->sf,
642+
this->pw_big, this->sf,
645643
this->rdmft_solver, this->deepks, this->exx_nao,
646644
this->conv_esolver, this->scf_nmax_flag,
647645
istep);

source/source_esolver/esolver_ks_lcao.h

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
#include "esolver_ks.h"
55
#include "source_lcao/record_adj.h" // adjacent atoms
66
#include "source_basis/module_nao/two_center_bundle.h" // nao basis
7-
#include "source_lcao/module_gint/gint_gamma.h" // gint for gamma-only k-points
8-
#include "source_lcao/module_gint/gint_k.h" // gint for multi k-points
9-
#include "source_lcao/module_gint/temp_gint/gint.h" // gint
10-
#include "source_lcao/module_gint/temp_gint/gint_info.h"
7+
#include "source_lcao/module_gint/gint.h" // gint
8+
#include "source_lcao/module_gint/gint_info.h"
119
#include "source_lcao/setup_deepks.h" // for deepks, mohan add 20251008
1210
#include "source_lcao/setup_exx.h" // for exx, mohan add 20251008
1311
#include "source_lcao/module_rdmft/rdmft.h" // rdmft
@@ -67,15 +65,6 @@ class ESolver_KS_LCAO : public ESolver_KS<TK>
6765
//! NAO orbitals: 2d block-cyclic distribution info
6866
Parallel_Orbitals pv;
6967

70-
//! Grid integration: used for k-point-dependent algorithm
71-
Gint_k GK;
72-
73-
//! Grid integration: used for gamma only algorithms.
74-
Gint_Gamma GG;
75-
76-
//! Grid integration: used to store some basic information
77-
Grid_Technique GridT;
78-
7968
//! GintInfo: used to store some basic infomation about module_gint
8069
std::unique_ptr<ModuleGint::GintInfo> gint_info_;
8170

@@ -107,12 +96,7 @@ class ESolver_KS_LCAO : public ESolver_KS<TK>
10796
const Record_adj & get_RA() const { return RA; }
10897
const Grid_Driver & get_gd() const { return gd; }
10998
const Parallel_Orbitals & get_pv() const { return pv; }
110-
const Gint_k & get_GK() const { return GK; }
111-
const Gint_Gamma & get_GG() const { return GG; }
112-
const Grid_Technique & get_GridT() const { return GridT; }
113-
#ifndef __OLD_GINT
11499
const std::unique_ptr<ModuleGint::GintInfo> & get_gint_info() const { return gint_info_; }
115-
#endif
116100
const TwoCenterBundle & get_two_center_bundle() const { return two_center_bundle_; }
117101
const rdmft::RDMFT<TK, TR> & get_rdmft_solver() const { return rdmft_solver; }
118102
const LCAO_Orbitals & get_orb() const { return orb_; }

source/source_esolver/lcao_others.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,6 @@ void ESolver_KS_LCAO<TK, TR>::others(UnitCell& ucell, const int istep)
175175
{
176176
elecstate::DensityMatrix<TK, double>* DM = dynamic_cast<elecstate::ElecStateLCAO<TK>*>(this->pelec)->get_DM();
177177
this->p_hamilt = new hamilt::HamiltLCAO<TK, TR>(
178-
PARAM.globalv.gamma_only_local ? &(this->GG) : nullptr,
179-
PARAM.globalv.gamma_only_local ? nullptr : &(this->GK),
180178
ucell,
181179
this->gd,
182180
&this->pv,
@@ -235,8 +233,7 @@ void ESolver_KS_LCAO<TK, TR>::others(UnitCell& ucell, const int istep)
235233
Get_pchg_lcao get_pchg(this->psi, &(this->pv));
236234
if (PARAM.globalv.gamma_only_local)
237235
{
238-
get_pchg.begin(this->GG,
239-
this->chr.rho,
236+
get_pchg.begin(this->chr.rho,
240237
this->pelec->wg,
241238
this->pelec->eferm.get_all_ef(),
242239
this->pw_rhod->nrxx,
@@ -253,8 +250,7 @@ void ESolver_KS_LCAO<TK, TR>::others(UnitCell& ucell, const int istep)
253250
}
254251
else
255252
{
256-
get_pchg.begin(this->GK,
257-
this->chr.rho,
253+
get_pchg.begin(this->chr.rho,
258254
this->chr.rhog,
259255
this->pelec->wg,
260256
this->pelec->eferm.get_all_ef(),
@@ -286,7 +282,6 @@ void ESolver_KS_LCAO<TK, TR>::others(UnitCell& ucell, const int istep)
286282
this->pw_wfc,
287283
this->Pgrid,
288284
this->pv,
289-
this->GG,
290285
PARAM.inp.out_wfc_pw,
291286
this->kv,
292287
PARAM.inp.nelec,
@@ -305,7 +300,6 @@ void ESolver_KS_LCAO<TK, TR>::others(UnitCell& ucell, const int istep)
305300
this->pw_wfc,
306301
this->Pgrid,
307302
this->pv,
308-
this->GK,
309303
PARAM.inp.out_wfc_pw,
310304
this->kv,
311305
PARAM.inp.nelec,

source/source_estate/elecstate_lcao.cpp

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
#include "source_estate/module_dm/cal_dm_psi.h"
66
#include "source_hamilt/module_xc/xc_functional.h"
77
#include "source_lcao/module_deltaspin/spin_constrain.h"
8-
#include "source_lcao/module_gint/grid_technique.h"
98
#include "source_pw/module_pwdft/global.h"
109
#include "source_io/module_parameter/parameter.h"
1110

12-
#include "source_lcao/module_gint/temp_gint/gint_interface.h"
11+
#include "source_lcao/module_gint/gint_interface.h"
1312

1413
#include <vector>
1514

@@ -34,13 +33,7 @@ void ElecStateLCAO<std::complex<double>>::psiToRho(const psi::Psi<std::complex<d
3433
//------------------------------------------------------------
3534

3635
ModuleBase::GlobalFunc::NOTE("Calculate the charge on real space grid!");
37-
#ifdef __OLD_GINT
38-
this->gint_k->transfer_DM2DtoGrid(this->DM->get_DMR_vector()); // transfer dm2d to DM_grid in gint
39-
Gint_inout inout(this->charge->rho, Gint_Tools::job_type::rho, PARAM.inp.nspin);
40-
this->gint_k->cal_gint(&inout);
41-
#else
4236
ModuleGint::cal_gint_rho(this->DM->get_DMR_vector(), PARAM.inp.nspin, this->charge->rho);
43-
#endif
4437

4538
if (XC_Functional::get_ked_flag())
4639
{
@@ -71,13 +64,7 @@ void ElecStateLCAO<double>::psiToRho(const psi::Psi<double>& psi)
7164
//------------------------------------------------------------
7265
ModuleBase::GlobalFunc::NOTE("Calculate the charge on real space grid!");
7366

74-
#ifdef __OLD_GINT
75-
this->gint_gamma->transfer_DM2DtoGrid(this->DM->get_DMR_vector()); // transfer dm2d to DM_grid in gint
76-
Gint_inout inout(this->charge->rho, Gint_Tools::job_type::rho, PARAM.inp.nspin);
77-
this->gint_gamma->cal_gint(&inout);
78-
#else
7967
ModuleGint::cal_gint_rho(this->DM->get_DMR_vector(), PARAM.inp.nspin, this->charge->rho);
80-
#endif
8168

8269
if (XC_Functional::get_ked_flag())
8370
{
@@ -139,25 +126,14 @@ void ElecStateLCAO<double>::dmToRho(std::vector<double*> pexsi_DM, std::vector<d
139126
}
140127

141128
ModuleBase::GlobalFunc::NOTE("Calculate the charge on real space grid!");
142-
#ifdef __OLD_GINT
143-
this->gint_gamma->transfer_DM2DtoGrid(this->DM->get_DMR_vector()); // transfer dm2d to DM_grid in gint
144-
Gint_inout inout(this->charge->rho, Gint_Tools::job_type::rho, PARAM.inp.nspin);
145-
this->gint_gamma->cal_gint(&inout);
146-
#else
147129
ModuleGint::cal_gint_rho(this->DM->get_DMR_vector(), PARAM.inp.nspin, this->charge->rho);
148-
#endif
149130
if (XC_Functional::get_ked_flag())
150131
{
151132
for (int is = 0; is < PARAM.inp.nspin; is++)
152133
{
153134
ModuleBase::GlobalFunc::ZEROS(this->charge->kin_r[0], this->charge->nrxx);
154135
}
155-
#ifdef __OLD_GINT
156-
Gint_inout inout1(this->charge->kin_r, Gint_Tools::job_type::tau);
157-
this->gint_gamma->cal_gint(&inout1);
158-
#else
159136
ModuleGint::cal_gint_tau(this->DM->get_DMR_vector(), PARAM.inp.nspin, this->charge->kin_r);
160-
#endif
161137
}
162138

163139
this->charge->renormalize_rho();

source/source_estate/elecstate_lcao.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
#include "elecstate.h"
55
#include "source_estate/module_dm/density_matrix.h"
6-
#include "source_lcao/module_gint/gint_gamma.h"
7-
#include "source_lcao/module_gint/gint_k.h"
86

97
#include <vector>
108

@@ -20,14 +18,10 @@ class ElecStateLCAO : public ElecState
2018
ElecStateLCAO(Charge* chg_in,
2119
const K_Vectors* klist_in,
2220
int nks_in,
23-
Gint_Gamma* gint_gamma_in, // mohan add 2024-04-01
24-
Gint_k* gint_k_in, // mohan add 2024-04-01
2521
ModulePW::PW_Basis* rhopw_in,
2622
ModulePW::PW_Basis_Big* bigpw_in)
2723
{
2824
init_ks(chg_in, klist_in, nks_in, rhopw_in, bigpw_in);
29-
this->gint_gamma = gint_gamma_in; // mohan add 2024-04-01
30-
this->gint_k = gint_k_in; // mohan add 2024-04-01
3125
this->classname = "ElecStateLCAO";
3226
}
3327

@@ -85,8 +79,6 @@ class ElecStateLCAO : public ElecState
8579
// calcualte rho for each k
8680
// void rhoBandK(const psi::Psi<std::complex<double>>& psi);
8781

88-
Gint_Gamma* gint_gamma = nullptr; // mohan add 2024-04-01
89-
Gint_k* gint_k = nullptr; // mohan add 2024-04-01
9082
};
9183

9284
template <typename TK>

source/source_estate/elecstate_lcao_cal_tau.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "elecstate_lcao.h"
2-
#include "source_lcao/module_gint/temp_gint/gint_interface.h"
2+
#include "source_lcao/module_gint/gint_interface.h"
33

44
#include "source_base/timer.h"
55

@@ -16,12 +16,7 @@ void ElecStateLCAO<std::complex<double>>::cal_tau(const psi::Psi<std::complex<do
1616
{
1717
ModuleBase::GlobalFunc::ZEROS(this->charge->kin_r[is], this->charge->nrxx);
1818
}
19-
#ifdef __OLD_GINT
20-
Gint_inout inout1(this->charge->kin_r, Gint_Tools::job_type::tau, PARAM.inp.nspin);
21-
this->gint_k->cal_gint(&inout1);
22-
#else
2319
ModuleGint::cal_gint_tau(this->DM->get_DMR_vector(), PARAM.inp.nspin, this->charge->kin_r);
24-
#endif
2520
ModuleBase::timer::tick("ElecStateLCAO", "cal_tau");
2621
return;
2722
}
@@ -36,12 +31,7 @@ void ElecStateLCAO<double>::cal_tau(const psi::Psi<double>& psi)
3631
{
3732
ModuleBase::GlobalFunc::ZEROS(this->charge->kin_r[is], this->charge->nrxx);
3833
}
39-
#ifdef __OLD_GINT
40-
Gint_inout inout1(this->charge->kin_r, Gint_Tools::job_type::tau, PARAM.inp.nspin);
41-
this->gint_gamma->cal_gint(&inout1);
42-
#else
4334
ModuleGint::cal_gint_tau(this->DM->get_DMR_vector(), PARAM.inp.nspin, this->charge->kin_r);
44-
#endif
4535

4636
ModuleBase::timer::tick("ElecStateLCAO", "cal_tau");
4737
return;

0 commit comments

Comments
 (0)