Skip to content

Commit 66d0bc8

Browse files
committed
Refactor: move exx_abfs-abfs_index to element_basis_index
1 parent 1a49431 commit 66d0bc8

File tree

12 files changed

+83
-71
lines changed

12 files changed

+83
-71
lines changed

source/source_base/element_basis_index.cpp

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44
//==========================================================
55

66
#include "element_basis_index.h"
7+
#include "../../source_basis/module_ao/ORB_read.h"
8+
#include "../../source_basis/module_ao/ORB_atomic_lm.h"
9+
710
namespace ModuleBase
811
{
912

10-
Element_Basis_Index::IndexLNM Element_Basis_Index::construct_index( const Range &range )
13+
Element_Basis_Index::IndexLNM
14+
Element_Basis_Index::construct_index( const Range &range )
1115
{
1216
IndexLNM index;
1317
index.resize( range.size() );
@@ -35,4 +39,40 @@ Element_Basis_Index::IndexLNM Element_Basis_Index::construct_index( const Range
3539
return index;
3640
}
3741

42+
43+
ModuleBase::Element_Basis_Index::Range
44+
Element_Basis_Index::construct_range( const LCAO_Orbitals &orb )
45+
{
46+
ModuleBase::Element_Basis_Index::Range range;
47+
range.resize( orb.get_ntype() );
48+
for( size_t T=0; T!=range.size(); ++T )
49+
{
50+
range[T].resize( orb.Phi[T].getLmax()+1 );
51+
for( size_t L=0; L!=range[T].size(); ++L )
52+
{
53+
range[T][L].N = orb.Phi[T].getNchi(L);
54+
range[T][L].M = 2*L+1;
55+
}
56+
}
57+
return range;
58+
}
59+
60+
61+
ModuleBase::Element_Basis_Index::Range
62+
Element_Basis_Index::construct_range( const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> &orb )
63+
{
64+
ModuleBase::Element_Basis_Index::Range range;
65+
range.resize( orb.size() );
66+
for( size_t T=0; T!=range.size(); ++T )
67+
{
68+
range[T].resize( orb[T].size() );
69+
for( size_t L=0; L!=range[T].size(); ++L )
70+
{
71+
range[T][L].N = orb[T][L].size();
72+
range[T][L].M = 2*L+1;
73+
}
74+
}
75+
return range;
76+
}
77+
3878
}

source/source_base/element_basis_index.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
#include <cstddef>
1010
#include <vector>
11+
12+
class Numerical_Orbital_Lm;
13+
class LCAO_Orbitals;
14+
1115
namespace ModuleBase
1216
{
1317

@@ -37,10 +41,13 @@ class Element_Basis_Index
3741

3842
public:
3943

40-
typedef std::vector<std::vector<NM>> Range; // range[T][L]
44+
typedef std::vector<std::vector<NM>> Range; // range[T][L]
4145
typedef std::vector<Index_T> IndexLNM; // index[T][L][N][M]
4246

4347
static IndexLNM construct_index( const Range &range );
48+
49+
static Range construct_range( const LCAO_Orbitals &orb );
50+
static Range construct_range( const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> &orb );
4451
};
4552

4653
}

source/source_esolver/esolver_ks_lcao.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,24 @@ class ESolver_KS_LCAO : public ESolver_KS<TK>
103103

104104
friend class LR::ESolver_LR<double, double>;
105105
friend class LR::ESolver_LR<std::complex<double>, double>;
106+
107+
108+
public:
109+
const Record_adj & get_RA() const { return RA; }
110+
const Grid_Driver & get_gd() const { return gd; }
111+
const Parallel_Orbitals & get_pv() const { return pv; }
112+
const Gint_k & get_GK() const { return GK; }
113+
const Gint_Gamma & get_GG() const { return GG; }
114+
const Grid_Technique & get_GridT() const { return GridT; }
115+
#ifndef __OLD_GINT
116+
const std::unique_ptr<ModuleGint::GintInfo> & get_gint_info() const { return gint_info_; }
117+
#endif
118+
const TwoCenterBundle & get_two_center_bundle() const { return two_center_bundle_; }
119+
const rdmft::RDMFT<TK, TR> & get_rdmft_solver() const { return rdmft_solver; }
120+
const LCAO_Orbitals & get_orb() const { return orb_; }
121+
const ModuleBase::matrix & get_scs() const { return scs; }
122+
const Setup_DeePKS<TK> & get_deepks() const { return deepks; }
123+
const Exx_NAO<TK> & get_exx_nao() const { return exx_nao; }
106124
};
107125
} // namespace ModuleESolver
108126
#endif

