diff --git a/source/module_lr/potentials/kernel_xc.cpp b/source/module_lr/potentials/kernel_xc.cpp index 96b0aa944f..6a946c2420 100644 --- a/source/module_lr/potentials/kernel_xc.cpp +++ b/source/module_lr/potentials/kernel_xc.cpp @@ -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); } @@ -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 { @@ -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>(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>(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>(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 // { @@ -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__));