Skip to content

Commit 4b37684

Browse files
authored
Merge branch 'develop' into refactor
2 parents 08d424a + 80ab641 commit 4b37684

File tree

7 files changed

+607
-595
lines changed

7 files changed

+607
-595
lines changed

source/module_io/write_elf.cpp

+15-8
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,34 @@ void write_elf(
2222
std::vector<std::vector<double>> elf(nspin, std::vector<double>(rho_basis->nrxx, 0.));
2323
// 1) calculate the kinetic energy density of vW KEDF
2424
std::vector<std::vector<double>> tau_vw(nspin, std::vector<double>(rho_basis->nrxx, 0.));
25+
std::vector<double> phi(rho_basis->nrxx, 0.); // phi = sqrt(rho)
26+
2527
for (int is = 0; is < nspin; ++is)
2628
{
27-
std::vector<std::vector<double>> gradient_rho(3, std::vector<double>(rho_basis->nrxx, 0.));
28-
29-
std::vector<std::complex<double>> recip_rho(rho_basis->npw, 0.0);
30-
std::vector<std::complex<double>> recip_gradient_rho(rho_basis->npw, 0.0);
31-
rho_basis->real2recip(rho[is], recip_rho.data());
29+
for (int ir = 0; ir < rho_basis->nrxx; ++ir)
30+
{
31+
phi[ir] = std::sqrt(std::abs(rho[is][ir]));
32+
}
33+
34+
std::vector<std::vector<double>> gradient_phi(3, std::vector<double>(rho_basis->nrxx, 0.));
35+
std::vector<std::complex<double>> recip_phi(rho_basis->npw, 0.0);
36+
std::vector<std::complex<double>> recip_gradient_phi(rho_basis->npw, 0.0);
37+
38+
rho_basis->real2recip(phi.data(), recip_phi.data());
3239

3340
std::complex<double> img(0.0, 1.0);
3441
for (int j = 0; j < 3; ++j)
3542
{
3643
for (int ip = 0; ip < rho_basis->npw; ++ip)
3744
{
38-
recip_gradient_rho[ip] = img * rho_basis->gcar[ip][j] * recip_rho[ip] * rho_basis->tpiba;
45+
recip_gradient_phi[ip] = img * rho_basis->gcar[ip][j] * recip_phi[ip] * rho_basis->tpiba;
3946
}
4047

41-
rho_basis->recip2real(recip_gradient_rho.data(), gradient_rho[j].data());
48+
rho_basis->recip2real(recip_gradient_phi.data(), gradient_phi[j].data());
4249

4350
for (int ir = 0; ir < rho_basis->nrxx; ++ir)
4451
{
45-
tau_vw[is][ir] += gradient_rho[j][ir] * gradient_rho[j][ir] / (8. * rho[is][ir]) * 2.0; // convert Ha to Ry.
52+
tau_vw[is][ir] += gradient_phi[j][ir] * gradient_phi[j][ir] / 2. * 2.; // convert Ha to Ry.
4653
}
4754
}
4855
}

source/version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#ifndef VERSION
2-
#define VERSION "v3.9.0.3"
2+
#define VERSION "v3.9.0.4"
33
#endif

tests/integrate/119_PW_out_elf/refELF.cube

+288-288
Large diffs are not rendered by default.
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
etotref -194.6234112615314
2-
etotperatomref -97.3117056308
1+
etotref -194.6234112652899
2+
etotperatomref -97.3117056326
33
ComparePot1_pass 0
44
pointgroupref T_d
55
spacegroupref O_h
66
nksibzref 1
7-
totaltimeref 0.25
7+
totaltimeref 0.32

tests/integrate/219_NO_out_elf/refELF.cube

+288-288
Large diffs are not rendered by default.
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
etotref -196.6254053459516
1+
etotref -196.6254053459514
22
etotperatomref -98.3127026730
33
ComparePot1_pass 0
44
pointgroupref T_d
55
spacegroupref O_h
66
nksibzref 1
7-
totaltimeref 1.14
7+
totaltimeref 0.94

toolchain/scripts/stage4/install_rapidjson.sh

+10-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
# Only problem is the installation from github.com
77

88
# Last Update in 2024-0119
9+
# Last Update in 2025-04-28 by Kai Luo
910

1011
[ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0
1112
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)"
1213

13-
rapidjson_ver="1.1.0"
14+
rapidjson_ver="master" # latest version, instead of "1.1.0" fixing issue of #5518
1415
rapidjson_sha256="bf7ced29704a1e696fbccf2a2b4ea068e7774fa37f6d7dd4039d0787f8bed98e"
1516
source "${SCRIPT_DIR}"/common_vars.sh
1617
source "${SCRIPT_DIR}"/tool_kit.sh
@@ -31,8 +32,10 @@ case "$with_rapidjson" in
3132
pkg_install_dir="${INSTALLDIR}/$dirname"
3233
#pkg_install_dir="${HOME}/lib/rapidjson/${rapidjson_ver}"
3334
install_lock_file="$pkg_install_dir/install_successful"
34-
url="https://github.com/Tencent/rapidjson/archive/refs/tags/v${rapidjson_ver}.tar.gz"
35-
filename="rapidjson-${rapidjson_ver}.tar.gz"
35+
#url="https://github.com/Tencent/rapidjson/archive/refs/tags/v${rapidjson_ver}.tar.gz" # commented by Kai Luo in 2025/04/28
36+
url="https://codeload.github.com/Tencent/rapidjson/zip/refs/heads/master"
37+
# filename="rapidjson-${rapidjson_ver}.tar.gz"
38+
filename="rapidjson-${rapidjson_ver}.zip" # changed by Kai Luo in 2025/04/28
3639
if verify_checksums "${install_lock_file}"; then
3740
echo "$dirname is already installed, skipping it."
3841
else
@@ -41,14 +44,16 @@ case "$with_rapidjson" in
4144
else
4245
# download from github.com and checksum
4346
echo "===> Notice: This version of rapidjson is downloaded in GitHub Release, which will always be out-of-date version <==="
44-
download_pkg_from_url "${rapidjson_sha256}" "${filename}" "${url}"
47+
# download_pkg_from_url "${rapidjson_sha256}" "${filename}" "${url}"
48+
wget "${url}" -O "${filename}" --no-check-certificate # use wget directly instead of download_pkg_from_url
4549
fi
4650
if [ "${PACK_RUN}" = "__TRUE__" ]; then
4751
echo "--pack-run mode specified, skip installation"
4852
else
4953
echo "Installing from scratch into ${pkg_install_dir}"
5054
[ -d $dirname ] && rm -rf $dirname
51-
tar -xzf $filename
55+
# tar -xzf $filename
56+
unzip -q $filename # downloaded file is a zip file, so use unzip instead of tar, use -q to suppress output
5257
mkdir -p "${pkg_install_dir}"
5358
cp -r $dirname/* "${pkg_install_dir}/"
5459
# for CMake to find rapidjson

0 commit comments

Comments
 (0)