Tagged: VASP

El Capitan for Computational Materials Science in 2016

Every few years, I give my laptop a fresh start and remove all the debris (applications, libraries, updates) that have built up. This time I started with a clean install of Mac OS 10.11 (El Capitan).

  • Basics

The first step is to install the essentials including Dropbox, Evernote, Todoist, Xcode (with xcode-select --install), Slack, Mendeley, MS Office, gcc/gfortranPython superpack, VESTA, Transmission, Mactex, Texmaker, Unrar, VLC, Adobe Creative Suite, iTerm, Textmate, XQuartz.

  • Fortran

While it is possible to survive using gfortan and freely available maths libraries, Intel Fortran and MKL tend to be faster and better tested (easier to compile) in my experience. For non-commericial purposes Intel Composer is now free for OS X. The package installs in a few clicks, but be sure source the variables in your .bash_profile:
source /opt/intel/mkl/bin/mklvars.sh intel64
source /opt/intel/bin/ifortvars.sh intel64

Finally you will need to make the MKL fast fourier transforms (FFTs) for use in most solid-state simulation packages:
cd $MKLROOT/interfaces/fftw3xf/
sudo make libintel64 CC=gcc

The outcome:
Arons-Air-V:~ aron$ which ifort
Arons-Air-V:~ aron$ ifort --version
ifort (IFORT) 16.0.1 20151020

  • Openmpi

To enable parallelism, I downloaded the latest source code of openmpi (1.10.1).
./configure -prefix=/usr/local/openmpi-1.10.1 CC=gcc FC=ifort F77=ifort
sudo make install

be patient… it can easily take 20 minutes. Finally add to your .bash_profile:
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/usr/local/openmpi-1.10.1/lib/
export PATH=./:/usr/local/openmpi-1.10.1/bin:$PATH

The outcome:
Arons-Air-V:~ aron$ which mpif90
Arons-Air-V:~ aron$ mpif90 --version
ifort (IFORT) 16.0.1 20151020

  • Phonopy

We use this open-source lattice-dynamics package a lot in our research. There are a few more libraries to install first:
sudo easy_install pip
pip2 install lxml
pip2 install pyyaml
export CC=/usr/local/bin/gcc

then after expanding the source code, simply type:
python setup.py install

The outcome:
Arons-Air-V:~ aron$ phonopy
_ __ | |__ ___ _ __ ___ _ __ _ _
| '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | |
| |_) | | | | (_) | | | | (_) || |_) | |_| |
| .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, |
|_| |_| |___/

  • Phono3py

If harmonic phonons are not enough for you, then Phono3py lets you calculate phonon-phonon interactions, but it gets very computationally expensive. We need to install hdf5 (for more efficient data management):
pip2 install h5py

and lapacke for faster code. Download the latest version of lapack and:
cp make.inc.example make.inc
make lapackelib

Then you are ready to compile. Download Phono3py and modify setup3.py to link to your compiled lapacke library.
if platform.system() == 'Darwin':
include_dirs += ['/Users/aron/Documents/progs/lapack/lapack-3.6.1/lapacke/include']
extra_link_args = ['/Users/aron/Documents/progs/lapack/lapack-3.6.1/liblapacke.a']
followed by:
python setup3.py install

The outcome:
Arons-Air-V:~ aron$ phono3py
_ _____
_ __ | |__ ___ _ __ ___|___ / _ __ _ _
| '_ \| '_ \ / _ \| '_ \ / _ \ |_ \| '_ \| | | |
| |_) | | | | (_) | | | | (_) |__) | |_) | |_| |
| .__/|_| |_|\___/|_| |_|\___/____/| .__/ \__, |
|_| |_| |___/

  • VASP

While we use a range of electronic structure packages, VASP is the old reliable. I downloaded the latest version (5.4.1), which has streamlined the install process.
cp ./arch/makefile.include.linux_intel ./makefile.include

which needs to be modified to point to the correct compilers (here gcc, ifort and mpifort). We will also remove -DscaLAPACK from the precompiler options and set SCALAPACK = . There are now three patches/bug fixes to install:
patch -p1 < patch.
patch -p1 < patch.
patch -p1 < patch.

