Skip to content

How to install VASP, LAMMPS, Siesta, Quantum Espresso etc. with MPI

shreeja7 edited this page Mar 6, 2022 · 6 revisions

I made this Wiki to list down the steps to install various popular Computational Materials Science codes, mostly DFT and MD in parallel. Since these instructions are taken from my learning notes, all the steps might not work for latest versions. Also, notice how most of my issues were around which compiler the MPI uses and pointing to the correct libraries. However, most steps are generic and should work unless the packages are drastically changed.

I hope it helps anyone who is starting with these packages and facing problems with installation!

Update: March 2022 - Steps for VASPv6.2.1 installation with Intel OneAPI

A small guide to this Wiki:

Pre-requisite installations to set up your system

DFT and related packages:

Molecular Dynamics packages:

Post-processing and Visualization:

Pre-requisite Installations

Install Intel® Parallel Studio XE Cluster Edition for Linux

If you are a student in a university, you can download the latest Intel Parallel Studio for parallel Fortran and C++ compilers, MKL libraries etc for free. These are known to speed up programs a lot.

  1. Register yourself and download the ~4 GB file from https://registrationcenter.intel.com/en/
  2. Unpack it and enter it and then sh install.sh
  3. Follow all directions, give the license number as mentioned in webpage/email you receive after registration and continue.
  4. After it’s done, edit ~/.bashrc file or /etc/bash.bashrc (take a backup first) for all users and write this: export PATH=$PATH:/opt/intel/compilers_and_libraries_2017/linux/bin/intel64:/opt/intel/impi/2017.0.098/intel64/bin (TIP: Always do source ~/.bashrc everytime you make changes to .bashrc, for the changes to be effective in the same old terminal window. bashrc only loads when a new terminal is opened)
  5. Voila! Now you can access all ifort, icc, mpicc, mpiifort, bleh bleh bleh. ^_^

Install OpenMPI with Intel C++ and Fortran compilers

We can continue using the mpi executables that come with the above Intel Parallel Studio, but I faced some issues initially while installing VASP solely with Intel MPI. So I switched over to using OpenMPI based mpi executables "wrapped" around the Intel Fortran and C++ compilers. (Tip: mpiifort is an Intel Fortran based Intel MPI executable that comes prebuilt in the Studio, but mpifort is an OpenMPI compiler that can be wrapped around standard GNU Fortran or Intel compilers, as you wish )

  1. For this to work, we need to install Intel Parallel Studio XE student edition which is free! It contains Intel compilers for C++ and fortran, icc and ifort.
  2. Download OpenMPI latest version from its website: OpenMPI and then do the following:
    1. We will install all OpenMPI based executables in a custom directory so as not to interfere with the built-in mpi executables and libraries in your Ubuntu. So mkdir ~/build/openmpi-2.0.0-INTEL_17.0 (or any directory name of your choice)
    2. Untar the downloaded OpenMPI package, enter and do ./configure CC=icc CXX=icpc F77=ifort FC=ifort prefix=~/build/openmpi-2.0.0-INTEL_17.0
    3. sudo bash
    4. make
    5. make install
    6. ERROR_TIPS: If you get ld: link failed Bad value error, just check if $LD_LIBRARY_PATH points to where the all the Intel lib files are. For ex - here it should be $LD_LIBRARY_PATH = /opt/intel/compilers_and_libraries_2017.1.132/linux/compiler/lib/intel64/:${LD_LIBRARY_PATH}
  3. Finally we have to make the openMPI directories available for your bash. Therefore we include the following statements in the ~/.bashrc:
 source /opt/intel/compilers_and_libraries_2017.0.098/linux/bin/compilervars.sh intel64
 source /opt/intel/compilers_and_libraries_2017.0.098/linux/mpi/intel64/bin/mpivars.sh 
 export INCLUDE=/opt/intel/mkl/include/intel64:/opt/intel/impi/2017.0.098/intel64/include:/opt/intel/compilers_and_libraries_2017.0.098/linux/compiler/include:$INCLUDE 
 export OMPI_F77=ifort 
 export OMPI_FC=ifort 
 export LD_LIBRARY_PATH=~/build/openmpi-2.0.0-INTEL_17.0/lib:$LD_LIBRARY_PATH 
 export MANPATH=$MANPATH:~/build/openmpi-2.0.0-INTEL_17.0/share/man 
 export INFOPATH=$INFOPATH:~/build/openmpi-2.0.0-INTEL_17.0/share/man 
 export I_MPI_CC=icc 
 export I_MPI_CXX=icpc 
 export I_MPI_F77=ifort 
 export I_MPI_F90=ifort 
  1. Also to change the compiler wrappers for mpicc, mpiifort, etc:
    1. Refer to: http://stackoverflow.com/questions/3353119/how-to-force-openmpi-to-use-gcc-instead-of-icc-is-recompiling-openmpi-necessary and https://www.open-mpi.org/faq/?category=mpi-apps#override-wrappers-after-v1.0
    2. Do more /usr/share/openmpi/mpicc-wrapper-data.txt to find out current compiler. Note if compiler=gcc.
    3. To change this we need to do something like: export OMPI_CC=icc and so on. (But this should not be a problem if Steps 1 - 3 work fine.)

TIP: I always try to install any new packages and software in a custom directory in my home directory, named as "build". So, all packages henceforth will be unpacked and made in this "build" directory.


Steps to install VASP

