Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions source/source_base/element_basis_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
39 changes: 20 additions & 19 deletions source/source_base/element_basis_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,41 @@

#include <cstddef>
#include <vector>

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<std::vector<size_t>>

class Index_TL: public std::vector<std::vector<std::size_t>>
{
public:
size_t N;
size_t M;
std::size_t N;
std::size_t M;
};

class Index_T: public std::vector<Index_TL>
{
public:
size_t count_size;
};
public:
typedef std::vector<std::vector<NM>> Range; // range[T][L]
std::size_t count_size;
};

//public:

typedef std::vector<std::vector<NM>> Range; // range[T][L]
typedef std::vector<Index_T> IndexLNM; // index[T][L][N][M]
static IndexLNM construct_index( const Range &range );
};

extern IndexLNM construct_index( const Range &range );
}

}

Expand Down
1 change: 1 addition & 0 deletions source/source_basis/module_ao/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
44 changes: 44 additions & 0 deletions source/source_basis/module_ao/element_basis_index-ORB.cpp
Original file line number Diff line number Diff line change
@@ -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<std::vector<std::vector<Numerical_Orbital_Lm>>> &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;
}

}
22 changes: 22 additions & 0 deletions source/source_basis/module_ao/element_basis_index-ORB.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef ELEMENT_BASIS_INDEX_ORB_H
#define ELEMENT_BASIS_INDEX_ORB_H

#include "../../source_base/element_basis_index.h"
#include <vector>

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<std::vector<std::vector<Numerical_Orbital_Lm>>> &orb ); // orb[T][L][N]
}

}

#endif
18 changes: 18 additions & 0 deletions source/source_esolver/esolver_ks_lcao.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,24 @@ class ESolver_KS_LCAO : public ESolver_KS<TK>

friend class LR::ESolver_LR<double, double>;
friend class LR::ESolver_LR<std::complex<double>, 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<ModuleGint::GintInfo> & get_gint_info() const { return gint_info_; }
#endif
const TwoCenterBundle & get_two_center_bundle() const { return two_center_bundle_; }
const rdmft::RDMFT<TK, TR> & 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<TK> & get_deepks() const { return deepks; }
const Exx_NAO<TK> & get_exx_nao() const { return exx_nao; }
};
} // namespace ModuleESolver
#endif
8 changes: 8 additions & 0 deletions source/source_lcao/hamilt_lcao.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,20 @@ class HamiltLCAO : public Hamilt<TK>
{
return this->hR;
}
const HContainer<TR>* getHR() const
{
return this->hR;
}

/// get SR pointer of *this->sR, which is a HContainer<TR> and contains S(R)
HContainer<TR>*& getSR()
{
return this->sR;
}
const HContainer<TR>* getSR() const
{
return this->sR;
}

#ifdef __MLALGO
/// get V_delta_R pointer of *this->V_delta_R, which is a HContainer<TR> and contains V_delta(R)
Expand Down
7 changes: 3 additions & 4 deletions source/source_lcao/module_ri/ABFs_Construct-PCA.cpp
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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 );

Expand Down
1 change: 0 additions & 1 deletion source/source_lcao/module_ri/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions source/source_lcao/module_ri/LRI_CV.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -62,11 +62,11 @@ void LRI_CV<Tdata>::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<double>::min();
Expand Down
37 changes: 0 additions & 37 deletions source/source_lcao/module_ri/exx_abfs-abfs_index.cpp

This file was deleted.

19 changes: 0 additions & 19 deletions source/source_lcao/module_ri/exx_abfs-abfs_index.h

This file was deleted.

1 change: 0 additions & 1 deletion source/source_lcao/module_ri/exx_abfs-io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion source/source_lcao/module_ri/exx_abfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ using std::map;
class Exx_Abfs
{
public:
class Abfs_Index;
class Jle;
class IO;
class Construct_Orbs;
Expand Down
8 changes: 4 additions & 4 deletions source/source_lcao/module_ri/exx_opt_orb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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<int>(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);
Expand Down
Loading