and one fix to sort out a gcc error. To the file ./src/lib/getshmem.c add one line at the end of the include statements:
#define SHM_NORESERVE 010000

The outcome:
Arons-Air-V:test aron$ mpirun -np 4 ../vasp_std
running on 4 total cores
distrk: each k-point on 4 cores, 1 groups
distr: one band on 1 cores, 4 groups
using from now: INCAR
vasp.5.4.1 24Jun15 (build Jan 02 2016 21:20:37) complex

  • ASE

The atomistic simulation environment is a useful set of Python tools and modules. It now installs, including the gui, in two lines:
brew install pygtk
pip install python-ase

The outcome:


I will update with more codes and tools as I find time (posted in January; revised in July).

Mountain Lions like OpenMPI

Following the previous post on installing Fortran compilers in OSX 10.8 (Mountain Lions like Fortran), the next step is to efficiently exploit all of those lovely i7 cores for computational chemistry.

1. OpenMPI
– Forget any version that comes with XCode as you need to compile OpenMPI against your new Fortran installation.
– Download the binary from http://www.open-mpi.org/ (current version 1.6.3).
– Unzip and enter directory.
– Run “./configure –prefix=/usr/local/openmpi-1.6.3 CC=gcc FC=ifort F77=ifort”.
– Run “make”.
– Run “sudo make install”.
– Add to your .bashrc or .bash_profile:
export PATH=./:/usr/local/openmpi-1.6.3/bin:~/bin:/opt/intel/bin:$PATH
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/usr/local/openmpi-1.6.3/lib

$ which mpif90

– A popular quantum chemistry package (from here; current version 081912).
– Update the Makefile to include:

FC = ifort
FFLAGS = -O3 -ip
LAPACKBLAS = -L/opt/intel/mkl/lib \
-I/opt/intel/mkl/include -lmkl_intel_lp64 \
-lmkl_sequential -lmkl_core
USE_MPI = yes
MPIFC = mpif90

– Run “make mpi”.
– Enjoy parallel calculations, e.g. mpirun -np 4 fhi-aims

– A popular materials modelling package (from here; current version 5.3.3).
– In the main src folder, “cp makefile.linux_ifc_P4 Makefile”.
– Update the Makefile to include:

FFLAGS = -FR -assume byterecl
OFLAG=-O3 -ip -ftz
BLAS=-L/$(MKL)/lib -I/$(MKL)/include -lmkl_intel_lp64 \
-lmkl_sequential -lmkl_core -lmkl_lapack95_lp64

– Run “make”.
– Enjoy parallel calculations, e.g. mpirun -np 4 vasp

Thread carefully with 2012 PAW potentials for VASP

The main advantage of the VASP code is a reliable set of pseudopotentials covering the entire periodic table. Earlier this year a new set was released with additional potentials optimized for GW calculations. The old potentials remained largely unchanged according to the release document: “In most cases the potentials are literally identical to the previous releases”.

After struggling to understand some peculiar results, I realised that the last statement is not always true. The culprit appears to be related to core charges and corrections, which has changed for quite a few elements even for the LDA/PBE sets.

Using VASP 5.2.12 with identical POSCAR, KPOINT and INCAR files, the following results were obtained for oxygen (triplet state, 500 eV planewave cutoff, PBEsol).

(a) Old POTCAR “PAW_PBE O 08Apr2002”
Atom:   -0.974485 eV
Molecule: -9.048636 eV
Binding: -7.099666 eV

(b) New POTCAR “PAW_PBE O 08Apr2002”
Atom: -1.571040 eV
Molecule: -10.239136 eV
Binding: -7.097056 eV

Clearly the energy shifts introduced can cancel for a balanced reaction, but if you mistakenly combine calculations using both sets (which appear the same in the header!), you will run into problems.

2012 (Part One)

It has been a busy year in terms of university and network activities, but chemistry comes first. The first third of the year has been a mix of code developments, research reviews and new science.