There was a lot of trial and error and learning involved to arrive at the perfect makefile for VASP! Below are the steps I followed along with some important error solving tips. The final makefile for my system is attached in the repo for reference.

  1. Intel compiler suite and OpenMPI should have been installed (Refer to Prerequisite-installations in this document)
  2. Do source /opt/intel/compilers_and_libraries_2017.0.098/linux/bin/compilervars.sh intel64 if not done earlier.
  3. sudo apt-get install build-essential libfftw*
  4. sudo apt-get install liblapack-dev liblapack3 libopenblas-base libopenblas-dev to install/update the system libraries. You should use the BLAS and SCALAPACK libraries that come within the Intel Studio. Search the libmkl libraries in the Intel installation directory (something like /opt/intel/compilers_and_libraries_2017.0.098/linux/mkl/lib/intel64/) and make sure they are there. Otherwise, if you want to use libraries from other source, follow the below steps:
  • Download OpenBLAS from http://www.openblas.net/

    1. Enter folder: make FC=gfortran CC=gcc USE_THREAD=0 TARGET=SANDYBRIDGE (no space before sandybridge, mind you)
    2. Library libopenblas_sandybridge-r0.2.18.a is created in /home/shreeja/build/OpenBLAS-0.2.18
    3. Then you can do make PREFIX=/home/shreeja/build/OpenBLAS-0.2.19 install
  • Download ScaLAPACK from http://www.netlib.org/scalapack/ tarball and install it as follows:

    1. Extract and go inside. Copy SLmake.inc.example to SLmake.inc and make following edits in it:
      1. BLASLIB = -L/home/shreeja/build/OpenBLAS-0.2.19/lib -lopenblas
      2. LAPACKLIB = $(BLASLIB)
      3. Then make
      4. If you get libopenblas (or some library) not found, then you need to install these. Do sudo apt-get install liblapack-dev liblapack3 libopenblas-base libopenblas-dev. Then again make.
  • Don’t know if it’s required Download LAPACK from http://www.netlib.org/lapack/#_lapack_version_3_7_0 and install it as follows:

    1. Extract it and go inside. cp make.inc.example to make.inc
    2. Then do make blaslib
    3. Then make all
    4. ERROR_TIP: If you get error “Makefile:469: recipe for target 'znep.out' failed”, try the following:
      1. ulimit -u unlimited
      2. ulimit -s unlimited
      3. sudo make all
      4. It worked!
  1. Untar VASP directories. Get into ~/build/Vasp_5.3.5/vasp.5.lib and edit the provided makefile.linux_ifc_P4. Change the flags, FC = ifort; FFLAGS = -O1; FREE = -free for Intel compilers
  2. In general, you would like to use a vendor supplied BLAS and LAPACK, so remove the lapack_double.o part from the makefile.
  3. Do make -f makefile.linux_ifc_P4 to build library, libdmy.a.
  4. Check that the environment variables, PATH, LD_LIBRARY_PATH, INCLUDE point towards Intel and OpenMPI libraries. If not do something like export INCLUDE=/opt/intel/mkl/include/intel64:/opt/intel/openmpi-icc/include:/opt/intel/composer_xe_2013.1.117/compiler/include/intel64/:$INCLUDE
  5. After VASP library build, get into /home/shreeja/build/VASP_Lit/Vasp_5.3.5 and make the following edits to makefile.linux_ifc_P4:
    1. Specify MKLROOT=/opt/intel/mkl and do other changes as required like path of impi include files, BLAS library, LAPACK library etc.
    2. make -f makefile.linux_ifc_p4
    3. In case you need to make again do make -f makefile.linux_ifc_p4 clean first and then make
    4. ERROR_TIP: If you get an error like “unrecognized file byterecl lowercase blah blah” for mpif90, then it is due to mpif90 being wrapped over gfortran instead of ifort. To change this, toggle to Intel compilers by - export OMPI_F77=ifort and export OMPI_FC=ifort (Refer to Prerequisite-installations). To check, do mpif90 --version. It should show ifort for subsequent steps to work.
    5. ERROR_TIP: If you get an error like “make: *** No rule to make target '/opt/intel/mkl/interfaces/fftw3xf/libfftw3xf_intel.a’”, go into /opt/intel/mkl/interfaces/fftw3xf and do sudo -E env "PATH=$PATH" make libintel64 compiler=intel or make libintel64 compiler=intel if you don't have sudo permissions. (PS: Don’t know if this is going to work. Fingers crossed) (Later: It works!)

The following steps are some hints to resolve errors during the make if you are writing the makefile from scratch. As a beginner, I started with trying to compile using Intel MPI but couldn't, so switched over to OpenMPI based. Skip these steps if you are using the makefile from the repo here.

  1. ERROR_TIP: If you get an error like “chi_base.F cannot compile: this module file was not generated by any release of this compiler”, it means some conflict with mpi compilation, wrappers blah blah etc. One workaround is to change the mpif90 in your makefile to mpiifort. :D Voila! chi_base.F compiles
  2. ERROR_TIP: If you get error like: “libmkl_blacs_openmpi_lp64.so: undefined reference to `ompi_mpi_comm_null'”, change -lmkl_blacs_openmpi_lp64 to -lmkl_blacs_intelmpi_lp64.
  3. ERROR_TIP: Next, I got a vague error as “recipe for target vasp failed” without telling what the error is. (Later: actually the error was right in front. It was “wannier_interpol.f90:(.text+0x0): multiple definition of `util._' wannier_interpol.o:wannier_interpol.f90:(.text+0x0): first defined here”). The multiple definition error was due to writing the same .o more than once in SOURCE. wannier_interpol.o was written twice. Smh
  4. TIP: Also in the FFLAGS use -shared_intel instead of -i_dynamic for ifort 17.0.0
  5. Do make -f makefile.linux_ifc_p4
  6. ERROR_TIP: OK, so it didn’t work. Tests ran fine, but on running MY program , I get “Fatal error in PMPI_Alltoallv: Other MPI error, error stack:”. I don’t know what it means even after scouring Google for answers. So, I am going to recompile VASP using OpenMPI compiler mpif90 instead of the Intel provided one. Modify PATH to 1st have openMPI/bin path. Changed -lmkl_blacs_intelmpi_lp64 back to -lmkl_blacs_openmpi_lp64. It works!

