Skip to content

Latest commit

 

History

History
316 lines (232 loc) · 10.2 KB

File metadata and controls

316 lines (232 loc) · 10.2 KB

Download and install

Structure of the package

Under the ABACUS directory, there are the following subdirectories:

  • cmake/ which contains relevant files for compiling the code with cmake
  • documents/ which contains a copy of the manual in pdf format
  • examples/ which contains some examples
  • source/ which contains the source code and makefiles
  • tests/ which contains test examples
  • tools/ which currently contains the script for generating the numerical atomic orbitals

back to top

Structure of source code

The source directory further contains the following folders, where the source files of ABACUS are located:

  • module_base
  • module_cell
  • module_grid
  • module_grid
  • module_neighbor
  • module_orbital
  • obj
  • src_external
  • src_global
  • src_io
  • src_ions
  • src_lcao
  • src_parallel
  • src_pdiag
  • src_pw
  • src_ri

Installation

Prerequisites

In order to compile ABACUS, users should make sure that the following prerequisites are present:

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), replacing FFTW3, LAPACK, and ScaLAPACK. 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.

If you use Intel toolchain, don't forget to set environment variables before you start! cmake will use Intel MKL if the environment variable MKLROOT is set.

back to top

Container Deployment

We offer a pre-built docker image containing all the requirements - you only need to clone and compile abacus in the container. 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

Build and install ABACUS with CMake

Configure

We recommend building ABACUS with cmake to avoid dependency issues. 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

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.

cmake -B build -DBUILD_TESTING=1

Build and Install

After configuring, start build and install by:

cmake --build build -j9
cmake --install build

back to top

Build ABACUS with make

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

Link LIBXC

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

  • C++ compiler, supporting C++14. For example, Intel C++ compiler 18
  • LibTorch for cpu, with c++11 ABI;
  • Libnpy;

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
  • 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}

back to top