VASP is the most used electronic structure code on the national supercomputer, but it cannot take full advantage of the thousands of available processors. This paper is the result of a collaboration between the HPC Materials Chemistry Consortium  and NAG  to add a new mode of parallelism into the code. It works, and will hopefully be adopted into the mainstream version of VASP soon. The  approach makes hybrid density functional theory calculations less painful to run!

Solar cells work, but to enable widespread adoption of thin-film technologies, new absorber materials need to be developed that are made from earth abundant elements. Copper based compounds are the current hot topic, and this work presents a theoretical understanding of the structure and bonding in two candidate materials that have recently been synthesised in the Department of Chemistry at Bath.

People are excited about CZTS solar cells, and with good reason. While the elements are abundant and low cost, the challenge is in the complex solid-state chemistry associated with a four-component system. This paper reviews our work performed over the past five years exploring the materials chemistry and physics of the kesterite system.

The development of semiconducting metal-organic frameworks is the primary subject of my recently funded European grant. To complement our predominately theoretical research, we are collaborating with the group of Tom Vaid at the University of Alabama. Novel lead and mercury sulfide networks that show some real promise were synthesized and characterised.

It may be increasingly rare and expensive, but indium makes my favourite oxide material. So simple yet so complex. Last year we predicted the surface structure of In2O3 based on my calculations, and this year we managed to get experimental validation by one of the largest LEED studies performed to date.

Apple for science

For my research, Mac offers a nice compromise between the functionality of Windows and the power of Linux.  Chemistry comfort software like Chemdraw, Endnote, Mendeley, MS Office and LaTEX are all available. For scientific computing, there are a few quirks that you need to get around:

(i) Where is .bashrc? It hides in /etc/bashrc. For a splash of colour, add export TERM=xterm-color to your .bash_profile.

(ii) Package managers: no Yum, but Macports and Fink work well.

(iii) How to hide folders from Finder? Away from the command line, some folders really should remain hidden from view. One good example is the ‘Microsoft_User_Data’ folder. Solution: SetFile -a V [folder]

(iv) Free useful applications? Mendeley (references); Vesta (visualisation); Inkscape (vector art); Gimp (bitmap art); Open Babel (structure conversion);  GeoGebra (geometric fun); Texmaker (LaTex GUI).

(v) Free C and Fortran compilers? You would expect to have standard compilers installed by default. Well no, but fortunately the good people at Mac HPC and Mac Research are there to help. First you need to install XCode (from the AppStore, or directly from here), and for the newer versions you need to install the command line tools add-on separately. This sets up a basic gcc compiler. Binaries for the latest versions of gcc/gfortran are available here. Be sure to download both binaries, and remember to add the path to your shell: export PATH=/usr/local/bin:$PATH

(vi) Materials modelling codes (FHI-AIMS, VASP, GULP)? For GULP, an OSX binary is available. Once gfortran is installed, you can download and compile standard Unix distributions of GotoBLAS and LAPACK. For FHI-AIMS, the makefile is straightforward, and the binary runs perfectly:

FC = gfortran -m64
FFLAGS = -O2 -ffree-line-length-none
ARCH = arch_generic.f90
LAPACKBLAS = /progs/lapack-3.2.1/lapack_LINUX.a /progs/GotoBLAS2/libgoto2-r1.13.a

For VASP 5, the following gives a serial binary that works quite well:

FC = gfortran -m64
OFLAG  = -O2
FFLAGS = -ffree-form -ffree-line-length-none
BLAS = /progs/GotoBLAS2/libgoto2-r1.13.a
LAPACK = /progs/lapack-3.2.1/lapack_LINUX.a

In my experience OpenMPI works well, with efficient use of four cores on i7 iMacs, and as expected for the premium price, the Intel fortran compiler (and MKL libraries) result in a significant (~20%) performance boost.  Unfortunately, no non-commercial version of ifort is available for Macs.

Optical properties in VASP

‘NAN’ is my least favorite high frequency dielectric constant. If the optical property subroutine in VASP worked better for magnetic systems, my life would be much easier. Time to move over to WIEN2K? I think so, well at least until VASP 5 comes out (this summer hopefully). Attending a WIEN workshop in June should ease the transition for the time being.