Install VASP with Wannier

  1. Download Wannier90 from http://www.wannier.org/download.html
  2. Extract and enter.
  3. cp ./config/make.sys.ifort ./make.sys (replace "sys" with "inc" for wannier90-2.1)
  4. Edit ./make.sys to include the following:
   F90 = ifort 
    COMMS=mpi 
MPIF90=mpiifort
LIBDIR=/opt/intel/mkl/lib/intel64 (wherever your Intel mkl libraries are) 
LIBS   =  -L$(LIBDIR) -lmkl_core -lmkl_intel_lp64 -lmkl_sequential -lpthread
  1. Then do make wannier lib test w90vdw w90pov Done!
  2. Go back to the directory where you have installed VASP and modify the winning makefile : Add option -DVASP2WANNIER90 to the line "CPP ="
    Add /home/mslab/build/wannier90-2.0.1/libwannier.a as library destination to the line LIB = -L../vasp.5.lib -ldmy ../vasp.5.lib/linpack_double.o $(LAPACK) $(BLAS)
  3. Recompile VASP. It works! Wannier90 is installed

Install VASP with VTST

  1. Download codes from http://theory.cm.utexas.edu/vtsttools/download.html and extract it in build
  2. Change the main.F file in vasp folder:
	CALL CHAIN_FORCE(T_INFO%NIONS,DYN%POSION,TOTEN,TIFOR, &  
	     TSIF,LATT_CUR%A,LATT_CUR%B,IO%IU6) 
(Argument TSIF is the new addition here)
  1. Copy contents of VTST code to Vasp folder. It will replace chain.F file. Accept the replacement
  2. Then in winning makefile type these before chain.o:
    bfgs.o dynmat.o instanton.o lbfgs.o sd.o cg.o dimer.o bbm.o fire.o lanczos.o neb.o qm.o opt.o
  3. Then do a clean recompiling of vasp (for ex- make distclean and then make -f makefile.linux_ifcP4)
  4. Yay! VTST also good.
  5. But remember to do ulimit -u unlimited and ulimit -s unlimited before running VASP to avoid SISEGV segmentation faults. Oh, and also, I found the golden rule ----- “always use <1 core/atom”!
  6. ^_^

Install VASPv6.2.1 with Intel OneAPI

  1. Make sure Intel OneAPI is installed. It was already installed in my system, so I don't have the instructions how to install it. It is typically found in places like /opt/intel/oneapi/ or /nfs/intel/oneapi
  2. First do source /nfs/intel/oneapi/setvars.sh, so that all Intel binary and library paths are appended to you $PATH and $LD_LIBRARY_PATH. This allows us to run Intel mpi, fortran, c++ executables.
  3. Extract vaspv6.2.1.tar.gz and enter.
  4. Look at the makefiles inside arch directory, and copy makefile.include.linux_intel. cp arch/makefile.include.linux_intel ./makefile.include
  5. Compiling fftw3xf libraries:
    1. Go to /nfs/intel/oneapi/mkl/latest/interfaces/fftw3xf/
    2. Try doing make libintel64
    3. This will work only if you have permission to write in the current directory (.)
    4. If you don't have write permission (like me), create a new directory in your home and do make libintel64 INSTALL_DIR=/home/shreeja/build/fftw3xf_lib_oneapi/
    5. It should now create a libfftw3xf_intel.a in the INSTALL_DIR specified.
  6. Time to edit the makefile.include:
    1. Most things do not need modification. Check out VASP's installation wiki for customization (https://www.vasp.at/wiki/index.php/Installing_VASP.6.X.X)
    2. Check if $(MKLROOT)/lib/intel64 contains lmkl_blacs_intelmpi_lp64.a, libmkl_scalapack_lp64.a. Do ls $MKLROOT/lib/intel64
    3. If you have compiled fftw3xf libraries in a custom directory make sure to include the INSTALL_DIR/libfftw3xf_intel.a in OBJECTS: OBJECTS = fftmpiw.o fftmpi_map.o fft3dlib.o fftw3d.o /home/shreeja/build/fftw3xf_lib_oneapi/libfftw3xf_intel.a
    4. Rest remains same
  7. To install the standard, gamma-point only and non-collinear versions: make DEPS=1 -j12 std, make DEPS=1 -j12 gam, make DEPS=1 -j12 ncl
  8. VASP executables are now created inside /home/shreeja/build/vasp.6.2.1/bin.
  9. ^_^

Steps to install Quantum Espresso (old version)

  1. Download QE version 5.4.0 (espresso-5.4.0.tar.gz) from: https://www.quantum-espresso.org/download
$ sudo apt-get install liblapack-dev fftw-dev build-essential fftw3-dev gfortran
$ cd ~/build/espresso-5.4.0
$ ./configure
$ make all 
  1. (Psst, don’t be lazy and make -j12 all. It doesn’t work).
  2. For additional programs, we do $ make w90, $ make plumed etc as necessary.
  3. Go into PW/examples and run $ ./run_all_examples to test your installation
  4. All the executables are kept in the ~/build/espresso-5.4.0/bin folder.
  5. Done! Use any of the executables for your work. ^_^

Steps to install pwgui

  1. Download self-contained standalone executable for linux .zip file from http://www-k3.ijs.si/kokalj/pwgui/download.html
  2. Extract it.
  3. Done! Pwgui executable can be used directly now. ^_^

Steps to install Siesta:

  1. Download tarball from https://launchpad.net/siesta
  2. Go into siesta-4.1-b2/Obj and do $ sh ../Src/obj_setup.sh
  3. We have to first install lapack, blas and scalapack by doing the following:
  4. Follow steps no. 6 & 7 of “Steps to install VASP” (But Intel compilers already have their own lapack blas etc. So probably skip this step. Umm depends)
  5. Do $ cp intel.make arch.make
  6. Add the following lines in arch.make:
