top of page

Tutorial on installing Alamode on a Linux Machine


Introduction ALAMODE is an open source software designed for analyzing lattice anharmonicity and lattice thermal conductivity of solids. By using an external DFT package such as VASP and Quantum ESPRESSO, you can extract harmonic and anharmonic force constants straightforwardly with ALAMODE. Using the calculated anharmonic force constants, you can also estimate lattice thermal conductivity, phonon linewidth, and other anharmonic phonon properties from first principles. Official site: https://alamode.readthedocs.io/en/latest/


Key Features of Alamode General • Extraction of harmonic and anharmonic force constants based on the supercell approach • Applicable to any crystal structures and low-dimensional systems • Accurate treatment of translational and rotational invariance • Interface to VASP, Quantum-ESPRESSO, xTAPP, and LAMMPS codes • Mainly written in C++, parallelized with MPI+OpenMP Harmonic properties Phonon dispersion Phonon DOS, atom-projected phonon DOS Two-phonon DOS Vibrational thermodynamic functions (heat capacity, entropy, free energy) Mean-square displacement Animation and visualization of phonon modes (requires VMD or XCrysDen) 3-phonon scattering phase space Phonon-isotope scattering rate Participation ratio for analyzing the localization of phonon modes Anharmonic properties Grüneisen parameter via cubic force constants Lattice thermal conductivity by BTE-RTA Cumulative thermal conductivity Phonon linewidth due to 3-phonon interactions Phonon frequency shift due to 3- and 4-phonon interactions Temperature-dependent effective potential method Self-consistent phonon (SCPH) calculation Anharmonic vibrational free-energy

Preparations Before Installation Load basic modules (MPI Compier, MKL library):


[xwang99@login02 tools]$ module list
Currently Loaded Modulefiles:
1) conda 2) intel/2016.0.109 3) intel_mpi/2016 4) mkl/2017

Install or link required libraries (if necessary): 1. boost: https://www.boost.org/users/history/version_1_64_0.html


tar xvf boost_1_64_0.tar.bz2
mkdir include
cd /your directory A/include
ln -s /your directory A/boost_1_64_0/boost .
cd ..


tar xvf eigen-3.3.3.tar.bz2
cd /your directory A/include
ln -s /your directory A/eigen-3.3.3/Eigen .
cd ..


tar xvf cmake-3.20.0-rc1-linux-x86_64.tar.gz
set PATH = (/your directory A/cmake-3.20.0-rc1-linux-x86_64/bin:$PATH) # For csh users
#export PATH=/your directory A/cmake-3.20.0-rc1-linux-x86_64/bin:$PATH # For bash users


tar zxvf spglib-1.16.0.tar.gz
cd spglib-1.16.0
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX="" .. # Or /your directory A/cmake-3.20.0-rc1-linux-x86_64/bin/cmake -DCMAKE_INSTALL_PREFIX="" ..
make
make DESTDIR=/your directory A/software install
set SPGLIB_ROOT=/your directory A/software # For csh users
#export SPGLIB_ROOT=/your directory A/software # For bash users

Alamode installation Download the package from https://sourceforge.net/projects/alamode/ There are three software in the package (alm, anphon, tools), let's compile them one by one. 1. Compile alm


tar xvf alamode-1.1.0.tar.gz
cd /your directory A/alamode-1.1.0
# Compile alm
cd /your directory A/alamode-1.1.0/alm
cp Makefile.linux Makefile
[xwang99@login02 alm]$ cat Makefile
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
.SUFFIXES: .h .cpp
#-----------------------------------------------
# Makefile for the program 'ALM'.
# Please modify the variables properly.
# We recommend to use Intel c++ compiler.
#-----------------------------------------------


CXX = icpc # Select suitable compiler, here we just use icpc
CXXFLAGS = -O2 -xHOST -qopenmp -std=c++11
INCLUDE = -I../include -I$(SPGLIB_ROOT)/include # May also use absolute path, such as -I//your directory A/include -I/your directory A/spglib-1.16.0/software/include


CXXL = ${CXX}
LDFLAGS = -mkl -L$(SPGLIB_ROOT)/lib64 -lsymspg # May also use absolute path, LDFLAGS = -mkl -L/your directory A/spglib-1.16.0/software/lib64 -lsymspg


LAPACK = 
LIBS = ${LAPACK}


#-----------------------------------------------
# General rules 
#-----------------------------------------------


