Pages

Compiling BoltzTraP 1.2.5 on OSX

Update (21.6.18): I've noticed in using BoltzTraP2 that it has much greater numerical stability than previous versions of BoltzTraP. I must conclude that BoltzTraP2 gives much more reliable results. Reproducing the band structure near band crossings, as I mentioned previously, may be failing due to insufficient k-point sampling in terms of overall density at specific locations in k-space that are required to resolve the bands near a crossing.

Update (19.6.18): I was not unaware of BoltzTraP2, but I was skeptical of the new version at first (and I was determined to get 1.2.5 working again). Turns out, it works rather well and is easy to use without the need to write custom scripts for converting or processing data from an electronic structure code output. It also allows interactive plotting of the entire Fermi Surface which is a fun feature. The transport coefficients calculated are nearly identical to those calculated in version 1.2.5 and the built-in plotting feature facilitates plotting over a range of temperatures.
Fermi surface of silicon as calculated from VASP in BoltzTraP2. 
Another section of the silicon Fermi surface.
Conductivity of silicon as a function of chemical potential at various temperatures as calculated in BoltzTraP2.
Conductivity of silicon as calculated in BoltzTraP 1.2.5. Roughly corresponds to the region between -0.1 and 0.1 Hartrees in the previous plot. The point is just to show that the main features are reproduced with identical orders of magnitude.
The plotting tool is not, however, great for plotting band structures: It does not give the smooth plots that can be made in Python and often gets confused near band crossings. I suspect that this is probably an issue with the plotting function itself and not due to the interpolation, which the BoltzTraP team claimed in their original paper sufficiently approximated the band structure near band crossings for the purpose of calculating the transport coefficients.  

Band structure of silicon from VASP plotted using custom data processing and scripts.
Band structure of silicon plotted by BoltzTraP2 across the same high symmetry points as in the previous plot. Note here, however, that the features are not reproduced with the same resolution nor even with the same accuracy near band crossings. BoltzTraP2 does give a rough idea of the features but clearly it is necessary to do a full band structure calculation with explicit k-point path in VASP rather than interpolate a uniform k-point density DOS calculation as BoltzTraP2 does. 
Follow this tutorial for more information. I tested it using VASP calculations on silicon and had no problems.

Original: I recently had some trouble getting BoltzTraP to compile and play nicely with MacPorts so I am posting the final results. It is the upper section of the Makefile that is most important but I have included the entirety for completion. I used MacPorts' gfortran, lapack (+gfortran), and scalapack (+gfortran). It proved important to not let the compiler or linker find any ATLAS libraries or OSX's Accelerate framework: If you have ATLAS installed through MacPorts, there will be a liblapack.a in /opt/local/lib that belongs to ATLAS. The Makefile below correctly tells the linker to use /opt/local/lib/lapack instead.

# BoltzTraP 1.2.5 Makefile

SHELL = /bin/sh
FC = /opt/local/bin/gfortran
FOPT  = -g -funroll-loops -O3 -ffast-math -fgcse-lm -fgcse-sm -ffast-math \
-ftree-vectorize -fexternal-blas -fleading-underscore -g -p -pg -Wall \ 
-fbounds-check -finit-integer=-666 -finit-real=nan

LDFLAGS = -L/opt/local/lib/lapack -L/opt/local/lib/
LIBS = -lblas -lscalapack -llapack

LINKER = $(FC)
DESTDIR = .
EXECNAME = BoltzTraP

###############################################################################

FFLAGS = $(FGEN) $(FOPT)
EXEC = $(DESTDIR)/$(EXECNAME)

#..............................................................................
#
#  Object files common to both REAL and COMPLEX type subroutines
#
OBJS = gmlib2.o reallocate.o \
     m_bandstructure.o m_input.o m_fermimod.o \
     m_interfaces.o \
     latgen2.o generic_field.o gtfnam.o gen_lattpoints.o \
     BoltzTraP.o crystal_band.o wien_band.o phon_band.o generic_band.o pw_interface.o \
     add_inv.o bandana.o stern1.o kdelta.o fite4.o sortag.o gplbands.o \
     dos.o ifflim.o setfft.o c3fft.o boseintegrals.o fermiintegrals.o bands.o kcomp.o \
     bz.o fermisurface.o setfft2.o write_dx_fs.o write_dx_bz.o write_cube_fs.o \
     dos_histogram.o dos_tetra.o noculc.o dosvv.o readvv.o \
     phonondrag.o
#OBJS = \
#        reallocate.o defs.o modules.o broad.o add_inv.o \
#        c3fft.o gtfnam.o ifflim.o mknam.o read_energy.o \
#        transport.o stern.o kdelta.o gen_lattpoints.o fite4.o setfft.o \
#        starfkt2.o dos.o 

$(EXEC): $(OBJS)
 $(LINKER) $(LFLAGS) -o $(EXEC) $(OBJS) $(LDFLAGS) $(LIBS) $(LFLAGS)


clean:
 rm -f *.o *.mod *.pc *.pcl *~

.SUFFIXES: .F90 .o 
.F90.o:
 $(FC) $(FFLAGS) -c $<