Skip to content

Commit d8f3d9d

Browse files
committed
rename new/delete_p2 as new/delete_pointer_dim2
1 parent 1c20dc2 commit d8f3d9d

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

source/module_lr/lr_spectrum.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void LR::LR_Spectrum<double>::oscillator_strength(Grid_Driver& gd, const std::ve
5353

5454
// 2. transition density
5555
double** rho_trans;
56-
LR_Util::new_p2(rho_trans, 1, this->rho_basis.nrxx);
56+
LR_Util::new_pointer_dim2(rho_trans, 1, this->rho_basis.nrxx);
5757
this->cal_gint_rho(rho_trans, this->rho_basis.nrxx);
5858

5959
// 3. transition dipole moment
@@ -67,7 +67,7 @@ void LR::LR_Spectrum<double>::oscillator_strength(Grid_Driver& gd, const std::ve
6767
ModuleBase::Vector3<double> rc = rd * ucell.latvec * ucell.lat0; // real coordinate
6868
transition_dipole_[istate] += rc * rho_trans[0][ir];
6969
}
70-
LR_Util::delete_p2(rho_trans, 1);
70+
LR_Util::delete_pointer_dim2(rho_trans, 1);
7171
}
7272
transition_dipole_[istate] *= (ucell.omega / static_cast<double>(gint->get_ncxyz())); // dv
7373
Parallel_Reduce::reduce_all(transition_dipole_[istate].x);
@@ -114,8 +114,8 @@ void LR::LR_Spectrum<std::complex<double>>::oscillator_strength(Grid_Driver& gd,
114114
// 2. transition density
115115
double** rho_trans_real;
116116
double** rho_trans_imag;
117-
LR_Util::new_p2(rho_trans_real, 1, this->rho_basis.nrxx);
118-
LR_Util::new_p2(rho_trans_imag, 1, this->rho_basis.nrxx);
117+
LR_Util::new_pointer_dim2(rho_trans_real, 1, this->rho_basis.nrxx);
118+
LR_Util::new_pointer_dim2(rho_trans_imag, 1, this->rho_basis.nrxx);
119119
// real part
120120
LR_Util::get_DMR_real_imag_part(DM_trans, DM_trans_real_imag, ucell.nat, 'R');
121121
this->gint->transfer_DM2DtoGrid(DM_trans_real_imag.get_DMR_vector());
@@ -140,8 +140,8 @@ void LR::LR_Spectrum<std::complex<double>>::oscillator_strength(Grid_Driver& gd,
140140
ModuleBase::Vector3<std::complex<double>> rc_complex(rc.x, rc.y, rc.z);
141141
transition_dipole_[istate] += rc_complex * std::complex<double>(rho_trans_real[0][ir], rho_trans_imag[0][ir]);
142142
}
143-
LR_Util::delete_p2(rho_trans_real, 1);
144-
LR_Util::delete_p2(rho_trans_imag, 1);
143+
LR_Util::delete_pointer_dim2(rho_trans_real, 1);
144+
LR_Util::delete_pointer_dim2(rho_trans_imag, 1);
145145
}
146146
transition_dipole_[istate] *= (ucell.omega / static_cast<double>(gint->get_ncxyz())); // dv
147147
Parallel_Reduce::reduce_all(transition_dipole_[istate].x);

source/module_lr/operator_casida/operator_lr_hxc.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ namespace LR
6161
// \f[ \tilde{\rho}(r)=\sum_{\mu_j, \mu_b}\tilde{\rho}_{\mu_j,\mu_b}\phi_{\mu_b}(r)\phi_{\mu_j}(r) \f]
6262
double** rho_trans;
6363
const int& nrxx = this->pot.lock()->nrxx;
64-
LR_Util::new_p2(rho_trans, 1, nrxx); // currently gint_kernel_rho uses PARAM.inp.nspin, it needs refactor
64+
LR_Util::new_pointer_dim2(rho_trans, 1, nrxx); // currently gint_kernel_rho uses PARAM.inp.nspin, it needs refactor
6565
ModuleBase::GlobalFunc::ZEROS(rho_trans[0], nrxx);
6666
Gint_inout inout_rho(rho_trans, Gint_Tools::job_type::rho, 1, false);
6767
this->gint->cal_gint(&inout_rho);
6868

6969
// 3. v_hxc = f_hxc * rho_trans
7070
ModuleBase::matrix vr_hxc(1, nrxx); //grid
7171
this->pot.lock()->cal_v_eff(rho_trans, &GlobalC::ucell, vr_hxc, ispin_ks);
72-
LR_Util::delete_p2(rho_trans, 1);
72+
LR_Util::delete_pointer_dim2(rho_trans, 1);
7373

