Skip to content

Commit eea2271

Browse files
committed
rename gdr as gradrho
1 parent f6534ac commit eea2271

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

source/module_lr/potentials/xc_kernel.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void LR::KernelXC::f_xc_libxc(const int& nspin, const double& omega, const doubl
5050
}
5151
return false;
5252
}();
53-
std::vector<std::vector<ModuleBase::Vector3<double>>> gdr; // \nabla \rho
53+
std::vector<std::vector<ModuleBase::Vector3<double>>> gradrho; // \nabla \rho
5454
std::vector<double> sigma; // |\nabla\rho|^2
5555
std::vector<double> sgn; // sgn for threshold mask
5656
if (is_gga)
@@ -60,16 +60,16 @@ void LR::KernelXC::f_xc_libxc(const int& nspin, const double& omega, const doubl
6060
// a cutoff for grho is required to ensure that libxc gives reasonable results
6161

6262
// 1. \nabla \rho
63-
gdr.resize(nspin);
63+
gradrho.resize(nspin);
6464
for (int is = 0; is < nspin; ++is)
6565
{
6666
std::vector<double> rhor(nrxx);
6767
#ifdef _OPENMP
6868
#pragma omp parallel for schedule(static, 1024)
6969
#endif
7070
for (int ir = 0; ir < nrxx; ++ir) rhor[ir] = rho[ir * nspin + is];
71-
gdr[is].resize(nrxx);
72-
LR_Util::grad(rhor.data(), gdr[is].data(), rho_basis_, tpiba);
71+
gradrho[is].resize(nrxx);
72+
LR_Util::grad(rhor.data(), gradrho[is].data(), rho_basis_, tpiba);
7373
}
7474
// 2. |\nabla\rho|^2
7575
sigma.resize(nrxx * ((1 == nspin) ? 1 : 3));
@@ -79,7 +79,7 @@ void LR::KernelXC::f_xc_libxc(const int& nspin, const double& omega, const doubl
7979
#pragma omp parallel for schedule(static, 1024)
8080
#endif
8181
for (int ir = 0; ir < nrxx; ++ir)
82-
sigma[ir] = gdr[0][ir] * gdr[0][ir];
82+
sigma[ir] = gradrho[0][ir] * gradrho[0][ir];
8383
}
8484
else
8585
{
@@ -88,9 +88,9 @@ void LR::KernelXC::f_xc_libxc(const int& nspin, const double& omega, const doubl
8888
#endif
8989
for (int ir = 0; ir < nrxx; ++ir)
9090
{
91-
sigma[ir * 3] = gdr[0][ir] * gdr[0][ir];
92-
sigma[ir * 3 + 1] = gdr[0][ir] * gdr[1][ir];
93-
sigma[ir * 3 + 2] = gdr[1][ir] * gdr[1][ir];
91+
sigma[ir * 3] = gradrho[0][ir] * gradrho[0][ir];
92+
sigma[ir * 3 + 1] = gradrho[0][ir] * gradrho[1][ir];
93+
sigma[ir * 3 + 2] = gradrho[1][ir] * gradrho[1][ir];
9494
}
9595
}
9696
}
@@ -146,10 +146,10 @@ void LR::KernelXC::f_xc_libxc(const int& nspin, const double& omega, const doubl
146146
{
147147
// 0. drho
148148
this->grad_kernel_set_.emplace("drho_gs", std::vector<ModuleBase::Vector3<double>>(nrxx));
149-
for (int ir = 0; ir < nrxx; ++ir)this->grad_kernel_set_["drho_gs"][ir] = gdr[0][ir];
149+
for (int ir = 0; ir < nrxx; ++ir)this->grad_kernel_set_["drho_gs"][ir] = gradrho[0][ir];
150150
// 1. $2f^{\rho\sigma}*\nabla\rho$
151151
this->grad_kernel_set_.emplace("2_v2rhosigma_drho", std::vector<ModuleBase::Vector3<double>>(nrxx));
152-
for (int ir = 0; ir < nrxx; ++ir)this->grad_kernel_set_["2_v2rhosigma_drho"][ir] = gdr[0][ir] * v2rs.at(ir) * 2.;
152+
for (int ir = 0; ir < nrxx; ++ir)this->grad_kernel_set_["2_v2rhosigma_drho"][ir] = gradrho[0][ir] * v2rs.at(ir) * 2.;
153153
// 2. $4f^{\sigma\sigma}*\nabla\rho$
154154
this->grad_kernel_set_.emplace("4_v2sigma2_drho", std::vector<ModuleBase::Vector3<double>>(nrxx));
155155
for (int ir = 0; ir < nrxx; ++ir)this->grad_kernel_set_["4_v2sigma2_drho"][ir] = sigma.at(ir) * v2s2.at(ir) * 4.;
@@ -161,12 +161,12 @@ void LR::KernelXC::f_xc_libxc(const int& nspin, const double& omega, const doubl
161161
// std::vector<ModuleBase::Vector3<double>> v2rhosigma_gdrho_r(3 * nrxx);
162162
// for (int ir = 0; ir < nrxx; ++ir)
163163
// {
164-
// v2rhosigma_gdrho_r[ir] = gdr[0][ir] * v2rs.at(ir * 6) * 4.0
165-
// + gdr[1][ir] * v2rs.at(ir * 6 + 1) * 2.0; //up-up
166-
// v2rhosigma_gdrho_r[nrxx + ir] = gdr[0][ir] * (v2rs.at(ir * 6 + 3) * 2.0 + v2rs.at(ir * 6 + 1))
167-
// + gdr[1][ir] * (v2rs.at(ir * 6 + 2) * 2.0 + v2rs.at(ir * 6 + 4)); //up-down
168-
// v2rhosigma_gdrho_r[2 * nrxx + ir] = gdr[1][ir] * v2rs.at(ir * 6 + 5) * 4.0
169-
// + gdr[0][ir] * v2rs.at(ir * 6 + 4) * 2.0; //down-down
164+
// v2rhosigma_gdrho_r[ir] = gradrho[0][ir] * v2rs.at(ir * 6) * 4.0
165+
// + gradrho[1][ir] * v2rs.at(ir * 6 + 1) * 2.0; //up-up
166+
// v2rhosigma_gdrho_r[nrxx + ir] = gradrho[0][ir] * (v2rs.at(ir * 6 + 3) * 2.0 + v2rs.at(ir * 6 + 1))
167+
// + gradrho[1][ir] * (v2rs.at(ir * 6 + 2) * 2.0 + v2rs.at(ir * 6 + 4)); //up-down
168+
// v2rhosigma_gdrho_r[2 * nrxx + ir] = gradrho[1][ir] * v2rs.at(ir * 6 + 5) * 4.0
169+
// + gradrho[0][ir] * v2rs.at(ir * 6 + 4) * 2.0; //down-down
170170
// }
171171
// for (int isig = 0;isig < 3;++isig)
172172
// XC_Functional::grad_dot(v2rhosigma_gdrho_r.data() + isig * nrxx, div_v2rhosigma_gdrho_r.data() + isig * nrxx, chg_gs->rhopw, tpiba);

source/module_lr/utils/lr_util_xc.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ namespace LR_Util
44
{
55
template<typename T>
66
void grad(const T* rhor,
7-
ModuleBase::Vector3<T>* gdr,
7+
ModuleBase::Vector3<T>* gradrho,
88
const ModulePW::PW_Basis& rho_basis,
99
const double& tpiba)
1010
{
1111
std::vector<typename ToComplex<T>::type> rhog(rho_basis.npw);
1212
rho_basis.real2recip(rhor, rhog.data());
13-
XC_Functional::grad_rho(rhog.data(), gdr, &rho_basis, tpiba);
13+
XC_Functional::grad_rho(rhog.data(), gradrho, &rho_basis, tpiba);
1414
}
1515
template<typename T>
1616
void grad(const std::vector<T>& rhor,
17-
std::vector<ModuleBase::Vector3<T>>& gdr,
17+
std::vector<ModuleBase::Vector3<T>>& gradrho,
1818
const ModulePW::PW_Basis& rho_basis,
1919
const double& tpiba)
2020
{
21-
grad(rhor.data(), gdr.data(), rho_basis, tpiba);
21+
grad(rhor.data(), gradrho.data(), rho_basis, tpiba);
2222
}
2323

2424
template<typename T>

0 commit comments

Comments
 (0)