We've built a ready-for-use version of ABACUS with docker here. For a quick start: pull the image, prepare the data, run container. Instructions on using the image can be accessed in Dockerfile.
We also offer a pre-built docker image containing all the requirements for development. Please refer to our Package Page.
The project is ready for VS Code development container. Please refer to Developing inside a Container. Choose Open a Remote Window -> Clone a Repository in Container Volume
in VS Code command palette, and put the git address of ABACUS
when prompted.
We also support gitpod to offer an ready-to-use online development environment.
ABACUS currently supports Linux. Dockerfile
s under the root directory of our repo will come in handy.
To compile ABACUS, please make sure that the following prerequisites are present:
- C++ compiler, supporting C++11. You can use Intel® C++ compiler or GCC.
- MPI compiler. The recommended version are Intel MPI or MPICH.
- Fortran compiler for building
BLAS
,LAPACK
andScaLAPACK
. You can useIntel® Fortran Compiler GFortran. - BLAS. You can use OpenBLAS.
- LAPACK.
- ScaLAPACK.
- FFTW3.
- ELPA >= 2017.
- CEREAL.
These packages can be installed with popular package management system, such as apt
and yum
:
sudo apt update && sudo apt install -y libopenblas-dev liblapack-dev libscalapack-mpi-dev libelpa-dev libfftw3-dev libcereal-dev libxc-dev g++ make cmake bc git
Please double-check the installed version of ELPA!
Alternatively, you can choose Intel® oneAPI toolkit (former Parallel Studio) as toolchain. The Intel® oneAPI Base Toolkit contains Intel® oneAPI Math Kernel Library (aka MKL
), including BLAS
, LAPACK
, ScaLAPACK
and FFTW3
, - this means that no Fortran compiler required anymore. The Intel® oneAPI HPC Toolkit contains Intel® MPI Library, and C++ compiler(including MPI compiler). Please noted that building elpa
with a different MPI library may cause conflict between MPI libraries. Don't forget to set environment variables before you start! cmake
will use Intel MKL if the environment variable MKLROOT
is set.
If you have trouble building requirements, our Dockerfiles in root path offer a reference, or read the section below to use a pre-built container.
And of course, a copy of ABACUS source code is required:
- Clone the whole repo with git:
git clone https://github.com/deepmodeling/abacus-develop.git
- Clone the minimum required part of repo:
git clone https://github.com/deepmodeling/abacus-develop.git --depth=1
- Download the latest source code without git:
wget https://github.com/deepmodeling/abacus-develop/archive/refs/heads/develop.zip
- Get the source code of a stable version here
- If you have connection issues accessing GitHub, please try out our official Gitee repo: replacing 'github.com' with 'gitee.com' works for all the links above. e.g.
git clone https://gitee.com/deepmodeling/abacus-develop.git
We recommend building ABACUS with cmake
to avoid dependency issues. Makefile
is deprecated.
ABACUS requires a minimum cmake
version of 3.18
. Check the version of cmake
on your machine with:
cmake --version
You can specify the bin path of ABACUS binary to install by CMAKE_INSTALL_PREFIX
. If no install prefix is specified, the binary will be installed to /usr/local/bin/abacus
by default.
cmake -B build -DCMAKE_INSTALL_PREFIX=${ABACUS_BIN_PATH}
You can provide path of each dependent package if the package cannot be automatically found by cmake.
Keys LAPACK_DIR
, SCALAPACK_DIR
, ELPA_DIR
, FFTW3_DIR
, CEREAL_INCLUDEDIR
, MPI_CXX_COMPILER
and MKLROOT
are currently available to specify.
For example:
cmake -B build -DFFTW3_ROOT=/opt/fftw3
If environment variable MKLROOT
exists, cmake
will take MKL as a preference, i.e. not using LAPACK
and ScaLAPACK
. To disable MKL, unset environment variable MKLROOT
, or pass -DMKLROOT=OFF
to cmake
.
You can also choose to build with which components.
cmake -B build -DUSE_LIBXC=1 -DUSE_CUDA=1
cmake -B build -DUSE_CUSOLVER_LCAO=1
If Libxc is not installed in standard path (i.e. installed with a custom prefix path), you may add the installation prefix of FindLibxc.cmake
to CMAKE_MODULE_PATH
environment variable, or set Libxc_DIR
to the directory containing the file.
cmake -B build -DLibxc_DIR=~/libxc
To build tests for abacus, define BUILD_TESTING
flag. You can also specify path to local installation of Googletest by setting GTEST_DIR
flags. If not found in local, the configuration process will try to download it automatically.
cmake -B build -DBUILD_TESTING=1
After configuring, start build and install by:
cmake --build build -j9
cmake --install build
-j9
specifies the number of jobs to run simultaneously. You can change the number on your need: set to the number of CPU cores to gain the best performance.
To compile the ABACUS program using legacy make
, first edit the file Makefile.vars
under source
directory:
cd source/
vi Makefile.vars
Specify the location of the compiler and libraries present in your own machine:
CPLUSPLUS =
CPLUSPLUS_MPI =
FORTRAN =
LAPACK_DIR =
FFTW_DIR =
BOOST_DIR =
ELPA_DIR =
CEREAL_DIR =
For example, below is a case where the Intel C++ compiler, Intel MPI are used, along with Intel MKL library. The file Makefile.vars can be set as follows:
CPLUSPLUS = icpc
CPLUSPLUS_MPI = mpiicpc
FORTRAN = ifort
LAPACK_DIR = /opt/intel/.../mkl/lib/intel64/
FFTW_DIR = /opt/fftw-3.3.8/
BOOST_DIR = /opt/boost/1.64.0/
ELPA_DIR = /opt/elpa/2016.05.004/
CEREAL_DIR = /opt/cereal/
Another example is where GCC, GFORTRAN, MPICH and ScaLAPACK are used:
CPLUSPLUS = g++
CPLUSPLUS_MPI = mpicxx
FORTRAN = gfortran
SCALAPACK_DIR = /opt/scalapack/
FFTW3_DIR = /opt/fftw-3.3.8/
BOOST_DIR = /opt/boost/1.64.0/
ELPA_DIR = /opt/elpa/2016.05.004/
CEREAL_DIR = /opt/cereal/
For this option, it is further required to set the parameter LIBS
in Makefile.system
:
LIBS = \
-lgfortran -lm \
-openmp -lpthread \
${SCALAPACK_DIR}/lib/libscalapack.a \
/opt/lapack/lib/liblapack.a \
/opt/blas/lib/libblas.a \
/opt/blacs/lib/libblacs.a \
${FFTW_LIB} \
${ELPA_LIB} \
After modifying the Makefile.vars
file, execute make
to build the program.
make -j
After the compilation finishes without error messages (except perhaps for some warnings), an executable program ABACUS.mpi
will be created in directory bin/
.
The program compiled using the above instructions do not link with LIBXC and use exchange-correlation functionals as written in the ABACUS program. However, for some functionals (such as HSE hybrid functional), LIBXC is required.
To compile ABACUS with LIBXC, modifications should be made in three files:
First of all, in the file Makefile.vars
, apart from the variables above, further provide the location of LIBXC:
LIBXC_DIR =
Then, in the file 'Makefile.system', add "${LIBXC_LIB}" to the LIBS
flag, for example:
LIBS = -lifcore -lm -lpthread ${LAPACK_LIB} ${FFTW_LIB} ${ELPA_LIB} ${LIBXC_LIB}
Finally, in Makefile
, add "-DUSE_LIBXC" to the HONG
flag, for example:
HONG_MPI_SELINV_20210523 = -D__FP ${HONG_FFTW} ${HONG_LAPACK} -D__LCAO -D__MPI -D__OPENMP -D__SELINV -DMETIS -DEXX_DM=3 -DEXX_H_COMM=2 -DTEST_EXX_LCAO=0 -DTEST_EXX_RADIAL=1 -DUSE_CEREAL_SERIALIZATION -D__EXX -DUSE_LIBXC
HONG=${HONG_MPI_SELINV_20210523}
This part of installation is based on Installation. If DeePKS feature is requied for DeePKS-kit, the following prerequisites and steps are needed:
- C++ compiler, supporting C++14. For example, Intel C++ compiler 18
- LibTorch for cpu, with c++11 ABI;
- Libnpy;
cmake -B build -DENABLE_DEEPKS=1
Set LIBTORCH_DIR
and LIBNPY_DIR
in Makefile.vars
. For example:
LIBTORCH_DIR = /opt/libtorch/
LIBNPY_DIR = /opt/libnpy/
In Makefile.system
, add LIBTORCH_LIB
to LIBS
, then set -std=c++14
in OPTS
:
LIBS = -lifcore -lm -lpthread ${LIBTORCH_LIB} ${LAPACK_LIB} ${FFTW_LIB} ${ELPA_LIB} # for DeePKS
#LIBS = -lifcore -lm -lpthread ${LAPACK_LIB} ${FFTW_LIB} ${ELPA_LIB}
OPTS = ${INCLUDES} -Ofast -traceback -std=c++14 -simd -march=native -xHost -m64 -qopenmp -Werror -Wall -pedantic -g
- module_base
- module_cell
- module_grid
- module_md
- module_neighbor
- module_orbital
- obj
- src_external
- src_global
- src_io
- src_ions
- src_lcao
- src_parallel
- src_pdiag
- src_pw
- src_ri
In Makefile
, set the Macro as HONG_DEEPKS
:
#!!!!!!!!!!!!!!!!!!!! CHANE HERE IF YOU LIKE !!!!!!!!!!!!!!
#! change series version or parallel version~~~
#HONG=${HONG_MPI_SELINV_20210523}
#HONG=${HONG_SER_SELINV}
HONG=${HONG_DEEPKS}