Download and install

Installation

Container Deployment

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. A mirror is available by docker pull registry.dp.tech/deepmodeling/abacus.

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. Open in Gitpod

Please note that containers target at developing and testing, but not massively parallel computing. Docker has a bad support to MPI; for production, please compile ABACUS from source code to avoid compatibility issues and gain a better performace.

Prerequisites

ABACUS currently supports Linux. Dockerfiles under the root directory of our repo will come in handy.

To compile ABACUS, please make sure that the following prerequisites are present:

GCC version 5.1 or later is required: Intel compilers also use GCC headers and libraries(ref).

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

Installing ELPA by apt only matches requirements on Ubuntu 22.04. For earlier linux distributions, you may install elpa from source.

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. 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.

Please refer to our guide on requirements.

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:

back to top

Build and install ABACUS with CMake

We recommend building ABACUS with cmake to avoid dependency issues. Makefile is deprecated.

Configure

ABACUS requires a minimum cmake version of 3.16, and 3.18 with advanced features like the integration with DeePKS or utilizing GPU. 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_INCLUDE_DIR, 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, e.g.:

cmake -B build -DENABLE_LIBXC=1 -DUSE_CUDA=1

If Libxc is not installed in standard path (i.e. installed with a custom prefix path), you can set Libxc_DIR to the corresponding directory.

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

Build and Install

After configuring, start build and install by:

cmake --build build -j`nproc`
cmake --install build

You can change the number after -j on your need: set to the number of CPU cores(nproc) to gain the best performance.

back to top

Build ABACUS with make

Note: compiling with Makefile is deprecated. We suggest using CMake to configure and compile.

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/.

back to top

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}

back to top

Installation with DeePKS

This part of installation is based on Installation. If DeePKS feature is requied for DeePKS-kit, the following prerequisites and steps are needed:

Extra prerequisites

Extra settings for building

Using Cmake

cmake -B build -DENABLE_DEEPKS=1

Using Makefile

Set LIBTORCH_DIRand LIBNPY_DIRin 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

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}

back to top