source/source_lcao/hamilt_lcao.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,20 @@ class HamiltLCAO : public Hamilt<TK>
105105
{
106106
return this->hR;
107107
}
108+
const HContainer<TR>* getHR() const
109+
{
110+
return this->hR;
111+
}
108112

109113
/// get SR pointer of *this->sR, which is a HContainer<TR> and contains S(R)
110114
HContainer<TR>*& getSR()
111115
{
112116
return this->sR;
113117
}
118+
const HContainer<TR>* getSR() const
119+
{
120+
return this->sR;
121+
}
114122

115123
#ifdef __MLALGO
116124
/// get V_delta_R pointer of *this->V_delta_R, which is a HContainer<TR> and contains V_delta(R)

source/source_lcao/module_ri/ABFs_Construct-PCA.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "ABFs_Construct-PCA.h"
22

3-
#include "exx_abfs-abfs_index.h"
43
#include "../../source_base/module_external/lapack_connector.h"
54
#include "../../source_base/global_function.h"
65
#include "../../source_base/element_basis_index.h"
@@ -81,12 +80,12 @@ namespace PCA
8180
ModuleBase::TITLE("ABFs_Construct::PCA::cal_PCA");
8281

8382
const ModuleBase::Element_Basis_Index::Range
84-
range_lcaos = Exx_Abfs::Abfs_Index::construct_range( lcaos );
83+
range_lcaos = ModuleBase::Element_Basis_Index::construct_range( lcaos );
8584
const ModuleBase::Element_Basis_Index::IndexLNM
8685
index_lcaos = ModuleBase::Element_Basis_Index::construct_index( range_lcaos );
8786

8887
const ModuleBase::Element_Basis_Index::Range
89-
range_abfs = Exx_Abfs::Abfs_Index::construct_range( abfs );
88+
range_abfs = ModuleBase::Element_Basis_Index::construct_range( abfs );
9089
const ModuleBase::Element_Basis_Index::IndexLNM
9190
index_abfs = ModuleBase::Element_Basis_Index::construct_index( range_abfs );
9291

source/source_lcao/module_ri/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ if (ENABLE_LIBRI)
1414
if(ENABLE_LCAO)
1515
list(APPEND objects
1616
conv_coulomb_pot_k.cpp
17-
exx_abfs-abfs_index.cpp
1817
exx_abfs-construct_orbs.cpp
1918
exx_abfs-io.cpp
2019
exx_abfs-jle.cpp

source/source_lcao/module_ri/LRI_CV.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#include "LRI_CV.h"
1010
#include "LRI_CV_Tools.h"
11-
#include "exx_abfs-abfs_index.h"
1211
#include "exx_abfs-construct_orbs.h"
1312
#include "RI_Util.h"
1413
#include "../../source_base/tool_title.h"
@@ -62,11 +61,11 @@ void LRI_CV<Tdata>::set_orbitals(
6261
= Exx_Abfs::Construct_Orbs::get_Rmax(this->abfs_ccp);
6362

6463
const ModuleBase::Element_Basis_Index::Range
65-
range_lcaos = Exx_Abfs::Abfs_Index::construct_range( lcaos );
64+
range_lcaos = ModuleBase::Element_Basis_Index::construct_range( lcaos );
6665
this->index_lcaos = ModuleBase::Element_Basis_Index::construct_index( range_lcaos );
6766

6867
const ModuleBase::Element_Basis_Index::Range
69-
range_abfs = Exx_Abfs::Abfs_Index::construct_range( abfs );
68+
range_abfs = ModuleBase::Element_Basis_Index::construct_range( abfs );
7069
this->index_abfs = ModuleBase::Element_Basis_Index::construct_index( range_abfs );
7170

7271
int Lmax_v = std::numeric_limits<double>::min();

source/source_lcao/module_ri/exx_abfs-abfs_index.cpp

Lines changed: 0 additions & 37 deletions
This file was deleted.

source/source_lcao/module_ri/exx_abfs-abfs_index.h

Lines changed: 0 additions & 19 deletions
This file was deleted.

source/source_lcao/module_ri/exx_abfs-io.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#include "exx_abfs-io.h"
66
#include "exx_abfs-jle.h"
7-
#include "exx_abfs-abfs_index.h"
87
#include "../../source_pw/module_pwdft/global.h"
98
#include "../../source_basis/module_ao/ORB_read.h"
109
#include "../../source_base/global_function.h"

0 commit comments

Comments
 (0)