diff --git a/source/source_base/element_basis_index.cpp b/source/source_base/element_basis_index.cpp index 1130de59e3..32eafd01e1 100644 --- a/source/source_base/element_basis_index.cpp +++ b/source/source_base/element_basis_index.cpp @@ -4,24 +4,26 @@ //========================================================== #include "element_basis_index.h" + namespace ModuleBase { -Element_Basis_Index::IndexLNM Element_Basis_Index::construct_index( const Range &range ) +Element_Basis_Index::IndexLNM +Element_Basis_Index::construct_index( const Range &range ) { IndexLNM index; index.resize( range.size() ); - for( size_t T=0; T!=range.size(); ++T ) + for( std::size_t T=0; T!=range.size(); ++T ) { - size_t count=0; + std::size_t count=0; index[T].resize( range[T].size() ); - for( size_t L=0; L!=range[T].size(); ++L ) + for( std::size_t L=0; L!=range[T].size(); ++L ) { index[T][L].resize( range[T][L].N ); - for( size_t N=0; N!=range[T][L].N; ++N ) + for( std::size_t N=0; N!=range[T][L].N; ++N ) { index[T][L][N].resize( range[T][L].M ); - for( size_t M=0; M!=range[T][L].M; ++M ) + for( std::size_t M=0; M!=range[T][L].M; ++M ) { index[T][L][N][M] = count; ++count; diff --git a/source/source_base/element_basis_index.h b/source/source_base/element_basis_index.h index 96918b8e03..bb81ebf40e 100644 --- a/source/source_base/element_basis_index.h +++ b/source/source_base/element_basis_index.h @@ -8,40 +8,41 @@ #include #include + namespace ModuleBase { -class Element_Basis_Index +namespace Element_Basis_Index { -private: - + //private: + struct NM { public: - size_t N; - size_t M; + std::size_t N; + std::size_t M; }; - - class Index_TL: public std::vector> + + class Index_TL: public std::vector> { public: - size_t N; - size_t M; + std::size_t N; + std::size_t M; }; - + class Index_T: public std::vector { public: - size_t count_size; - }; - -public: - - typedef std::vector> Range; // range[T][L] + std::size_t count_size; + }; + + //public: + + typedef std::vector> Range; // range[T][L] typedef std::vector IndexLNM; // index[T][L][N][M] - - static IndexLNM construct_index( const Range &range ); -}; + + extern IndexLNM construct_index( const Range &range ); +} } diff --git a/source/source_basis/module_ao/CMakeLists.txt b/source/source_basis/module_ao/CMakeLists.txt index e19a5ba34d..bdc18b0d45 100644 --- a/source/source_basis/module_ao/CMakeLists.txt +++ b/source/source_basis/module_ao/CMakeLists.txt @@ -9,6 +9,7 @@ if(ENABLE_LCAO) ORB_nonlocal_lm.cpp ORB_read.cpp parallel_orbitals.cpp + element_basis_index-ORB.cpp ) if(ENABLE_COVERAGE) diff --git a/source/source_basis/module_ao/element_basis_index-ORB.cpp b/source/source_basis/module_ao/element_basis_index-ORB.cpp new file mode 100644 index 0000000000..c9441b4497 --- /dev/null +++ b/source/source_basis/module_ao/element_basis_index-ORB.cpp @@ -0,0 +1,44 @@ +#include "element_basis_index-ORB.h" + +#include "ORB_read.h" +#include "ORB_atomic_lm.h" + +namespace ModuleBase +{ + +ModuleBase::Element_Basis_Index::Range +Element_Basis_Index::construct_range( const LCAO_Orbitals &orb ) +{ + ModuleBase::Element_Basis_Index::Range range; + range.resize( orb.get_ntype() ); + for( std::size_t T=0; T!=range.size(); ++T ) + { + range[T].resize( orb.Phi[T].getLmax()+1 ); + for( std::size_t L=0; L!=range[T].size(); ++L ) + { + range[T][L].N = orb.Phi[T].getNchi(L); + range[T][L].M = 2*L+1; + } + } + return range; +} + + +ModuleBase::Element_Basis_Index::Range +Element_Basis_Index::construct_range( const std::vector>> &orb ) +{ + ModuleBase::Element_Basis_Index::Range range; + range.resize( orb.size() ); + for( std::size_t T=0; T!=range.size(); ++T ) + { + range[T].resize( orb[T].size() ); + for( std::size_t L=0; L!=range[T].size(); ++L ) + { + range[T][L].N = orb[T][L].size(); + range[T][L].M = 2*L+1; + } + } + return range; +} + +} \ No newline at end of file diff --git a/source/source_basis/module_ao/element_basis_index-ORB.h b/source/source_basis/module_ao/element_basis_index-ORB.h new file mode 100644 index 0000000000..ec2415e6a0 --- /dev/null +++ b/source/source_basis/module_ao/element_basis_index-ORB.h @@ -0,0 +1,22 @@ +#ifndef ELEMENT_BASIS_INDEX_ORB_H +#define ELEMENT_BASIS_INDEX_ORB_H + +#include "../../source_base/element_basis_index.h" +#include + + class Numerical_Orbital_Lm; + class LCAO_Orbitals; + +namespace ModuleBase +{ + +namespace Element_Basis_Index +{ + extern Range construct_range( const LCAO_Orbitals &orb ); + + extern Range construct_range( const std::vector>> &orb ); // orb[T][L][N] +} + +} + +#endif \ No newline at end of file diff --git a/source/source_esolver/esolver_ks_lcao.h b/source/source_esolver/esolver_ks_lcao.h index 67ca7a0482..9e85336893 100644 --- a/source/source_esolver/esolver_ks_lcao.h +++ b/source/source_esolver/esolver_ks_lcao.h @@ -103,6 +103,24 @@ class ESolver_KS_LCAO : public ESolver_KS friend class LR::ESolver_LR; friend class LR::ESolver_LR, double>; + + + public: + const Record_adj & get_RA() const { return RA; } + const Grid_Driver & get_gd() const { return gd; } + const Parallel_Orbitals & get_pv() const { return pv; } + const Gint_k & get_GK() const { return GK; } + const Gint_Gamma & get_GG() const { return GG; } + const Grid_Technique & get_GridT() const { return GridT; } + #ifndef __OLD_GINT + const std::unique_ptr & get_gint_info() const { return gint_info_; } + #endif + const TwoCenterBundle & get_two_center_bundle() const { return two_center_bundle_; } + const rdmft::RDMFT & get_rdmft_solver() const { return rdmft_solver; } + const LCAO_Orbitals & get_orb() const { return orb_; } + const ModuleBase::matrix & get_scs() const { return scs; } + const Setup_DeePKS & get_deepks() const { return deepks; } + const Exx_NAO & get_exx_nao() const { return exx_nao; } }; } // namespace ModuleESolver #endif diff --git a/source/source_lcao/hamilt_lcao.h b/source/source_lcao/hamilt_lcao.h index 3a0a41eb7e..7e888ded3d 100644 --- a/source/source_lcao/hamilt_lcao.h +++ b/source/source_lcao/hamilt_lcao.h @@ -105,12 +105,20 @@ class HamiltLCAO : public Hamilt { return this->hR; } + const HContainer* getHR() const + { + return this->hR; + } /// get SR pointer of *this->sR, which is a HContainer and contains S(R) HContainer*& getSR() { return this->sR; } + const HContainer* getSR() const + { + return this->sR; + } #ifdef __MLALGO /// get V_delta_R pointer of *this->V_delta_R, which is a HContainer and contains V_delta(R) diff --git a/source/source_lcao/module_ri/ABFs_Construct-PCA.cpp b/source/source_lcao/module_ri/ABFs_Construct-PCA.cpp index 9c944f77db..b96ad3169e 100644 --- a/source/source_lcao/module_ri/ABFs_Construct-PCA.cpp +++ b/source/source_lcao/module_ri/ABFs_Construct-PCA.cpp @@ -1,9 +1,8 @@ #include "ABFs_Construct-PCA.h" -#include "exx_abfs-abfs_index.h" #include "../../source_base/module_external/lapack_connector.h" #include "../../source_base/global_function.h" -#include "../../source_base/element_basis_index.h" +#include "../../source_basis/module_ao/element_basis_index-ORB.h" #include "../../source_base/matrix.h" #include "../../source_lcao/module_ri/Matrix_Orbs11.h" #include "../../source_lcao/module_ri/Matrix_Orbs21.h" @@ -81,12 +80,12 @@ namespace PCA ModuleBase::TITLE("ABFs_Construct::PCA::cal_PCA"); const ModuleBase::Element_Basis_Index::Range - range_lcaos = Exx_Abfs::Abfs_Index::construct_range( lcaos ); + range_lcaos = ModuleBase::Element_Basis_Index::construct_range( lcaos ); const ModuleBase::Element_Basis_Index::IndexLNM index_lcaos = ModuleBase::Element_Basis_Index::construct_index( range_lcaos ); const ModuleBase::Element_Basis_Index::Range - range_abfs = Exx_Abfs::Abfs_Index::construct_range( abfs ); + range_abfs = ModuleBase::Element_Basis_Index::construct_range( abfs ); const ModuleBase::Element_Basis_Index::IndexLNM index_abfs = ModuleBase::Element_Basis_Index::construct_index( range_abfs ); diff --git a/source/source_lcao/module_ri/CMakeLists.txt b/source/source_lcao/module_ri/CMakeLists.txt index 65ab0d12f9..62cdede596 100644 --- a/source/source_lcao/module_ri/CMakeLists.txt +++ b/source/source_lcao/module_ri/CMakeLists.txt @@ -14,7 +14,6 @@ if (ENABLE_LIBRI) if(ENABLE_LCAO) list(APPEND objects conv_coulomb_pot_k.cpp - exx_abfs-abfs_index.cpp exx_abfs-construct_orbs.cpp exx_abfs-io.cpp exx_abfs-jle.cpp diff --git a/source/source_lcao/module_ri/LRI_CV.hpp b/source/source_lcao/module_ri/LRI_CV.hpp index b97ac9ed5e..c3a7177147 100644 --- a/source/source_lcao/module_ri/LRI_CV.hpp +++ b/source/source_lcao/module_ri/LRI_CV.hpp @@ -8,9 +8,9 @@ #include "LRI_CV.h" #include "LRI_CV_Tools.h" -#include "exx_abfs-abfs_index.h" #include "exx_abfs-construct_orbs.h" #include "RI_Util.h" +#include "../../source_basis/module_ao/element_basis_index-ORB.h" #include "../../source_base/tool_title.h" #include "../../source_base/timer.h" #include "../../source_pw/module_pwdft/global.h" @@ -62,11 +62,11 @@ void LRI_CV::set_orbitals( = Exx_Abfs::Construct_Orbs::get_Rmax(this->abfs_ccp); const ModuleBase::Element_Basis_Index::Range - range_lcaos = Exx_Abfs::Abfs_Index::construct_range( lcaos ); + range_lcaos = ModuleBase::Element_Basis_Index::construct_range( lcaos ); this->index_lcaos = ModuleBase::Element_Basis_Index::construct_index( range_lcaos ); const ModuleBase::Element_Basis_Index::Range - range_abfs = Exx_Abfs::Abfs_Index::construct_range( abfs ); + range_abfs = ModuleBase::Element_Basis_Index::construct_range( abfs ); this->index_abfs = ModuleBase::Element_Basis_Index::construct_index( range_abfs ); int Lmax_v = std::numeric_limits::min(); diff --git a/source/source_lcao/module_ri/exx_abfs-abfs_index.cpp b/source/source_lcao/module_ri/exx_abfs-abfs_index.cpp deleted file mode 100644 index 9826afd63f..0000000000 --- a/source/source_lcao/module_ri/exx_abfs-abfs_index.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "exx_abfs-abfs_index.h" -#include "../../source_basis/module_ao/ORB_read.h" - -ModuleBase::Element_Basis_Index::Range - Exx_Abfs::Abfs_Index::construct_range( const LCAO_Orbitals &orb ) -{ - ModuleBase::Element_Basis_Index::Range range; - range.resize( orb.get_ntype() ); - for( size_t T=0; T!=range.size(); ++T ) - { - range[T].resize( orb.Phi[T].getLmax()+1 ); - for( size_t L=0; L!=range[T].size(); ++L ) - { - range[T][L].N = orb.Phi[T].getNchi(L); - range[T][L].M = 2*L+1; - } - } - return range; -} - - -ModuleBase::Element_Basis_Index::Range - Exx_Abfs::Abfs_Index::construct_range( const std::vector>> &orb ) -{ - ModuleBase::Element_Basis_Index::Range range; - range.resize( orb.size() ); - for( size_t T=0; T!=range.size(); ++T ) - { - range[T].resize( orb[T].size() ); - for( size_t L=0; L!=range[T].size(); ++L ) - { - range[T][L].N = orb[T][L].size(); - range[T][L].M = 2*L+1; - } - } - return range; -} diff --git a/source/source_lcao/module_ri/exx_abfs-abfs_index.h b/source/source_lcao/module_ri/exx_abfs-abfs_index.h deleted file mode 100644 index 40dce3c5c6..0000000000 --- a/source/source_lcao/module_ri/exx_abfs-abfs_index.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef EXX_ABFS_ABFS_INDEX_H -#define EXX_ABFS_ABFS_INDEX_H - -#include "exx_abfs.h" - -#include -#include "../../source_base/element_basis_index.h" -#include "../../source_basis/module_ao/ORB_atomic_lm.h" - -class LCAO_Orbitals; - -class Exx_Abfs::Abfs_Index -{ -public: - static ModuleBase::Element_Basis_Index::Range construct_range( const LCAO_Orbitals &orb ); - static ModuleBase::Element_Basis_Index::Range construct_range( const std::vector>> &orb ); -}; - -#endif // EXX_ABFS_ABFS_INDEX_H \ No newline at end of file diff --git a/source/source_lcao/module_ri/exx_abfs-io.cpp b/source/source_lcao/module_ri/exx_abfs-io.cpp index 78184e1c52..3a8de0f1b3 100644 --- a/source/source_lcao/module_ri/exx_abfs-io.cpp +++ b/source/source_lcao/module_ri/exx_abfs-io.cpp @@ -4,7 +4,6 @@ #include "exx_abfs-io.h" #include "exx_abfs-jle.h" -#include "exx_abfs-abfs_index.h" #include "../../source_pw/module_pwdft/global.h" #include "../../source_basis/module_ao/ORB_read.h" #include "../../source_base/global_function.h" diff --git a/source/source_lcao/module_ri/exx_abfs.h b/source/source_lcao/module_ri/exx_abfs.h index bda52e69d2..f08462c94e 100644 --- a/source/source_lcao/module_ri/exx_abfs.h +++ b/source/source_lcao/module_ri/exx_abfs.h @@ -15,7 +15,6 @@ using std::map; class Exx_Abfs { public: - class Abfs_Index; class Jle; class IO; class Construct_Orbs; diff --git a/source/source_lcao/module_ri/exx_opt_orb.cpp b/source/source_lcao/module_ri/exx_opt_orb.cpp index 6623ca91e1..f36d65249d 100644 --- a/source/source_lcao/module_ri/exx_opt_orb.cpp +++ b/source/source_lcao/module_ri/exx_opt_orb.cpp @@ -2,10 +2,10 @@ #include "source_pw/module_pwdft/global.h" #include "source_basis/module_ao/ORB_atomic_lm.h" #include "exx_abfs.h" -#include "exx_abfs-abfs_index.h" #include "exx_abfs-construct_orbs.h" #include "exx_abfs-io.h" #include "exx_abfs-jle.h" +#include "source_basis/module_ao/element_basis_index-ORB.h" #include "source_basis/module_ao/ORB_read.h" #include "source_lcao/module_ri/Matrix_Orbs11.h" #include "source_lcao/module_ri/Matrix_Orbs21.h" @@ -53,13 +53,13 @@ void Exx_Opt_Orb::generate_matrix( for(const auto &orb_T : jle) { GlobalC::exx_info.info_ri.abfs_Lmax = std::max( GlobalC::exx_info.info_ri.abfs_Lmax, static_cast(orb_T.size())-1 ); } - const ModuleBase::Element_Basis_Index::Range range_lcaos = Exx_Abfs::Abfs_Index::construct_range( lcaos ); + const ModuleBase::Element_Basis_Index::Range range_lcaos = ModuleBase::Element_Basis_Index::construct_range( lcaos ); const ModuleBase::Element_Basis_Index::IndexLNM index_lcaos = ModuleBase::Element_Basis_Index::construct_index( range_lcaos ); - const ModuleBase::Element_Basis_Index::Range range_abfs = Exx_Abfs::Abfs_Index::construct_range( abfs ); + const ModuleBase::Element_Basis_Index::Range range_abfs = ModuleBase::Element_Basis_Index::construct_range( abfs ); const ModuleBase::Element_Basis_Index::IndexLNM index_abfs = ModuleBase::Element_Basis_Index::construct_index( range_abfs ); - const ModuleBase::Element_Basis_Index::Range range_jys = Exx_Abfs::Abfs_Index::construct_range( jle ); + const ModuleBase::Element_Basis_Index::Range range_jys = ModuleBase::Element_Basis_Index::construct_range( jle ); const ModuleBase::Element_Basis_Index::IndexLNM index_jys = ModuleBase::Element_Basis_Index::construct_index( range_jys ); Exx_Abfs::Construct_Orbs::print_orbs_size(ucell, abfs, GlobalV::ofs_running);