Skip to content

Commit

Permalink
add const in module_lr
Browse files Browse the repository at this point in the history
  • Loading branch information
maki49 committed Jan 5, 2025
1 parent e25db6e commit 4614c7b
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
12 changes: 6 additions & 6 deletions source/module_lr/AX/AX.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ namespace LR
const psi::Psi<double>& c,
const int& nocc,
const int& nvirt,
double* AX_istate);
double* const AX_istate);
void cal_AX_blas(
const std::vector<container::Tensor>& V_istate,
const psi::Psi<double>& c,
const int& nocc,
const int& nvirt,
double* AX_istate,
double* const AX_istate,
const bool add_on = true);
#ifdef __MPI
void cal_AX_pblas(
Expand All @@ -31,7 +31,7 @@ namespace LR
const int& nocc,
const int& nvirt,
const Parallel_2D& pX,
double* AX_istate,
double* const AX_istate,
const bool add_on=true);
#endif
// complex
Expand All @@ -40,13 +40,13 @@ namespace LR
const psi::Psi<std::complex<double>>& c,
const int& nocc,
const int& nvirt,
std::complex<double>* AX_istate);
std::complex<double>* const AX_istate);
void cal_AX_blas(
const std::vector<container::Tensor>& V_istate,
const psi::Psi<std::complex<double>>& c,
const int& nocc,
const int& nvirt,
std::complex<double>* AX_istate,
std::complex<double>* const AX_istate,
const bool add_on = true);