7474
// 4. V^{Hxc}_{\mu,\nu}=\int{dr} \phi_\mu(r) v_{Hxc}(r) \phi_\mu(r)
7575
Gint_inout inout_vlocal(vr_hxc.c, 0, Gint_Tools::job_type::vlocal);
@@ -103,7 +103,7 @@ namespace LR
103103
double** rho_trans;
104104
const int& nrxx = this->pot.lock()->nrxx;
105105

106-
LR_Util::new_p2(rho_trans, 1, nrxx); // nspin=1 for transition density
106+
LR_Util::new_pointer_dim2(rho_trans, 1, nrxx); // nspin=1 for transition density
107107
ModuleBase::GlobalFunc::ZEROS(rho_trans[0], nrxx);
108108
Gint_inout inout_rho(rho_trans, Gint_Tools::job_type::rho, 1, false);
109109
this->gint->cal_gint(&inout_rho);
@@ -114,7 +114,7 @@ namespace LR
114114
this->pot.lock()->cal_v_eff(rho_trans, &GlobalC::ucell, vr_hxc, ispin_ks);
115115
// print_grid_nonzero(vr_hxc.c, this->poticab->nrxx, 10, "vr_hxc");
116116

117-
LR_Util::delete_p2(rho_trans, 1);
117+
LR_Util::delete_pointer_dim2(rho_trans, 1);
118118

119119
// 4. V^{Hxc}_{\mu,\nu}=\int{dr} \phi_\mu(r) v_{Hxc}(r) \phi_\mu(r)
120120
Gint_inout inout_vlocal(vr_hxc.c, 0, Gint_Tools::job_type::vlocal);

source/module_lr/potentials/pot_hxc_lrtd.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace LR
5757
{
5858
assert(lr_init_xc_kernel.size() >= 2);
5959
double** rho_for_fxc;
60-
LR_Util::new_p2(rho_for_fxc, nspin, nrxx);
60+
LR_Util::new_pointer_dim2(rho_for_fxc, nspin, nrxx);
6161
double ef = 0.0;
6262
int prenspin = 1;
6363
for (int is = 0;is < nspin;++is)
@@ -67,7 +67,7 @@ namespace LR
6767
rho_for_fxc[is], ucell->nat);
6868
}
6969
this->xc_kernel_components_.f_xc_libxc(nspin, ucell->omega, ucell->tpiba, rho_for_fxc, chg_gs->rho_core);
70-
LR_Util::delete_p2(rho_for_fxc, nspin);
70+
LR_Util::delete_pointer_dim2(rho_for_fxc, nspin);
7171
}
7272
else { this->xc_kernel_components_.f_xc_libxc(nspin, ucell->omega, ucell->tpiba, chg_gs->rho, chg_gs->rho_core); }
7373
#else

source/module_lr/utils/gint_move.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ using D2 = void(*) (T**, size_t);
1212
// template <typename T>
1313
// using D3 = void(*) (T***, size_t, size_t);
1414
// template <typename T>
15-
// D2<T> d2 = LR_Util::delete_p2<T>;
15+
// D2<T> d2 = LR_Util::delete_pointer_dim2<T>;
1616
// template <typename T>
1717
// D3<T> d3 = LR_Util::delete_p3<T>;
1818
// Change to C++ 11
19-
D2<double> d2 = LR_Util::delete_p2<double>;
19+
D2<double> d2 = LR_Util::delete_pointer_dim2<double>;
2020
// D3<double> d3 = LR_Util::delete_p3<double>;
2121

2222

source/module_lr/utils/lr_util.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ namespace LR_Util
5151
//====== newers and deleters========
5252
/// @brief delete 2d pointer
5353
template <typename T>
54-
void delete_p2(T** p2, size_t size);
54+
void delete_pointer_dim2(T** p2, size_t size);
5555
/// @brief new 2d pointer
5656
template <typename T>
57-
void new_p2(T**& p2, size_t size1, size_t size2);
57+
void new_pointer_dim2(T**& p2, size_t size1, size_t size2);
5858

5959
template<typename T> ct::Tensor newTensor(const ct::TensorShape& shape)
6060
{

source/module_lr/utils/lr_util.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace LR_Util
3232
/// @param size1
3333
/// @param size2
3434
template <typename T>
35-
void new_p2(T**& p2, size_t size1, size_t size2)
35+
void new_pointer_dim2(T**& p2, size_t size1, size_t size2)
3636
{
3737
p2 = new T * [size1];
3838
for (size_t i = 0; i < size1; ++i)
@@ -46,7 +46,7 @@ namespace LR_Util
4646
/// @param p2
4747
/// @param size
4848
template <typename T>
49-
void delete_p2(T** p2, size_t size)
49+
void delete_pointer_dim2(T** p2, size_t size)
5050
{
5151
if (p2 != nullptr)
5252
{

0 commit comments

Comments
 (0)