diff --git a/source/module_hamilt_pw/hamilt_ofdft/kedf_vw.cpp b/source/module_hamilt_pw/hamilt_ofdft/kedf_vw.cpp index aee88f0dbd..5dc344223b 100644 --- a/source/module_hamilt_pw/hamilt_ofdft/kedf_vw.cpp +++ b/source/module_hamilt_pw/hamilt_ofdft/kedf_vw.cpp @@ -129,9 +129,9 @@ void KEDF_vW::tau_vw(const double* const* prho, ModulePW::PW_Basis* pw_rho, doub { std::vector> nabla_rho(3, std::vector(pw_rho->nrxx, 0.)); - std::complex *recip_rho = new std::complex[pw_rho->npw]; - std::complex *recip_nabla_rho = new std::complex[pw_rho->npw]; - pw_rho->real2recip(prho[is], recip_rho); + std::vector> recip_rho(pw_rho->npw, 0.); + std::vector> recip_nabla_rho(pw_rho->npw, 0.); + pw_rho->real2recip(prho[is], recip_rho.data()); std::complex img(0.0, 1.0); for (int j = 0; j < 3; ++j) @@ -141,7 +141,7 @@ void KEDF_vW::tau_vw(const double* const* prho, ModulePW::PW_Basis* pw_rho, doub recip_nabla_rho[ip] = img * pw_rho->gcar[ip][j] * recip_rho[ip] * pw_rho->tpiba; } - pw_rho->recip2real(recip_nabla_rho, nabla_rho[j].data()); + pw_rho->recip2real(recip_nabla_rho.data(), nabla_rho[j].data()); for (int ir = 0; ir < pw_rho->nrxx; ++ir) { diff --git a/source/module_io/write_elf.cpp b/source/module_io/write_elf.cpp index 0bd2f72927..452c9b6e45 100644 --- a/source/module_io/write_elf.cpp +++ b/source/module_io/write_elf.cpp @@ -69,7 +69,7 @@ void write_elf( } // 3) calculate the enhancement factor F = (tau_KS - tau_vw) / tau_TF, and then ELF = 1 / (1 + F^2) - double eps = 1.0e-5; // suppress the numerical instability in LCAO + double eps = 1.0e-5; // suppress the numerical instability in LCAO (Ref: Acta Phys. -Chim. Sin. 2011, 27(12), 2786-2792. doi: 10.3866/PKU.WHXB20112786) for (int is = 0; is < nspin; ++is) { for (int ir = 0; ir < rho_basis->nrxx; ++ir) @@ -112,7 +112,7 @@ void write_elf( { for (int is = 0; is < nspin; ++is) { - std::string fn_temp = out_dir + "/ELF_SPIN" + std::to_string(is) + ".cube"; + std::string fn_temp = out_dir + "/ELF_SPIN" + std::to_string(is + 1) + ".cube"; int ispin = is + 1; ModuleIO::write_cube(