Skip to content

Commit

Permalink
[pre-commit.ci lite] apply automatic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci-lite[bot] authored Nov 1, 2024
1 parent 8bbbb2f commit c24e2d8
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions source/module_lr/potentials/kernel_xc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ void LR::KernelXC::f_xc_libxc(const int& nspin, const double& omega, const doubl
#ifdef _OPENMP
#pragma omp parallel for schedule(static, 1024)
#endif
for (int ir = 0; ir < nrxx; ++ir) rhor[ir] = rho[ir * nspin + is];
for (int ir = 0; ir < nrxx; ++ir) { rhor[ir] = rho[ir * nspin + is];
}
gdr[is].resize(nrxx);
LR_Util::grad(rhor.data(), gdr[is].data(), rho_basis_, tpiba);
}
Expand All @@ -77,8 +78,9 @@ void LR::KernelXC::f_xc_libxc(const int& nspin, const double& omega, const doubl
#ifdef _OPENMP
#pragma omp parallel for schedule(static, 1024)
#endif
for (int ir = 0; ir < nrxx; ++ir)
for (int ir = 0; ir < nrxx; ++ir) {
sigma[ir] = gdr[0][ir] * gdr[0][ir];
}
}
else
{
Expand Down Expand Up @@ -145,13 +147,16 @@ void LR::KernelXC::f_xc_libxc(const int& nspin, const double& omega, const doubl
{
// 0. drho
this->grad_kernel_set_.emplace("drho_gs", std::vector<ModuleBase::Vector3<double>>(nrxx));
for (int ir = 0; ir < nrxx; ++ir)this->grad_kernel_set_["drho_gs"][ir] = gdr[0][ir];
for (int ir = 0; ir < nrxx; ++ir) {this->grad_kernel_set_["drho_gs"][ir] = gdr[0][ir];
}
// 1. $2f^{\rho\sigma}*\nabla\rho$
this->grad_kernel_set_.emplace("2_v2rhosigma_drho", std::vector<ModuleBase::Vector3<double>>(nrxx));
for (int ir = 0; ir < nrxx; ++ir)this->grad_kernel_set_["2_v2rhosigma_drho"][ir] = gdr[0][ir] * v2rs.at(ir) * 2.;
for (int ir = 0; ir < nrxx; ++ir) {this->grad_kernel_set_["2_v2rhosigma_drho"][ir] = gdr[0][ir] * v2rs.at(ir) * 2.;
}
// 2. $4f^{\sigma\sigma}*\nabla\rho$
this->grad_kernel_set_.emplace("4_v2sigma2_drho", std::vector<ModuleBase::Vector3<double>>(nrxx));
for (int ir = 0; ir < nrxx; ++ir)this->grad_kernel_set_["4_v2sigma2_drho"][ir] = sigma.at(ir) * v2s2.at(ir) * 4.;
for (int ir = 0; ir < nrxx; ++ir) {this->grad_kernel_set_["4_v2sigma2_drho"][ir] = sigma.at(ir) * v2s2.at(ir) * 4.;
}
}
// else if (2 == nspin) // wrong, to be fixed
// {
Expand Down Expand Up @@ -210,9 +215,9 @@ void LR::KernelXC::f_xc_libxc(const int& nspin, const double& omega, const doubl
} // end for( xc_func_type &func : funcs )
XC_Functional_Libxc::finish_func(funcs);

if (1 == PARAM.inp.nspin || 2 == PARAM.inp.nspin) return;
if (1 == PARAM.inp.nspin || 2 == PARAM.inp.nspin) { return;
// else if (4 == PARAM.inp.nspin)
else//NSPIN != 1,2,4 is not supported
} else//NSPIN != 1,2,4 is not supported
{
throw std::domain_error("PARAM.inp.nspin =" + std::to_string(PARAM.inp.nspin)
+ " unfinished in " + std::string(__FILE__) + " line " + std::to_string(__LINE__));
Expand Down

0 comments on commit c24e2d8

Please sign in to comment.