Skip to content

Commit 616afd6

Browse files
committed
Merge branch 'develop' of https://github.com/deepmodeling/abacus-develop into develop
2 parents 4cc90cf + 6d453d8 commit 616afd6

File tree

6 files changed

+36
-28
lines changed

6 files changed

+36
-28
lines changed

Dockerfile.intel

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
FROM debian:bullseye-slim
1+
FROM ubuntu:22.04
22

3-
RUN apt-get update && apt-get install -y bc cmake git gnupg gcc g++ python3 sudo wget vim unzip
3+
RUN apt-get update && apt-get install -y \
4+
bc cmake git gnupg gcc g++ python3-numpy sudo wget vim unzip \
5+
libcereal-dev libxc-dev libgtest-dev libgmock-dev
46

57
# Following steps by https://software.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-linux/top/installation/install-using-package-managers/apt.html .
68
RUN cd /tmp && \
@@ -11,20 +13,22 @@ RUN cd /tmp && \
1113

1214
# To save disk space, only install the required components, but not the whole intel-hpckit.
1315
RUN apt-get update --allow-unauthenticated \
14-
&& apt-get install -y \
16+
&& apt-get install -y --no-install-recommends \
1517
intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic \
1618
intel-oneapi-compiler-fortran \
1719
intel-oneapi-mkl-devel \
1820
intel-oneapi-mpi-devel
1921

2022
# These environment variables are the most essential part generated by `source /opt/intel/oneapi/setvars.sh`.
2123
# It is recommended to do it again if this docker image is used for development.
22-
ENV I_MPI_ROOT=/opt/intel/oneapi/mpi/latest \
24+
ENV I_MPI_ROOT='/opt/intel/oneapi/mpi/latest' \
2325
LIBRARY_PATH=/opt/intel/oneapi/tbb/latest/env/../lib/intel64/gcc4.8:/opt/intel/oneapi/mpi/latest//libfabric/lib:/opt/intel/oneapi/mpi/latest//lib/release:/opt/intel/oneapi/mpi/latest//lib:/opt/intel/oneapi/mkl/latest/lib/intel64:/opt/intel/oneapi/compiler/latest/linux/compiler/lib/intel64_lin:/opt/intel/oneapi/compiler/latest/linux/lib \
2426
LD_LIBRARY_PATH=/opt/intel/oneapi/tbb/latest/env/../lib/intel64/gcc4.8:/opt/intel/oneapi/mpi/latest//libfabric/lib:/opt/intel/oneapi/mpi/latest//lib/release:/opt/intel/oneapi/mpi/latest//lib:/opt/intel/oneapi/mkl/latest/lib/intel64:/opt/intel/oneapi/debugger/10.1.2/gdb/intel64/lib:/opt/intel/oneapi/debugger/10.1.2/libipt/intel64/lib:/opt/intel/oneapi/debugger/10.1.2/dep/lib:/opt/intel/oneapi/compiler/latest/linux/lib:/opt/intel/oneapi/compiler/latest/linux/lib/x64:/opt/intel/oneapi/compiler/latest/linux/lib/emu:/opt/intel/oneapi/compiler/latest/linux/compiler/lib/intel64_lin \
2527
PATH=/opt/intel/oneapi/mpi/latest//libfabric/bin:/opt/intel/oneapi/mpi/latest//bin:/opt/intel/oneapi/mkl/latest/bin/intel64:/opt/intel/oneapi/dev-utilities/latest/bin:/opt/intel/oneapi/debugger/10.1.2/gdb/intel64/bin:/opt/intel/oneapi/compiler/latest/linux/bin/intel64:/opt/intel/oneapi/compiler/latest/linux/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
26-
MKLROOT=/opt/intel/oneapi/mkl/latest \
27-
I_MPI_ROOT=/opt/intel/oneapi/mpi/latest
28+
MKLROOT='/opt/intel/oneapi/mkl/latest' \
29+
FI_PROVIDER_PATH='/opt/intel/oneapi/mpi/latest/libfabric/lib/prov:/usr/lib64/libfabric' \
30+
CMAKE_PREFIX_PATH='/opt/intel/oneapi/vpl/latest:/opt/intel/oneapi/tbb/latest/env/..:/opt/intel/oneapi/dnnl/latest/cpu_dpcpp_gpu_dpcpp/../lib/cmake:/opt/intel/oneapi/dal/latest:/opt/intel/oneapi/compiler/latest/linux/IntelDPCPP' \
31+
CMPLR_ROOT='/opt/intel/oneapi/compiler/latest'
2832

