Skip to content

Commit 706633f

Browse files
authored
add const in module_lr (#5817)
1 parent 1b49590 commit 706633f

File tree

8 files changed

+24
-24
lines changed

8 files changed

+24
-24
lines changed

source/module_lr/AX/AX.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ namespace LR
1313
const psi::Psi<double>& c,
1414
const int& nocc,
1515
const int& nvirt,
16-
double* AX_istate);
16+
double* const AX_istate);
1717
void cal_AX_blas(
1818
const std::vector<container::Tensor>& V_istate,
1919
const psi::Psi<double>& c,
2020
const int& nocc,
2121
const int& nvirt,
22-
double* AX_istate,
22+
double* const AX_istate,
2323
const bool add_on = true);
2424
#ifdef __MPI
2525
void cal_AX_pblas(
@@ -31,7 +31,7 @@ namespace LR
3131
const int& nocc,
3232
const int& nvirt,
3333
const Parallel_2D& pX,
34-
double* AX_istate,
34+
double* const AX_istate,
3535
const bool add_on=true);
3636
#endif
3737
// complex
@@ -40,13 +40,13 @@ namespace LR
4040
const psi::Psi<std::complex<double>>& c,
4141
const int& nocc,
4242
const int& nvirt,
43-
std::complex<double>* AX_istate);
43+
std::complex<double>* const AX_istate);
4444
void cal_AX_blas(
4545
const std::vector<container::Tensor>& V_istate,
4646
const psi::Psi<std::complex<double>>& c,
4747
const int& nocc,
4848
const int& nvirt,
49-
std::complex<double>* AX_istate,
49+
std::complex<double>* const AX_istate,
5050
const bool add_on = true);
5151

5252
#ifdef __MPI
@@ -59,7 +59,7 @@ namespace LR
5959
const int& nocc,
6060
const int& nvirt,
6161
const Parallel_2D& pX,
62-
std::complex<double>* AX_istate,
62+
std::complex<double>* const AX_istate,
6363
const bool add_on = true);
6464
#endif
6565
}

source/module_lr/AX/AX_parallel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ namespace LR
7171
const int& nocc,
7272
const int& nvirt,
7373
const Parallel_2D& pX,
74-
std::complex<double>* AX_istate,
74+
std::complex<double>* const AX_istate,
7575
const bool add_on)
7676
{
7777
ModuleBase::TITLE("hamilt_lrtd", "cal_AX_plas");

source/module_lr/AX/AX_serial.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace LR
4040
const psi::Psi<std::complex<double>>& c,
4141
const int& nocc,
4242
const int& nvirt,
43-
std::complex<double>* AX_istate)
43+
std::complex<double>* const AX_istate)
4444
{
4545
ModuleBase::TITLE("hamilt_lrtd", "cal_AX_forloop");
4646
const int nks = V_istate.size();
@@ -107,7 +107,7 @@ namespace LR
107107
const psi::Psi<std::complex<double>>& c,
108108
const int& nocc,
109109
const int& nvirt,
110-
std::complex<double>* AX_istate,
110+
std::complex<double>* const AX_istate,
111111
const bool add_on)
112112
{
113113
ModuleBase::TITLE("hamilt_lrtd", "cal_AX_blas");

source/module_lr/dm_trans/dm_trans.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace LR
1414
/// \f[ \tilde{\rho}_{\mu_j\mu_b}=\sum_{jb}c_{j,\mu_j}X_{jb}c^*_{b,\mu_b} \f]
1515
template<typename T>
1616
std::vector<container::Tensor> cal_dm_trans_pblas(
17-
const T* X_istate,
17+
const T* const X_istate,
1818
const Parallel_2D& px,
1919
const psi::Psi<T>& c,
2020
const Parallel_2D& pc,
@@ -29,7 +29,7 @@ namespace LR
2929
/// @brief calculate the 2d-block transition density matrix in AO basis using ?gemm
3030
template<typename T>
3131
std::vector<container::Tensor> cal_dm_trans_blas(
32-
const T* X_istate,
32+
const T* const X_istate,
3333
const psi::Psi<T>& c,
3434
const int& nocc, const int& nvirt,
3535
const bool renorm_k = true,
@@ -39,7 +39,7 @@ namespace LR
3939
/// @brief calculate the 2d-block transition density matrix in AO basis using for loop (for test)
4040
template<typename T>
4141
std::vector<container::Tensor> cal_dm_trans_forloop_serial(
42-
const T* X_istate,
42+
const T* const X_istate,
4343
const psi::Psi<T>& c,
4444
const int& nocc, const int& nvirt,
4545
const bool renorm_k = true,

source/module_lr/dm_trans/dm_trans_parallel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace LR
1010
// c: nao*nbands in para2d, nbands*nao in psi (row-para and constructed: nao)
1111
// X: nvirt*nocc in para2d, nocc*nvirt in psi (row-para and constructed: nvirt)
1212
template <>
13-
std::vector<container::Tensor> cal_dm_trans_pblas(const double* X_istate,
13+
std::vector<container::Tensor> cal_dm_trans_pblas(const double* const X_istate,
1414
const Parallel_2D& px,
1515
const psi::Psi<double>& c,
1616
const Parallel_2D& pc,
@@ -62,7 +62,7 @@ std::vector<container::Tensor> cal_dm_trans_pblas(const double* X_istate,
6262
return dm_trans;
6363
}
6464
template <>
65-
std::vector<container::Tensor> cal_dm_trans_pblas(const std::complex<double>* X_istate,
65+
std::vector<container::Tensor> cal_dm_trans_pblas(const std::complex<double>* const X_istate,
6666
const Parallel_2D& px,
6767
const psi::Psi<std::complex<double>>& c,
6868
const Parallel_2D& pc,

source/module_lr/dm_trans/dm_trans_serial.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace LR
77
{
88
template<> std::vector<container::Tensor> cal_dm_trans_forloop_serial(
9-
const double* X_istate,
9+
const double* const X_istate,
1010
const psi::Psi<double>& c,
1111
const int& nocc,
1212
const int& nvirt,
@@ -41,7 +41,7 @@ namespace LR
4141
}
4242

4343
template<> std::vector<container::Tensor> cal_dm_trans_forloop_serial(
44-
const std::complex<double>* X_istate,
44+
const std::complex<double>* const X_istate,
4545
const psi::Psi<std::complex<double>>& c,
4646
const int& nocc,
4747
const int& nvirt,
@@ -78,7 +78,7 @@ namespace LR
7878

7979

8080
template<> std::vector<container::Tensor> cal_dm_trans_blas(
81-
const double* X_istate,
81+
const double* const X_istate,
8282
const psi::Psi<double>& c,
8383
const int& nocc,
8484
const int& nvirt,
@@ -112,7 +112,7 @@ namespace LR
112112

113113

114114
template<> std::vector<container::Tensor> cal_dm_trans_blas(
115-
const std::complex<double>* X_istate,
115+
const std::complex<double>* const X_istate,
116116
const psi::Psi<std::complex<double>>& c,
117117
const int& nocc,
118118
const int& nvirt,

source/module_lr/hamilt_casida.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ namespace LR
115115
}
116116
#endif
117117

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

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

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

192-
std::function<void(const int&, const T*)> cal_dm_trans;
192+
std::function<void(const int&, const T* const)> cal_dm_trans;
193193
};
194194
}

source/module_lr/hamilt_ulr.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ namespace LR
6868
}
6969
#endif
7070

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

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

0 commit comments

Comments
 (0)