.cpp.o:
	${CXX} ${CXXFLAGS} ${INCLUDE} -c $<


PROG = alm


CXXSRC= $(wildcard *.cpp)


OBJS= ${CXXSRC:.cpp=.o}


default: alm


all: ${PROG}


alm: ${OBJS}
	${CXXL} ${LDFLAGS} -o $@ ${OBJS} ${LIBS}


clean:
	rm -f ${OBJS}


.PHONY: clean


depend:
	gcc -MM *.cpp > .depend


-include .depend
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
make -j
[xwang99@login02 alm]$ ls alm
alm

2. Compile anphon


# Compile anphon
cd /your directory A/alamode-1.1.0/anphon
cp Makefile.linux Makefile
[xwang99@login02 alm]$ cat Makefile
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
.SUFFIXES: .h .cpp
#-----------------------------------------------
# Makefile for the program 'ANPHON'.
# Please modify the variables properly.
# We recommend to use Intel c++ compiler.
#-----------------------------------------------


MPICXX = mpicxx #Select suitable compiler
CXXFLAGS = -O3 -xHOST -openmp -std=c++11
INCLUDE = -I../include -I/your directory A/include


LINKER = ${MPICXX}
LDFLAGS = -mkl 


LAPACK = 
LIBS = ${LAPACK}


#----------------------------------------------
# General rules
#----------------------------------------------


.cpp.o:
	${MPICXX} ${CXXFLAGS} ${INCLUDE} -c $<


PROG = anphon


CXXSRC = $(wildcard *.cpp)


OBJS= ${CXXSRC:.cpp=.o}


default: anphon


all: ${PROG}


anphon: ${OBJS}
	${LINKER} ${LDFLAGS} -o $@ ${OBJS} ${LIBS}


clean:
	rm -f ${OBJS}


.PHONY: clean


depend:
	gcc -MM *.cpp > .depend


-include .depend
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
make -j
[xwang99@login02 alm]$ ls alm
anphon

3. Compile tools


# Compile tools
cd /your directory A/alamode-1.1.0/tools
[xwang99@login02 alm]$ cat Makefile
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
.SUFFIXES: .h .cpp
#-----------------------------------------------
# Makefile for 'tools' directory
# Please modify the variables properly.
# We recommend to use Intel c++ compiler.
#-----------------------------------------------


#Intel compiler
#CXX = icpc


# OSX (gcc)
CXX = icpc


# OSX (clang)
#CXX = g++


CXXFLAGS = -O2 -std=c++11


# Add the directory containing boost header files here
INCLUDE = -I../include -I/your directory/include


#----------------------------------------------
# General rules
#----------------------------------------------


.cpp.o:
	${CXX} ${CXXFLAGS} ${INCLUDE} -c $<


PROG = analyze_phonons qe2alm dfc2


CXXSRC = analyze_phonons.cpp qe2alm.cpp dfc2.cpp


OBJS= ${CXXSRC:.cpp=.o}


default: all


all: ${PROG}


analyze_phonons: analyze_phonons.o
	${CXX} ${CXXFLAGS} -o $@ $<


qe2alm: qe2alm.o
	${CXX} ${CXXFLAGS} -o $@ $<


dfc2: dfc2.o
	${CXX} ${CXXFLAGS} -o $@ $<


clean:
	rm -f ${OBJS}


.PHONY: clean


depend:
	gcc -MM *.cpp > .depend


-include .depend
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
make -j
[xwang99@login02 alm]$ ls analyze_phonons qe2alm dfc2
analyze_phonons qe2alm dfc2

The last step is to dynamically link the required library to the alm:


setenv LD_LIBRARY_PATH /your directory A/spglib-1.16.0/software/lib64:$LD_LIBRARY_PATH # For csh
#export LD_LIBRARY_PATH=/your directory A/spglib-1.16.0/software/lib64:$LD_LIBRARY_PATH # For bash
#May need to add this command to ~/.bashrc

Notes Make sure all the key compilers and libraries are correctly installed, and linked. Make sure that all paths in the Makefiles are set correctly. If fftw library is required during the process of compilation, the $(MKLROOT) path should be added to the Makefile:


INCLUDE = -I../include -I/your directory A/include -I$(MKLROOT)/include/fftw

 

If you found this tutorial helpful, consider joining our community by making a donation. Your support will enable me to continue creating valuable content while also supporting my baby's care. Together, we can make a meaningful impact. Thank you!


bottom of page