2933
# Using the Intel Compilers with mpi wrapper.
3034
# Further test on oneAPI Compilers needed: icx, icpx, ifx
@@ -39,12 +43,7 @@ RUN source /opt/intel/oneapi/setvars.sh \
3943
&& tar xzf elpa-2021.05.002.tar.gz && rm elpa-2021.05.002.tar.gz \
4044
&& cd elpa-2021.05.002 && mkdir build && cd build \
4145
&& ../configure FCFLAGS="-qmkl=cluster" \
42-
&& make -j8 \
46+
&& make -j`nproc` \
4347
&& make PREFIX=/usr/local install \
4448
&& ln -s /usr/local/include/elpa-2021.05.002/elpa /usr/local/include/ \
4549
&& cd /tmp && rm -rf elpa-2021.05.002
46-
47-
RUN cd /tmp \
48-
&& git clone https://github.com/USCiLab/cereal.git \
49-
&& cp -r cereal/include /usr/local \
50-
&& rm -rf cereal

source/input_conv.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ void Input_Conv::Convert(void)
366366
if (GlobalC::exx_global.info.hybrid_type != Exx_Global::Hybrid_Type::No)
367367
{
368368
GlobalC::exx_global.info.hybrid_alpha = INPUT.exx_hybrid_alpha;
369+
XC_Functional::get_hybrid_alpha(INPUT.exx_hybrid_alpha);
369370
GlobalC::exx_global.info.hse_omega = INPUT.exx_hse_omega;
370371
GlobalC::exx_global.info.separate_loop = INPUT.exx_separate_loop;
371372
GlobalC::exx_global.info.hybrid_step = INPUT.exx_hybrid_step;

source/module_xc/xc_functional.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ XC_Functional::~XC_Functional(){}
99
std::vector<int> XC_Functional::func_id(1);
1010
int XC_Functional::func_type = 0;
1111
bool XC_Functional::use_libxc = true;
12+
double XC_Functional::hybrid_alpha = 0.25;
13+
14+
void XC_Functional::get_hybrid_alpha(const double alpha_in)
15+
{
16+
hybrid_alpha = alpha_in;
17+
}
1218

1319
int XC_Functional::get_func_type()
1420
{

source/module_xc/xc_functional.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class XC_Functional
8383

8484
static int get_func_type();
8585
static void set_xc_type(const std::string xc_func_in);
86+
static void get_hybrid_alpha(const double alpha_in);
8687
#ifdef USE_LIBXC
8788
static void set_xc_type_libxc(const std::string xc_func_in);
8889
static std::vector<xc_func_type> init_func(const int xc_polarized);
@@ -94,6 +95,9 @@ class XC_Functional
9495
static int func_type; //0:none, 1:lda, 2:gga, 3:mgga, 4:hybrid
9596
static bool use_libxc;
9697

98+
//exx_hybrid_alpha for mixing exx in hybrid functional:
99+
static double hybrid_alpha;
100+
97101
//-------------------
98102
// xc_functional_wrapper_xc.cpp
99103
//-------------------

source/module_xc/xc_functional_wrapper_gcxc.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ void XC_Functional::gcxc(const double &rho, const double &grho, double &sxc,
8080
case XC_HYB_GGA_XC_PBEH: //PBE0
8181
double sx, v1x, v2x, sc, v1c, v2c;
8282
XC_Functional::pbex(rho, grho, 0, sx, v1x, v2x);
83-
sx *= (1.0 - GlobalC::exx_global.info.hybrid_alpha);
84-
v1x *= (1.0 - GlobalC::exx_global.info.hybrid_alpha);
85-
v2x *= (1.0 - GlobalC::exx_global.info.hybrid_alpha);
83+
sx *= (1.0 - XC_Functional::hybrid_alpha);
84+
v1x *= (1.0 - XC_Functional::hybrid_alpha);
85+
v2x *= (1.0 - XC_Functional::hybrid_alpha);
8686
XC_Functional::pbec(rho, grho, 0, sc, v1c, v2c);
8787
s = sx + sc;
8888
v1 = v1x + v1c;
@@ -181,16 +181,16 @@ void XC_Functional::gcx_spin(double rhoup, double rhodw, double grhoup2, double
181181
if (rhoup > small && sqrt(fabs(grhoup2)) > small)
182182
{
183183
XC_Functional::pbex(2.0 * rhoup, 4.0 * grhoup2, 0, sxup, v1xup, v2xup);
184-
sxup *= (1.0 - GlobalC::exx_global.info.hybrid_alpha);
185-
v1xup *= (1.0 - GlobalC::exx_global.info.hybrid_alpha);
186-
v2xup *= (1.0 - GlobalC::exx_global.info.hybrid_alpha);
184+
sxup *= (1.0 - XC_Functional::hybrid_alpha);
185+
v1xup *= (1.0 - XC_Functional::hybrid_alpha);
186+
v2xup *= (1.0 - XC_Functional::hybrid_alpha);
187187
}
188188
if (rhodw > small && sqrt(fabs(grhodw2)) > small)
189189
{
190190
XC_Functional::pbex(2.0 * rhodw, 4.0 * grhodw2, 0, sxdw, v1xdw, v2xdw);
191-
sxdw *= (1.0 - GlobalC::exx_global.info.hybrid_alpha);
192-
v1xdw *= (1.0 - GlobalC::exx_global.info.hybrid_alpha);
193-
v2xdw *= (1.0 - GlobalC::exx_global.info.hybrid_alpha);
191+
sxdw *= (1.0 - XC_Functional::hybrid_alpha);
192+
v1xdw *= (1.0 - XC_Functional::hybrid_alpha);
193+
v2xdw *= (1.0 - XC_Functional::hybrid_alpha);
194194
}
195195
break;
196196
case XC_GGA_X_PBE_SOL: //PBXsol

source/module_xc/xc_functional_wrapper_xc.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
// 3. xc_spin_libxc, which is the wrapper for LDA functional, spin polarized
77

88
#include "xc_functional.h"
9-
#include "../src_pw/global.h"
10-
#include "../module_base/global_function.h"
119
#include <stdexcept>
1210

1311
void XC_Functional::xc(const double &rho, double &exc, double &vxc)
@@ -37,8 +35,8 @@ void XC_Functional::xc(const double &rho, double &exc, double &vxc)
3735
// PBE0
3836
double ex, vx, ec, vc;
3937
XC_Functional::slater(rs, ex, vx);
40-
ex *= (1 - GlobalC::exx_global.info.hybrid_alpha);
41-
vx *= (1 - GlobalC::exx_global.info.hybrid_alpha);
38+
ex *= (1 - XC_Functional::hybrid_alpha);
39+
vx *= (1 - XC_Functional::hybrid_alpha);
4240
XC_Functional::pw(rs, 0, ec, vc);
4341
e = ex + ec;
4442
v = vx + vc;
@@ -94,9 +92,9 @@ void XC_Functional::xc_spin(const double &rho, const double &zeta,
9492
// PBE0
9593
double ex, vupx, vdwx, ec, vupc, vdwc;
9694
XC_Functional::slater_spin(rho, zeta, ex, vupx, vdwx);
97-
ex *= (1.0 - GlobalC::exx_global.info.hybrid_alpha);
98-
vupx *= (1.0 - GlobalC::exx_global.info.hybrid_alpha);
99-
vdwx *= (1.0 - GlobalC::exx_global.info.hybrid_alpha);
95+
ex *= (1.0 - XC_Functional::hybrid_alpha);
96+
vupx *= (1.0 - XC_Functional::hybrid_alpha);
97+
vdwx *= (1.0 - XC_Functional::hybrid_alpha);
10098
XC_Functional::pw_spin(rs, zeta, ec, vupc, vdwc);
10199
e = ex + ec;
102100
vup = vupx + vupc;

0 commit comments

Comments
 (0)