FC = mpifort
FPPFLAGS = -DMPI -DFC_HAVE_FLUSH -DFC_HAVE_ABORT
BLAS_LIBS = -L$(MKLROOT)/lib/intel64/ -lmkl_core -lmkl_intel_lp64 -lmkl_sequential
LAPACK_LIBS = -L$(MKLROOT)/lib/intel64/ -lmkl_lapack95_lp64
BLACS_LIBS = -L$(MKLROOT)/lib/intel64/libmkl_blacs_openmpi_lp64.a
SCALAPACK_LIBS = -L$(MKLROOT)/lib/intel64/libmkl_scalapack_lp64
MPI_LIBS = -L/home/mslab05/build/openmpi-2.0.0-INTEL/lib
LIBS = $(BLAS_LIBS) $(LAPACK_LIBS) $(MPI_LIBS)

Also comment out COMP_LIBS 6. Then do $ make 7. If you get “fdf.F90(502): error #7002: Error in opening the compiled module file” error, add the following lines as well:

MPI_INTERFACE = libmpi_f90.a
MPI_INCLUDE = -I/home/mslab/build/openmpi-3.0.0-intel/include/
  1. Most probably, no make errors will show up. But, it is to give you a sense of false security. Notice that the siesta executable does not work at all on example h2o. :(
  2. Means do a make clean and change the arch.make and try your luck again.
  3. After thousands, no millions of attempts finally got the example h2o.fdf to run in parallel.
  4. If you get error “Intel MKL FATAL ERROR: Cannot load symbol MKLMPI_Get_wrappers.”, put all your Intel mkl libraries within “-Wl,-Bstatic -Wl,--start-group and -Wl,--end-group -Wl,-Bdynamic”
  5. Mention BLAS, BLACS, LAPACK, SCALAPACK library addresses as those from Intel MKL. Take MPI libraries from the local OpenMPI-INTEL installation.
  6. If error is “libmpi.so: undefined reference to MPIR_CommGetAttr_Fort”, it means the mpi compiler used to complie siesta is not the same as the ones specified in the MPI_LIBS values. Here, I had taken mpiifort (Intel MPI) but pointing to openmpi libraries. Change mpiifort to mpifort.
  7. If you get error “intel64/libmkl_intel_thread.a(dlaeh2_par.o): In function mkl_lapack_dlaeh2': dlaeh2_omp_gen.f:(.text+0xa1): undefined reference to __kmpc_global_thread_num'”. Add -liomp5 -lpthread at the end of LIBS in arch.make. Like this, LIBS = -Wl,-Bstatic -Wl,--start-group $(BLAS_LIBS) $(SCALAPACK_LIBS) $(BLACS_LIBS) $(LAPACK_LIBS) -Wl,--end-group -Wl,-Bdynamic $(MPI_LIBS) -qopenmp -liomp5 -lpthread. I think this needs to be done for old intel compilers (v2013) because it works fine without liomp5 and lpthread in the newer versions (2017-2019).
  8. Now, parallel siesta works but encounters a segmentation fault: libpthread-2.23.s 00002B9482D46390 Unknown Unknown Unknown libmpi.so.20.0.0 00002B9481D8E065 MPI_Comm_size. Changed the BLACS_LIBS form intelmpi based to openmpi based. It works now! All of this is mainly due to a conflict between Intel MPI & Open MPI.
  9. Naming the working makefile as: arch.make.basic.WORKS
  10. If you get undefined reference to ‘indxg2p’, means Intel scalapack libraries are iffy. Change the above variables to point to standard libraries:
MPI_INTERFACE = libmpi_f90.a
MPI_INCLUDE = -I/home/mslab/build/openmpi-2.0.0-INTEL_17.0/include/
FPPFLAGS = -DMPI -DFC_HAVE_FLUSH -DFC_HAVE_ABORT
BLAS_LIBS = -L$(MKLROOT)/lib/intel64/ -lmkl_core -lmkl_intel_lp64 -lm -lmkl_intel_thread -lmkl_sequential  
LAPACK_LIBS = -L$(MKLROOT)/lib/intel64/ -lmkl_lapack95_lp64 
BLACS_LIBS = -L$(MKLROOT)/lib/intel64/ -lmkl_blacs_openmpi_lp64 
SCALAPACK_LIBS = -L$(MKLROOT)/lib/intel64/ -lmkl_scalapack_lp64
MPI_LIBS = -L/home/mslab/build/openmpi-2.0.0-INTEL_17.0/lib -lmpi
LIBS = -Wl,-Bstatic -Wl,--start-group $(BLAS_LIBS) $(SCALAPACK_LIBS) $(BLACS_LIBS) $(LAPACK_LIBS) -Wl,--end-group -Wl,-Bdynamic $(MPI_LIBS) -qopenmp
#LIBS =  $(BLAS_LIBS) $(SCALAPACK_LIBS) $(BLACS_LIBS) $(LAPACK_LIBS)  $(MPI_LIBS) -qopenmp

Install parallel tbtrans with netcdf support

  1. Install zlib, HDF5 with parallel I/O and finally NetCDF
  2. Note: Keep in mind the c and fortran compilers used to compile your computer’s mpi compiler. In my case mpicc, mpifort are the openMPI compilers built around Intel C and Fortran compilers (icc and ifort). We have to maintain this consistently throughout all the following makes.
  3. Ok, so this compilation is not easy at all. It differs from instance to instance. I am going to write down a few pointers during installation that one should look out for.
  4. Installation sequence to follow: zlib -> curl -> hdf5 -> NetCDF -> NetCDF Fortran -> tbtrans
  5. Every time you think you messed something up, do this: make uninstall, make distclean. Then recompile. Keep checking config.log for clues to what went wrong.
  6. First set the environment variables to Intel compilers:
export CC=mpicc
export CXX=mpicxx
export CFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
export CXXFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
export F77=mpifort
export FC=mpifort
export F90=mpifort
export FFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
export CPP='icc -E'
export CXXCPP='icpc -E'
CPPFLAGS='-I/home/shreeja/local/include -L/home/shreeja/local/lib'
LDFLAGS=’-L/home/shreeja/local/lib’
  1. Install zlib

    1. Download zlib from https://zlib.net/zlib-1.2.11.tar.gz
    2. Untar using $ tar -xvzf zlib-1.2.3.tar.gz and enter.
    3. Do $ ./configure --prefix=/home/shreeja/local/
    4. $make install
    5. If it gives permission error, try sudo. But it might make programs like apt-get depend on libimf.so (provided by Intel). The workaround is to install zlib in a custom directory like /home/shreeja/local on which you can freely give permissions. -_-
  2. Install curl with zlib:
    1. Download from https://curl.haxx.se/download/curl-7.61.0.tar.gz
    2. Extract and enter
    3. $ ./configure --with-zlib=/home/shreeja/local --prefix=/home/shreeja/local/
    4. $ make
    5. $ make install
    6. Make sure libcurl library is present in /home/shreeja/local/lib after installation
  3. Install HDF5 parallel:

    1. Download hdf5-1.8.13. Untar and enter.
    2. ./configure --enable-parallel --prefix=/home/shreeja/local/ --enable-fortran --disable-shared --enable-cxx --enable-fortran2003 --enable-unsupported --with-zlib=/home/shreeja/local
    3. Then $ make
    4. $ make check
    5. $ make install
    6. Verify by checking libhdf5.settings. It should have Fortran and C compilers. `Parallel HDF5: yes, I/O filters (external): deflate(zlib),
  4. Install NetCDF-C with hdf5 and parallel enabled
    1. Download NetCDF-C v4.6.1. Extract and enter
    2. ./configure --enable-shared --enable-parallel-tests --disable-filter-testing --enable-dap --with-hdf5=/home/shreeja/local --prefix=/home/shreeja/local CPPFLAGS='-I/home/shreeja/local/include -L/home/shreeja/local/lib' LDFLAGS='-L/home/shreeja/local/lib'
    3. If you get configure error: z library not found, check libz.so is present in /home/shreeja/local/lib and make sure -L/home/shreeja/local/lib is passed to the compiler. I just added this line to CPPFLAGS variable because somehow setting LDFLAGS was not working. -_-
    4. Then $ make check
    5. Then $ sudo make install
    6. If your parallel hdf5 is successfully compiled, you should see the following tags on doing $ ./nc-config –all
--has-nc4   -> yes
--has-hdf5  -> yes
--flibs     -> -L/home/shreeja/local/lib -lnetcdff -L/home/shreeja/local/lib -lnetcdf -lnetcdf -lnetcdf
 --has-f90   -> no
 --has-f03   -> yes
  1. There is a catch. The above options might not all appear in the first install. Only after installing netcdf-fortran it appears.
  2. Install NetCDF-Fortran v4.4.4 parallel enabled
    1. Download, extract and enter.
    2. ./configure --prefix=/home/shreeja/local --enable-shared --enable-dap CPPFLAGS='-I/home/shreeja/local/include -L/home/shreeja/local/lib' LDFLAGS='-L/home/shreeja/local/lib'
    3. $ make
    4. $ make install
    5. Check ./nf-config for following flags:
--has-f90   -> no
--has-f03   -> yes
--has-nc2   -> no
--has-nc4   -> yes
  1. Edit arch.make file in siesta/Obj/ and add following lines:
NETCDF_LIBS = -L/usr/local/lib -lnetcdff -lnetcdf -lhdf5_fortran -lhdf5_hl -lhdf5 -lz -lcurl
COMP_LIBS = libncdf.a
LIBS = -Wl,-Bstatic -Wl,--start-group $(BLAS_LIBS) $(SCALAPACK_LIBS) $(BLACS_LIBS) $(LAPACK_LIBS)  -Wl,--end-group -Wl,-Bdynamic $(MPI_LIBS) $(NETCDF_LIBS) $(COMP_LIBS) –qopenmp
NETCDF_ROOT = /home/nayakgroup/local
NETCDF_INCFLAGS = -I$(NETCDF_ROOT)/include
INCFLAGS= $(NETCDF_INCFLAGS)
atom.o: atom.F
	$(FC) -c $(FFLAGS_DEBUG) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_fixed_F) $< 
state_analysis.o: state_analysis.F
	$(FC) -c $(FFLAGS_DEBUG) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_fixed_F) $<

Add .c to list of .SUFFIXES: 14. Get into siesta-4.1-b3/Util/TS/TBtrans and do $ make tbtrans 15. If anything about nc_*** symbol not recognized comes up, means netcdf install is not ok or INCLUDE flags are not set to correct location of netcdf header files. Go back and recompile EVERYTHING. Ughh! 16. Finally done! 17. Save this arch.make in the Obj directory. Saved it as arch.make.FORTBTRANS 18. Serial tbtrans takes 40000 seconds but the parallel version takes only 300 seconds!Yayy!

Steps to install Abinit

  1. Download Abinit from website. Untar it by tar -xvzf abinit-8.10.3.tar.gz
  2. mkdir tmp Enter it and prefix="/data/EXTERNAL/mihir/build/abinit-dir" CC="icc" CXX="cpp" FC="gfortran" enable_mpi="yes" enable_mpi_io="yes" with_mpi_prefix="/data/EXTERNAL/mihir/build/openmpi-3.0.0-intelv17.0" with_linalg_flavor="mkl" with_linalg_incs="-I${MKLROOT}/include" with_linalg_libs="-L${MKLROOT}/lib/intel64 -Wl,--start-group -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -Wl,--end-group -lpthread -lm -ldl"
  3. Check out doc/build/config-examples/ubu_intel_17.0_openmpi.ac for clues

Steps to install Gollum-2

  1. Check if matlab runtime compiler is there. If not, install as instructed in https://in.mathworks.com/help/compiler/install-the-matlab-runtime.html#bvf6bih-4
  2. If MATLAB is installed in your system, check location of MCR runtime. Run matlab in terminal. At prompt type, >>mcrinstaller. It shows the location of MCRInstaller: /usr/local/MATLAB/R2015b/toolbox/compiler/deploy/glnxa64/MCRInstaller.zip. I don’t know if we should install this (maybe it can tamper with existing MATLAB)
  3. So, download MATLAB MCR_R2017a from website. Unzip it. We will install this MCR in the local user account without sudo rights.
  4. Do $ ./install -v -mode silent -agreeToLicense yes -destinationFolder /home/shreeja/
  5. A new directory /home/shreeja/v92 is created. This is the MCR root now.
  6. Gollum executable is a standalone. We can directly run it. Do $ ./run_gollum.sh /home/shreeja/v92
  7. Edit ~/.bashrc to include:
MCR_ROOT=/home/shreeja
XAPPLRESDIR=$MCR_ROOT/v92/X11/app-defaults
  1. But, changing the LD_LIBRARY_PATH variables as mentioned in the README caused symbol lookup errors in certain commands like vim. So, not doing that. In case Gollum does not run, will do: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MCR_ROOT/v92/runtime/glnxa64:$MCR_ROOT/v92/bin/glnxa64:$MCR_ROOT/v92/sys/os/glnxa64:$MCR_ROOT/v92/sys/opengl/lib/glnxa64
  2. Done

Steps to install Phonopy (new attempt)

  1. Refer: https://atztogo.github.io/phonopy/install.html. Best way is to install using conda as explained in the link. Otherwise follow below steps.
  2. $ sudo apt-get install python-matplotlib python-yaml python-dev python-numpy
  3. Download ver 1.10.10 from https://sourceforge.net/projects/phonopy/files/phonopy/phonopy-1.10/
  4. Inside ~/build do $cp ../Downloads/phonopy-1.10.10.tar.gz ./
  5. Then do $ tar xvfz phonopy-1.10.10.tar.gz
  6. Then $ cd phonopy-1.10.10/
  7. Do $ python setup.py install –home=.
  8. Write in ~/.bashrc: export PYTHONPATH=$PYTHONPATH:/home/shreeja/build/phonopy-1.10.10/lib/python
  9. Open a new terminal and type phonopy
  10. Done! Phonopy run! ^_^

Steps to install phonopy (This is from a previous older attempt. Both should work presumably)

  1. Goto from http://atztogo.github.io/phonopy/install.html
  2. Install matplotlib $sudo apt-get install python-matplotlib
  3. Install python-yaml $sudo pip install PyYAML
  4. Actually just do $ sudo apt-get install python-dev python-numpy python-matplotlib python-yaml python-scipy texlive-fonts-recommended
  5. Download phonopy-1.10.8 from https://sourceforge.net/projects/phonopy/files/phonopy/phonopy-1.10/
  6. Run $ python setup.py install –home=.
  7. Add $ export PYTHONPATH=~/build/phonopy-1.10.8/lib/python to ~./bashrc
  8. Sudo copy phonopy to one of the destinations in $PATH: $ sudo cp /home/raj/build/phonopy-1.10.8/bin /usr/local/bin

Steps to install phono3py

  1. Goto http://atztogo.github.io/phono3py/install.html
  2. Install following python modules and libraries by doing $ sudo apt-get install python-numpy python-matplotlib python-yaml python-h5py libgomp1 liblapacke-dev:
    1. numpy
    2. matplotlib
    3. yaml
    4. h5py – error of file not hd5f.h found, do $sudo apt-get install libhdf5-dev
    5. libgomp1
    6. liblapacke-dev
    7. liblapacke
  3. Download from ver 1.10.9 from: https://sourceforge.net/projects/phonopy/files/phonopy/phonopy-1.10/
  4. Inside ~/build do $cp ../Downloads/phono3py-1.10.9.tar.gz ./
  5. Then do $ tar xvfz phono3py-1.10.9.tar.gz
  6. Then $ cd phono3py-1.10.9/
  7. Change setup3.py to reflect where liblapacke libraries and headers are:
#if platform.system() == 'Darwin':
#    include_dirs += ['../lapack-3.5.0/lapacke/include']
#    extra_link_args = ['../lapack-3.5.0/liblapacke.a']

TO

if platform.system() == 'Darwin':
    include_dirs += ['usr/include']
    extra_link_args = ['usr/lib/liblapacke.a']
  1. Then do $ python setup3.py install --home=.
  2. Make sure $PYTHONPATH = /home/raj/build/phonopy-1.10.8/lib/python
  3. Then add export PYTHONPATH=$PYTHONPATH:/home/raj/build/phono3py-1.10.9/lib/python to ~/.bashrc so that phono3py library files are also included
  4. Done! ^_^

Steps to install ShengBTE (probably too old now)

  1. Download ShengBTE and thirdorder.py from http://www.shengbte.org/downloads
  2. Installation instructions in https://bitbucket.org/sousaw/shengbte/src/master/README.md?fileviewer=file-view-default
  3. Download spglib-1.7.4 from https://sourceforge.net/p/spglib/activity/?page=0&limit=100#55bf5f7e5fcbc92aaffd7688
  4. Install lapack by $sudo apt-get install liblapack*
  5. Install spglib by going to spglib-1.7.4 folder:
./configure
sudo make install
  1. Goto ShengBTE folder
  2. $ cp arch.make.example Src/arch.make
  3. Set MKLROOT value by $ export MKLROOT=/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl. Put this line in ~/.bashrc as well.
  4. $ vim arch.make -->
    1. Search for location of libmkl_lapack95_lp64.a etc in your system and set value of MKL as per that. Here just replace 'em64t' by 'intel64_lin'
    2. Search for libsymspg and put that path in $LDFLAGS in arch.make. That is, export LDFLAGS=-L/usr/local/lib -lsymspg export FFLAGS=-fbacktrace -debug -O2 -static export MPIFC=mpifort
  5. export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  6. Because we are going to use only OpenMPI compiler (that is why wrote mpifort instead of mpiifort), make sure all library dependencies of ShengBTE (can be obtained from ldd ShengBTE) are taken from OpenMPI libraries and not Intel libraries. To do this ensure that LD_LIBRARY_PATH starts with the OpenMPI libraries (i.e /usr/local/lib) followed by other libraries.
    1. Note: In case, you have not installed openMPI and are using the MPI that came with the system, then probably mpifort won’t be available. Then we use MPIFC=mpiifort and FFLAGS = -fbacktrace -debug -O2 (i.e. remove the -static_intel option) and run make all.
    2. Arch.make:
	export FFLAGS=-fbacktrace -debug -O2
	export LDFLAGS=-L/usr/local/lib -lsymspg
	export MPIFC=mpiifort
	MKL=$(MKLROOT)/lib/intel64_lin/libmkl_lapack95_lp64.a -Wl,--start-group \
	$(MKLROOT)/lib/intel64_lin/libmkl_intel_lp64.a                          \
	 $(MKLROOT)/lib/intel64_lin/libmkl_sequential.a                         \
	 $(MKLROOT)/lib/intel64_lin/libmkl_core.a -Wl,--end-group -lpthread -lm
	export LAPACK=$(MKL)
	export LIBS=$(LAPACK)
  1. $ make all
  2. Put ShengBTE executable’s path in $PATH.
  3. Test ShengBTE in Test-VASP folder.
  4. Done! ShengBTE executable is created! ^_^

Steps to install thirdorder.py: (probably too old now)

  1. Download from http://www.shengbte.org/downloads and extract thirdorder.py in ~/build
  2. Go inside thirdorder
  3. Edit setup.py file
  4. Mention location of spglib/spglib.h in INCLUDE_DIRS=["/usr/local/include"]
  5. Mention locatin of spglib libraries (libsymspg.*) in LIBRARY_DIRS=["/usr/local/lib"]
  6. $ ./compile.sh
  7. thirdorder_core.so, thirdorder_common.py and thirdorder_vasp.py will have been created.
  8. Copy these to $PATH.
  9. Done! ^_^

Steps to install LAMMPS

On Linux

  1. Download tarball lammps-stable.tar.gz from http://lammps.sandia.gov/download.html
  2. Extract it into ~/build
  3. Go into lammps-30Jul16/src and then do $ make mpi for simple parallel installation.
  4. Executable lmp_mpi is created. Put this in PATH and use it!
  5. Voila! ^_^
  6. New Prob: If your lmp_mpi is nicely compiled but when you try to run parallel programs using “mpirun -np lmp_mpi -in in.test”, you get multiple “LAMMPS (30 Jul 2016) ERROR: Specified processors != physical processors (../comm.cpp:329)”. It means the mpicxx compiler wrapper is different than the lmp_mpi compiler wrapper. Like in this case, mpicxx is from openmpi but lmp_mpi takes libraries from IntelMPI. So, we have to change the MPI Library destination in the mpi makefile. Edit MPI Library destination: MPI_PATH = -L/home/build/openmpi-2.0.0-INTEL_17.0/lib/
  7. Also, Intel MPI wrappers for both mpicxx and lmp_mpi run OK for older Intel versions. In newer versions complex MPI_blah_blah errors are coming. So better switch to openmpi libraries for LAMMPS
  8. ^_^
  9. To install a new package like USER-MISC, do: $ sudo make yes-user-misc
  10. Then redo $sudo make mpi
  11. BUT you run into 1001 problems. If you point MPI_PATH to the openmpi libraries as in step 6, you always get this error during compilation “libmpi.so: undefined reference to __intel_sse2_strdup”. According to intel, this is due to conflicting version of intel compilers (something to do with icc ifort being of different versions. But we are not using ifort in LAMMPS at all!). Also this error starts with a warning: libimf.so not found. So to point to libimf.
  12. Compiler mpicc linkflags can be found from $ mpicc --showme:link (output: -pthread -Wl,-rpath -Wl,/home/mslab/build/openmpi-2.0.1-INTEL_17.0/lib -Wl,--enable-new-dtags -L/home/mslab/build/openmpi-2.0.1-INTEL_17.0/lib -lmpi). Then edit LINKFLAGS = -g -O -pthread -Wl,-rpath -Wl, /opt/intel/compilers_and_libraries_2017.1.132/linux/compiler/lib/intel64/ -Wl,--enable-new-dtags -L/home/mslab/build/openmpi-2.0.1-intel-latest/lib -lmpi
  13. Note that there is a link to intel compiler libraries instead of openmpi libraries to point to libimf.so etc.
  14. Now do $ sudo make clean-mpi and $ sudo make -j12 mpi. No errors!
  15. Your suffering does not end here. No guarantee that the executable runs without errors. So TEST!
  16. If you get this error on running: lmp_mpi: error while loading shared libraries: libmpi.so.20: cannot open shared object file: No such file or directory, add the libmpi.so.20 destination to your LD_LIBRARY_PATH variable in ~/.bashrc. Do $source ~/.bashrc
  17. Saved the working Makefile as ‘Makefile.lmp_mpi.openmpiWithIntelCompilersWORKING’
  18. Update on 15.07.2019: Example makefiles are available in src/MAKE/MACHINES. We can copy one of them and edit accordingly. Or better still, take src/MAKE/Makefile.mpi and do the above edits and then do $make mpi.
  19. TIP: Install these packages for most work (you can check using make pi). $ make yes-MANYBODY yes-misc yes-molecule yes-user-misc yes-kspace yes-user-phonon:
Installed YES: package KSPACE
Installed YES: package MANYBODY
Installed YES: package MISC
Installed YES: package MOLECULE
Installed YES: package USER-MISC
Installed YES: package USER-PHONON

On Windows

  1. First install MPICH2:
  2. Refer http://swash.sourceforge.net/online_doc/swashimp/node9.html
  3. Download ver 1.4.1p1 from http://www.mpich.org/static/downloads/1.4.1p1/
  4. On double-click, it might ask to 1st install .NET framework ver 2.0.50727. So go to website http://download.microsoft.com/download/7/0/3/703455ee-a747-4cc8-bd3e-98a615c3aedb/dotNetFx35setup.exe and download and install it. It will install via Windows Features.
  5. Install it as you usually do. Note the secret passphrase. Here its “behappy”. REMEMEBER to do it for Everyone. Finish.
  6. Add C:/Program Files/MPICH2/bin to PATH environment variable so that the 2 executables, smpd and mpiexec are recognizable.
  7. Then do:
smpd -install
mpiexec -remove
mpiexec -register (Enter the account username and password)
mpiexec -validate (Should come as SUCCESS)
smpd -status (Should come as: smpd running on IIT)
  1. Then refer: http://rpm.lammps.org/windows.html to download and install LAMMPS-64 bit
  2. lmp_mpi executable is created in Program Files/LAMMPS/bin folder.
  3. For parallel execution use > mpiexec -np # lmp_mpi ...
  4. Also you should probably do > set OMP_NUM_THREADS=4 (or any other number I guess)
  5. Done! ^_^
  6. Checkout “Steps to install Cygwin” for a different way.

Steps to install Anaconda and pymatgen

  1. Download Anaconda installer for Linux from: https://www.anaconda.com/download/#linux (it will be a .sh file)
  2. Run it using $ sh Anaconda-000.sh
  3. Answer whatever it asks
  4. Do $source ~/.bashrc to set the conda paths etc
  5. Conda is ready! It installs python3.6 in my case. So, whenever I type python, it shows this version. Cool!
  6. Make sure you are connected to the internet. Then install pymatgen using $ conda install --channel matsci pymatgen. Will take some time

Steps to install Pymatgen (Python Materials Genomics) using python3.5

  1. The default python version in ubuntu is 2.7.x which is not adequate for pymatgen and other complex modules
  2. It is also not advisable at all to change this default python installation. So, we need to create a virtual environment for the python v3.5 and then install whatever we want in that virtual environment
  3. $ sudo pip install virtualenv
  4. $ ls /usr/bin/python*
  5. $ mkdir ~/build/python3.5_virtualenv
  6. Do $ virtualenv -p /usr/bin/python3.5 python3.5_virtualenv to shift the python3.5 to your man-made virtual environment
  7. Then we need to activate this virtual env by doing $ source ~/build/python3.5_virtualenv/bin/activate. This will change the command prompt to “(python3.5_virtualenv) shreeja@shreeja-Precision-Tower-7910:~/build$”
  8. We can then install any module using pip install ...
  9. To deactivate the virtual environment, do $ deactivate.
  10. Refer to this link for more: http://docs.python-guide.org/en/latest/dev/virtualenvs/

OR (if you have installed Anaconda in your system)

  1. Use conda: $ conda create --name my_pymatgen python.
  2. Then activate this new environment $conda activate my_pymatgen
  3. To use pymatgen, work in this environment.

Steps to install Cygwin in Windows (obviously):

  1. Download cygwin and install by following Next>Next>...
  2. Change name of your home directory by doing:
mkdir /home/bob
echo "export HOME=/home/bob" >>.bashrc
echo "export HOME=/home/bob" >>.bash_profile
cp .bashrc .bash_profile /home/bob
echo "cd" >>.bashrc

Steps to install XcrySDen:

On Linux

  1. Download linux x86_64 binary package (not the source package) from http://www.xcrysden.org/Download.html
  2. Extract and get inside xcrysden-1.5.60-bin-shared.
  3. Then do $./xcrysden
  4. Got error: error while loading shared libraries: libtk8.5.so:
  5. Do $sudo apt-get install build-essential gfortran freeglut3-dev tcl8.5-dev tk8.5-dev
  6. It works now!

On Windows using Cygwin

  1. Install Cygwin by running https://www.cygwin.com/setup-x86_64.exe
  2. It will list packages to install according to our need.
  3. For xcrysden, install the following (list also given in README.cygwin of xcrysden distro) in Cygwin by running setup.exe again:
vim
openssh
libgfortran3-6.4.0-5 (for cannot load shared libraries: cyggfortran-3.dll error on doing Step 5)
tcl-tk (tcl-tk-8.5.18-1; only v8.5 not v8.6)
tcl-8.5.18-1
fftw3
libGL1
libGLU1
xorg-server
xinit
xlaunch
xorg-docs
bash 
bc
coreutils
gawk
grep
gzip
ImageMagick
less
more
  1. Download and unzip xcrysden source tar.
  2. Run cygwin. Do $ cd /cygdrive/c/Users/shreeja/Downloads/build/xcrysden-folder/
  3. Then run ./xcrysden. Mostly there will be some error.
  4. If you get error libtcl8.5.dll no such file or directory, means you need to install the package containing this library file.
  5. Search for the missing dll in https://cygwin.com/cgi-bin2/package-grep.cgi
  6. Then install those packages
  7. Run startx to open the X-terminal
  8. Run ./xcrysden in the X-terminal
  9. Hopefully, it works! :D

Install and run Amazon Web Services ParallelCluster on Windows 10

  1. Your Windows should already have python installed in it. Best way is to install Anaconda for Windows. For me, it installs Python 3.7.
  2. Refer to https://docs.aws.amazon.com/parallelcluster/latest/ug/install-virtualenv.html
  3. Open Anaconda prompt. Do > pip install --user --upgrade virtualenv
  4. If virtualenv command is not found when executing, add virtualenv.exe’s location to the environment variable PATH.
  5. Create a virtual environment to run AWS, apc-ve. Do > virtualenv %USERPROFILE%\apc-ve
  6. Activate the new virtualenv. Do > %USERPROFILE%\apc-ve\Scripts\activate
  7. pip install --upgrade aws-parallelcluster
  8. Do > pcluster version to check if its installed.