#ifdef __MPI
Expand All @@ -59,7 +59,7 @@ namespace LR
const int& nocc,
const int& nvirt,
const Parallel_2D& pX,
std::complex<double>* AX_istate,
std::complex<double>* const AX_istate,
const bool add_on = true);
#endif
}
2 changes: 1 addition & 1 deletion source/module_lr/AX/AX_parallel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace LR
const int& nocc,
const int& nvirt,
const Parallel_2D& pX,
std::complex<double>* AX_istate,
std::complex<double>* const AX_istate,
const bool add_on)
{
ModuleBase::TITLE("hamilt_lrtd", "cal_AX_plas");
Expand Down
4 changes: 2 additions & 2 deletions source/module_lr/AX/AX_serial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace LR
const psi::Psi<std::complex<double>>& c,
const int& nocc,
const int& nvirt,
std::complex<double>* AX_istate)
std::complex<double>* const AX_istate)
{
ModuleBase::TITLE("hamilt_lrtd", "cal_AX_forloop");
const int nks = V_istate.size();
Expand Down Expand Up @@ -107,7 +107,7 @@ namespace LR
const psi::Psi<std::complex<double>>& c,
const int& nocc,
const int& nvirt,
std::complex<double>* AX_istate,
std::complex<double>* const AX_istate,
const bool add_on)
{
ModuleBase::TITLE("hamilt_lrtd", "cal_AX_blas");
Expand Down
6 changes: 3 additions & 3 deletions source/module_lr/dm_trans/dm_trans.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace LR
/// \f[ \tilde{\rho}_{\mu_j\mu_b}=\sum_{jb}c_{j,\mu_j}X_{jb}c^*_{b,\mu_b} \f]
template<typename T>
std::vector<container::Tensor> cal_dm_trans_pblas(
const T* X_istate,
const T* const X_istate,
const Parallel_2D& px,
const psi::Psi<T>& c,
const Parallel_2D& pc,
Expand All @@ -29,7 +29,7 @@ namespace LR
/// @brief calculate the 2d-block transition density matrix in AO basis using ?gemm
template<typename T>
std::vector<container::Tensor> cal_dm_trans_blas(
const T* X_istate,
const T* const X_istate,
const psi::Psi<T>& c,
const int& nocc, const int& nvirt,
const bool renorm_k = true,
Expand All @@ -39,7 +39,7 @@ namespace LR
/// @brief calculate the 2d-block transition density matrix in AO basis using for loop (for test)
template<typename T>
std::vector<container::Tensor> cal_dm_trans_forloop_serial(
const T* X_istate,
const T* const X_istate,
const psi::Psi<T>& c,
const int& nocc, const int& nvirt,
const bool renorm_k = true,
Expand Down
4 changes: 2 additions & 2 deletions source/module_lr/dm_trans/dm_trans_parallel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace LR
// c: nao*nbands in para2d, nbands*nao in psi (row-para and constructed: nao)
// X: nvirt*nocc in para2d, nocc*nvirt in psi (row-para and constructed: nvirt)
template <>
std::vector<container::Tensor> cal_dm_trans_pblas(const double* X_istate,
std::vector<container::Tensor> cal_dm_trans_pblas(const double* const X_istate,
const Parallel_2D& px,
const psi::Psi<double>& c,
const Parallel_2D& pc,
Expand Down Expand Up @@ -62,7 +62,7 @@ std::vector<container::Tensor> cal_dm_trans_pblas(const double* X_istate,
return dm_trans;
}
template <>
std::vector<container::Tensor> cal_dm_trans_pblas(const std::complex<double>* X_istate,
std::vector<container::Tensor> cal_dm_trans_pblas(const std::complex<double>* const X_istate,
const Parallel_2D& px,
const psi::Psi<std::complex<double>>& c,
const Parallel_2D& pc,
Expand Down
8 changes: 4 additions & 4 deletions source/module_lr/dm_trans/dm_trans_serial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace LR
{
template<> std::vector<container::Tensor> cal_dm_trans_forloop_serial(
const double* X_istate,
const double* const X_istate,
const psi::Psi<double>& c,
const int& nocc,
const int& nvirt,
Expand Down Expand Up @@ -41,7 +41,7 @@ namespace LR
}

template<> std::vector<container::Tensor> cal_dm_trans_forloop_serial(
const std::complex<double>* X_istate,
const std::complex<double>* const X_istate,
const psi::Psi<std::complex<double>>& c,
const int& nocc,
const int& nvirt,
Expand Down Expand Up @@ -78,7 +78,7 @@ namespace LR


template<> std::vector<container::Tensor> cal_dm_trans_blas(
const double* X_istate,
const double* const X_istate,
const psi::Psi<double>& c,
const int& nocc,
const int& nvirt,
Expand Down Expand Up @@ -112,7 +112,7 @@ namespace LR


template<> std::vector<container::Tensor> cal_dm_trans_blas(
const std::complex<double>* X_istate,
const std::complex<double>* const X_istate,
const psi::Psi<std::complex<double>>& c,
const int& nocc,
const int& nvirt,
Expand Down
6 changes: 3 additions & 3 deletions source/module_lr/hamilt_casida.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ namespace LR
}
#endif

this->cal_dm_trans = [&, this](const int& is, const T* X)->void
this->cal_dm_trans = [&, this](const int& is, const T* const X)->void
{
const auto psi_ks_is = LR_Util::get_psi_spin(psi_ks_in, is, nk);
#ifdef __MPI
Expand All @@ -134,7 +134,7 @@ namespace LR

std::vector<T> matrix()const;

void hPsi(const T* psi_in, T* hpsi, const int ld_psi, const int& nband) const
void hPsi(const T* const psi_in, T* const hpsi, const int ld_psi, const int& nband) const
{
assert(ld_psi == nk * pX[0].get_local_size());
for (int ib = 0;ib < nband;++ib)
Expand Down Expand Up @@ -189,6 +189,6 @@ namespace LR
/// first node operator, add operations from each operators
hamilt::Operator<T, base_device::DEVICE_CPU>* ops = nullptr;

std::function<void(const int&, const T*)> cal_dm_trans;
std::function<void(const int&, const T* const)> cal_dm_trans;
};
}
6 changes: 3 additions & 3 deletions source/module_lr/hamilt_ulr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace LR
}
#endif

this->cal_dm_trans = [&, this](const int& is, const T* X)->void
this->cal_dm_trans = [&, this](const int& is, const T* const X)->void
{
const auto psi_ks_is = LR_Util::get_psi_spin(psi_ks_in, is, nk);
// LR_Util::print_value(X, pX_in[is].get_local_size());
Expand All @@ -88,7 +88,7 @@ namespace LR
{
for (auto& op : ops) { delete op; }
}
void hPsi(const T* psi_in, T* hpsi, const int ld_psi, const int& nband) const
void hPsi(const T* const psi_in, T* const hpsi, const int ld_psi, const int& nband) const
{
ModuleBase::TITLE("HamiltULR", "hPsi");
assert(ld_psi == this->ldim);
Expand Down Expand Up @@ -224,7 +224,7 @@ namespace LR
/// Hxc+Exx: size=nbands, store the result of each bands for common use
std::unique_ptr<elecstate::DensityMatrix<T, T>> DM_trans;

std::function<void(const int&, const T*)> cal_dm_trans;
std::function<void(const int&, const T* const)> cal_dm_trans;
const bool tdm_sym = false; ///< whether to symmetrize the transition density matrix
};
}

0 comments on commit 4614c7b

Please sign in to comment.