First we need to add the path to the ~/.bashrc file
#---------Abinit path----------------------------------
export ABINITROOT=/home/algerien/abinitio/abinit-7.10.5/bin
export PATH=$PATH:$ABINITROOT
#---------------------------------------------------------
$ source ~/.bashrc
NB: It's better to create a bin directory and copy all the executables and tools inside it
Prerequisites
For Ubuntu
# 1 # compiler
sudo apt install gfortran
# 2 # MPI libraries - choice for Open MPI
sudo apt install libopenmpi-dev
# 3 # math libraries - choice for lapack and blas
sudo apt install liblapack-dev libblas-dev
# 4 # mandatory libraries
sudo apt install libhdf5-dev libnetcdf-dev libnetcdff-dev libpnetcdf-dev libxc-dev
For Opensuse
# 1 # GCC compilers
sudo zypper install gcc gcc-c++ gcc-fortran # 2 # MPI libraries - choice for Open MPI sudo zypper install openmpi openmpi-devel openmpi-libs
# 3 # math libraries - choice for lapack and blas sudo zypper install liblapack3 libblas3 # 4 # mandatory libraries
sudo zypper install hdf5 hdf5-devel libhdf5
sudo zypper install fftw3 fftw3-devel
sudo zypper install netcdf netcdff libnetcdf libnetcdff
sudo zypper install libxc
Compiling ABINIT
Downloading the version abinit.7.10.5
wget https://www.abinit.org/sites/default/files/packages/abinit-9.0.4.tar.gz
tar xzf abinit-7.10.5.tar.gz
cd abinit-7.10.5
Create a working directory:
mkdir build && cd build
To configure, use:
../configure --with-config-file='my_config_file.ac9'
where ‘my_config_file.ac9’ is a configuration file that is discussed in more details in the next section.
Compile with:
make -j4
Install (optional):
make install
The configuration file¶
The configure script accepts variables and flags to customize the configuration. For example
../configure FC=mpifort --with-mpi="yes"
tells ABINIT to configure for a MPI build with the mpifort MPI wrapper. To obtain the documentation for the different variables and flags, use:
../configure --help
Most configuration options are detected automatically by configure.
For example, if with_mpi
is set to ‘yes’, configure will try to use the parallel fortran compiler (mpifort)
and automatically detect the MPI installation with libraries (.so) and header (.h) files.
When you install the Open MPI package via apt, these directories can be printed to terminal
by using dpkg -L 'libopenmpi-dev'
.
When a lot of options must be passed to configure, it is advised to use an external configuration file with the syntax:
../configure --with-config-file='my_config_file.ac9'
An example of configuration file my_config_file.ac9 to build abinit with MPI, lapack and blas and automatic detection for libxc, hdf5, and netcdf:
prefix="$HOME/local"
enable_mpi="no"
enable_mpi_io="no"
#with_mpi_prefix="/usr/bin"
with_trio_flavor="netcdf+fox"
#with_netcdf_incs="-I/usr/include"
#with_netcdf_libs="-L/usr/lib -lnetcdf -lnetcdff"
#with_etsf_io_incs="-I/usr/include"
#with_etsf_io_libs="-L/usr/lib -letsf_io_low_level -letsf_io_utils -letsf_io"
with_fft_flavor="fftw3"
with_fft_incs="-I/usr/include"
with_fft_libs="-L/usr/lib -lfftw3 -lfftw3f"
with_linalg_flavor="atlas"
with_linalg_libs="-L/usr/lib/atlas-base -llapack_atlas -lf77blas -lcblas -latlas -L/usr/lib/atlas-base/atlas -llapack -lblas"
#with_dft_flavor="atompaw+bigdft+libxc+wannier90"
Note that:
-
one uses ‘-‘ when typing a flag but ‘_’ inside the config file, e.g.
--with-mpi="yes"
becomeswith_mpi="yes"
. -
the LINALG_LIBS variable was explicitly set for this linux distrubution. The directory was extracted via
dpkg -L liblapack-dev
anddpkg -L libblas-dev
. -
when fine tuning variables and flags for a particular linux distribution, it is advised to take a look at the template file
~abinit/doc/build/config-template.ac9
. For example, the setting ofLINALG_LIBS
in this template file is given by the line#LINALG_LIBS="-L/usr/local/lib -llapack -lblas"
.
More specialized libraries might be harder to detect.
For example, the following section was added to the config file to detect customized FFT and XML libraries.
These libraries are available via apt (libfftw3-dev
and libxml2-dev
).
The directories for the corresponding library and header files can be found by using dpkg -L [package]
and other flags can be extracted from the ~abinit/doc/build/config-template.ac9
template
# fast fourier settings
with_fft_flavor="fftw3"
FFTW3_CPPFLAGS="-I/usr/include"
FFTW3_FCFLAGS="-I/usr/include"
FFTW3_LIBS="-L/usr/lib/x86_64-linux-gnu -lfftw3 -lfftw3f"
# XML2 library (used by multibinit)
with_libxml2="yes"
LIBXML2_FCFLAGS="-I/usr/lib/x86_64-linux-gnu/"
LIBXML2_LIBS="-L/usr/include/libxml2/libxml/ -lxmlf90"
The output of configuration is:
Summary of important options:
* C compiler : gnu version 6.2
* Fortran compiler: gnu version 6.2
* architecture : unknown unknown (64 bits)
* debugging : basic
* optimizations : standard
* OpenMP enabled : yes (collapse: yes)
* MPI enabled : no
* MPI-IO enabled : no
* GPU enabled : no (flavor: none)
* TRIO flavor = netcdf-fallback+fox-fallback
* TIMER flavor = abinit (libs: ignored)
* LINALG flavor = netlib-fallback (libs: ignored)
* ALGO flavor = none (libs: ignored)
* FFT flavor = fftw3 (libs: user-defined)
* MATH flavor = none (libs: ignored)
* DFT flavor = none
Configuration complete.
You may now type "make" to build ABINIT.
(or, on a SMP machine, "make mj4", or "make multi multi_nprocs=<n>")
Compile
make mj4
After compilation we need to install all the executables in the created bin directory
$ cp /home/algerien/abinitio/abinit-7.10.5/build/src/98_main/abinit $ABINITROOT
Reference: https://docs.abinit.org/INSTALL_Ubuntu/
For more information check the following links:
https://forum.abinit.org/viewtopic.php?f=3&t=2807
https://docs.abinit.org/INSTALL_Ubuntu/
https://docs.abinit.org/installation/
https://pitp.phas.ubc.ca/confs/sherbrooke2018/archives/gonze.pdf
0 Comments