Skip to content

Commit

Permalink
Fix: fix a bug in get_dmk_vector() and make some refactor of get-fu…
Browse files Browse the repository at this point in the history
…nction (#3893)

* fix a bug in get_dmk_vector() and make some refactor of get-function

* override to avoid compile error
  • Loading branch information
WHUweiqingzhou committed Apr 2, 2024
1 parent 42a086e commit c78456c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 26 deletions.
21 changes: 0 additions & 21 deletions source/module_elecstate/module_dm/density_matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,27 +272,6 @@ TK* DensityMatrix<TK, TR>::get_DMK_pointer(const int ik) const
return const_cast<TK*>(this->_DMK[ik].data());
}

// get _DMK[ik] vector
template <typename TK, typename TR>
std::vector<std::vector<TK>> DensityMatrix<TK, TR>::get_DMK_vector() const
{
return this->_DMK;
}

// get _paraV pointer
template <typename TK, typename TR>
const Parallel_Orbitals* DensityMatrix<TK, TR>::get_paraV_pointer() const
{
return this->_paraV;
}

// get _kv pointer
template <typename TK, typename TR>
const K_Vectors* DensityMatrix<TK, TR>::get_kv_pointer() const
{
return this->_kv;
}

// set DMK using a pointer
template <typename TK, typename TR>
void DensityMatrix<TK, TR>::set_DMK_pointer(const int ik, TK* DMK_in)
Expand Down
13 changes: 8 additions & 5 deletions source/module_elecstate/module_dm/density_matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,11 @@ class DensityMatrix
* @brief get pointer vector of DMR
* @return HContainer<TR>* vector of DMR
*/
std::vector<hamilt::HContainer<TR>*> get_DMR_vector() const {return this->_DMR;}
const std::vector<hamilt::HContainer<TR>*>& get_DMR_vector() const {return this->_DMR;}
std::vector<hamilt::HContainer<TR>*>& get_DMR_vector() {return this->_DMR;}

std::vector<std::vector<TR>> get_DMR_save() const {return _DMR_save;}
const std::vector<std::vector<TR>>& get_DMR_save() const {return this->_DMR_save;}
std::vector<std::vector<TR>>& get_DMR_save() {return this->_DMR_save;}

/**
* @brief get pointer of DMK
Expand All @@ -153,7 +155,8 @@ class DensityMatrix
/**
* @brief get pointer vector of DMK
*/
std::vector<std::vector<TK>> get_DMK_vector() const;
const std::vector<std::vector<TK>>& get_DMK_vector() const {return this->_DMK;}
std::vector<std::vector<TK>>& get_DMK_vector() {return this->_DMK;}

/**
* @brief set _DMK using a input TK* pointer
Expand All @@ -164,9 +167,9 @@ class DensityMatrix
/**
* @brief get pointer of paraV
*/
const Parallel_Orbitals* get_paraV_pointer() const;
const Parallel_Orbitals* get_paraV_pointer() const {return this->_paraV;}

const K_Vectors* get_kv_pointer() const;
const K_Vectors* get_kv_pointer() const {return this->_kv;}

/**
* @brief calculate density matrix DMR from dm(k) using blas::axpy
Expand Down

0 comments on commit c78456c

Please sign in to comment.