3. Installation

3.1. Requirement

Mandatory requirements

  • C++ compiler (Intel compiler is recommended.)
  • LAPACK library
  • MPI library (OpenMPI, MPICH2, IntelMPI, etc.)
  • Boost C++ library
  • FFTW3 library (not necessary when Intel MKL is available)
  • Eigen3 library
  • spglib

No worries! All of these libraries can be installed easily by using conda.

In addition to the above requirements, users have to get and install a first-principles package (such as VASP, QUANTUM-ESPRESSO, OpenMX, or xTAPP) or another force field package (such as LAMMPS) by themselves in order to compute harmonic and anharmonic force constants.

Optional requirements

  • Python (> 2.6), Numpy, and Matplotlib
  • XcrySDen or VMD

We provide some small scripts written in Python for visualizing phonon dispersion relations, phonon DOSs, etc. To use these scripts, one need to install the above Python packages. Additionally, XcrySDen is necessary to visualize the normal mode directions and animate the normal mode. VMD may be more useful to make an animation, but it may be replaced by any other visualization software which supports the XYZ format.

3.3. Install using native environment (optional for experts)

If you are familier with unix OS and you want to use the Intel compiler, please follow the instruction below. Here, the Intel C++ compiler and the Intel MKL, including the FFTW3 wrapper, will be used for the demonstration.

Step 1. Install all required libraries

Boost C++ and Eigen3 libraries (header files only)

(If boost and Eigen3 are already installed in your system, please skip this.)

Some header files of Boost C++ and Eigen3 libraries are necessary to build ALAMODE binaries. Here, we install header files of these libraries in $(HOME)/include. You can skip this part if these libraries are already installed on your system.

To install the Boost C++ library, please download a source file from the webpage and unpack the file. Then, copy the ‘boost’ subdirectory to $(HOME)/include. This can be done as follows:

% cd
% mkdir etc; cd etc
(Download a source file and mv it to ~/etc)
% tar xvf boost_x_yy_z.tar.bz2
% cd ../
% mkdir include; cd include
% ln -s ../etc/boost_x_yy_z/boost .

In this example, we place the boost files in $(HOME)/etc and create a symbolic link to the $(HOME)/boost_x_yy_z/boost in $(HOME)/include. Instead of installing from source, you can install the Boost library with Homebrew on macOS and apt-get or yum command on unix..

In the same way, please install the Eigen3 include files as follows:

% cd
% mkdir etc; cd etc
(Download a source file and mv it to ~/etc)
% tar xvf eigen-eigen-*.tar.bz2 (* is an array of letters and digits)
% cd ../
% cd include
% ln -s ../etc/eigen-eigen-*/Eigen .

If you have followed the instruction, you will see the following results:

% pwd
* /home/tadano/include
% ls -l
* total 0
* lrwxrwxrwx 1 tadano sim00 25 May 17  2017 boost -> ../etc/boost_1_64_0/boost
* lrwxrwxrwx 1 tadano sim00 38 May 17  2017 Eigen -> ../etc/eigen-eigen-67e894c6cd8f/Eigen/

spglib

Please install spglib by following the instruction on the spglib webpage. Here, we assume spglib is installed in $SPGLIB_ROOT.

FFTW

If you use the MKL wrapper of FFT, this step can be skipped. If you want to use the native FFTW library, please follow the instruction on the FFTW webpage.

Step 2. Download source

From Sourceforge:

% (visit https://sourceforge.net/projects/alamode/files/latest/download?source=files to download the latest version source)
% tar xvzf alamode-x.y.z.tar.gz
% cd alamode-x.y.z

From GitHub repository:

% git clone https://github.com/ttadano/alamode.git
% cd alamode
% git checkout develop

The directory structure supposed in this section is shown as below:

$HOME
 ├── alamode
 │   ├── CMakeLists.txt
 │   ├── alm
 │   │   └── CMakeLists.txt
 │   ├── anphon
 │   │   └── CMakeLists.txt
 │   ├── docs
 │   ├── example
 │   ├── external
 │   ├── include
 │   └── tools
 │       └── CMakeLists.txt
 │
 ├── include
 │   ├── boost
 │   └── Eigen

$SPGLIB_ROOT
 ├── include
 └── lib

$FFTW3_ROOT (optional)
 ├── include
 └── lib

Step 3-1. Build by CMake

Building by CMake is recommended as of version 1.2.0 of alamode. To use this approach, you need to install cmake version 3.1 or later.

To build Makefiles with CMake, please issue the following commands:

% cd alamode
% mkdir _build; cd _build
% cmake -DUSE_MKL_FFT=yes -DSPGLIB_ROOT=${SPGLIB_ROOT} \
  -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DCMAKE_CXX_FLAGS="-O2 -xHOST" ..

Note

If cmake cannot find Boost, Eigen3, or FFTW automatically, you need to tell where these libraries are installed by using -DBOOST_INCLUDE, -DEIGEN3_INCLUDE, and -DFFTW3_ROOT options. For example, if the directory structure of Step 2 is used, the cmake option will be:

% cmake -DUSE_MKL_FFT=yes -DSPGLIB_ROOT=${SPGLIB_ROOT} \
  -DBOOST_INCLUDE=${HOME}/include -DEIGEN3_INCLUDE=${HOME}/include \
  -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DCMAKE_CXX_FLAGS="-O2 -xHOST" ..

After the configuration finishes successfully, please issue

% make -j

to build all binaries in alm/, anphon/, and tools/ subdirectories under the current directory (_build). You can specify the binary to build, for example, as

% make alm -j

Note

When using the binaries, it may be necessary to set $LD_LIBRARY_PATH as

% export SPGLIB_ROOT=/path/to/spglib/installdir
% export LD_LIBRARY_PATH=$SPGLIB_ROOT/lib:$LD_LIBRARY_PATH

Step 3-2. Build by Makefile

Instead of using CMake, you can build each binary of ALAMODE by using the Makefile.{linux,osx,..}.

In directories alm/, anphon/, and tools, we provide sample Makefiles for Linux (Intel compiler) and Mac OSX (gcc, clang). Please copy either of them, edit the options appropriately, and issue make command as follows:

% export SPGLIB_ROOT=/path/to/spglib/installdir

% cd alm/
% cp Makefile.linux Makefile
(Edit Makefile here)
% make -j

% cd ../anphon/
% cp Makefile.linux Makefile
(Edit Makefile here)
% make -j

% cd ../tools/
% cp Makefile.linux Makefile
(Edit Makefile here)
% make -j

An example of the Makefiles is shown below:

ALM Makefile.linux
1
2
3
4
5
6
7
8
9
CXX = icpc 
CXXFLAGS = -O2 -xHOST -qopenmp -std=c++11
#CXXFLAGS = -O2 -xHOST -qopenmp -std=c++11 -D_HDF5
INCLUDE = -I../include -I$(HOME)/include -I$(SPGLIB_ROOT)/include
#INCLUDE = -I../include -I$(HOME)/include -I$(SPGLIB_ROOT)/include -I$(HDF5_ROOT)/include

CXXL = ${CXX}
LDFLAGS = -mkl -L$(SPGLIB_ROOT)/lib -lsymspg
#LDFLAGS = -mkl -L$(SPGLIB_ROOT)/lib -lsymspg -L$(HDF5_ROOT)/lib -lhdf5_cpp -lhdf5

The default options are expected to work with modern Intel compilers.

Note

When using the binaries, it may be necessary to set $LD_LIBRARY_PATH as

% export SPGLIB_ROOT=/path/to/spglib/installdir
% export LD_LIBRARY_PATH=$SPGLIB_ROOT/lib:$LD_LIBRARY_PATH