MacOS Sierra for Computational Materials Science in 2017

An update of previous entries for setting up an Apple computer for scientific computing. It is not an absolute guide, but simply one way to get going.  I started with a clean install of Mac OS 10.12 (Sierra).

  • Awaken UNIX

The first step is to install the command line tools. Open a Terminal and type make which triggers the system to install Xcode (if missing) and the command line tools module (basic UNIX commands including a gcc compiler). Be sure to set up your bash_profile, ssh config, and vimrc files to make working faster and more comfortable.

  • Basics

My essential applications include: (standard office) Dropbox, Slack, MS Office (Imperial link), Mactex, Texmaker, Mendeley; (scientific computing) latest gcc/gfortraniTerm, Textmate, XQuartz, Atom, Cyberduck, GitHub client(materials modelling) VESTA, Avogadro.

  • Python

Python package and environment maintenance can cause headaches, so this time I went with Conda for Mac. I am happy with the results so far, and the standard install gives a good base set of packages.

  • Fortran and C

It is possible to survive using gnu compilers and freely available maths libraries, but Intel Fortran and MKL tend to be faster and better tested (easier to compile). 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/compilervars.sh intel64


The outcome:
% which ifort
/usr/local/bin/ifort
% ifort --version
ifort (IFORT) 17.0.4 20170411

  • Openmpi

To enable parallelism, I downloaded the latest source code of openmpi (2.1.1).
./configure -prefix=/usr/local/openmpi-2.1.1 CC=icc FC=ifort F77=ifort
make
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-2.1.1/lib/
export PATH=./:/usr/local/openmpi-2.1.1/bin:$PATH
export OMP_NUM_THREADS=1

The outcome:
% which mpif90
/usr/local/openmpi-2.1.1/bin/mpif90
% mpif90 --version
ifort (IFORT) 17.0.4 20170411

  • Phonopy

I use this open-source lattice-dynamics package a lot. The installation used to be multi-step, but Conda makes life easier (adapted from Togo’s official guide):
% conda install numpy scipy h5py pyyaml matplotlib openblas
% git clone https://github.com/atztogo/phonopy.git
% export CC=gcc
% cd phonopy
% python setup.py install --user

To run: phonopy

If harmonic phonons are not enough for you, then Phono3py lets you calculate phonon-phonon interactions, but it gets very expensive to compute.
% git clone https://github.com/atztogo/phono3py.git
% cd phono3py
% python setup.py install --user

To run: phono3py

  • VASP

I use a range of electronic structure packages, but VASP is the old reliable. I downloaded the latest version (5.4.4), which has streamlined the install process. Enter the main folder and
cp ./arch/makefile.include.linux_intel ./makefile.include

The file needs to be modified to point to the correct compilers (I used icc, icpc, and mpifort). We will also remove DscaLAPACK from the pre-compiler options and set SCALAPACK =  . There is one bug to fix before you type make: in ./src/lib/getshmem.c add #define SHM_NORESERVE 010000 to the end of the include statements.

The outcome:
% 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.4

  • ASE

The atomistic simulation environment is a useful set of Python tools and modules. It now installs, including the gui, in one command:
pip install --upgrade --user ase

The outcome:
ase-gui

ASE

I will update with more codes and tools as I find time, and always happy to receive suggestions.

Advertisements

Lost in Seoul

(Updated April 2017) I have had the pleasure to visit South Korea quite a few times now. The people, food and culture have left me with many unforgettable experiences. On our last trip, we made even more friends, enjoyed the most delicious grilled eel, and wandered into Changdeokgung palace just in time for a full-scale reenactment of an 18th century royal birthday party (set after a mad prince died of starvation while being confined in a rice barrel).

IMG_1540

This year, I will be back there over the Easter break to teach a course at Yonsei University, which is a good excuse to sort out my random links (and a distraction from learning the basics of Hangul). I am updating these with new discoveries during the trip:

Research Groups
Materials Modelling
Photovoltaics

Travel Guides

http://wikitravel.org/en/Seoul 

Cinema / TV

Transportation / Phone

Vegetarian Friendly Food
https://www.mangoplate.com (general listings and reviews)
Hongdae / Sinchon 
Itaewon
Insadong
Hyehwa

Tea / Coffee
Guides
Hongdae / Sinchon 
Hyehwa
Mapo

Live Shows

Museums
http://leeum.samsungfoundation.org (traditional / modern)
https://www.museum.go.kr (history / art)
http://whankimuseum.org/eng (abstract Korean art)
http://www.mmca.go.kr/eng (modern / contemporary)

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
/usr/local/bin/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
make
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
/usr/local/openmpi-1.10.1/bin/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
_
_ __ | |__ ___ _ __ ___ _ __ _ _
| '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | |
| |_) | | | | (_) | | | | (_) || |_) | |_| |
| .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, |
|_| |_| |___/
1.10.9

  • 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
_ _____
_ __ | |__ ___ _ __ ___|___ / _ __ _ _
| '_ \| '_ \ / _ \| '_ \ / _ \ |_ \| '_ \| | | |
| |_) | | | | (_) | | | | (_) |__) | |_) | |_| |
| .__/|_| |_|\___/|_| |_|\___/____/| .__/ \__, |
|_| |_| |___/
1.10.9

  • 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.5.4.1.08072015
patch -p1 < patch.5.4.1.27082015
patch -p1 < patch.5.4.1.06112015

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:
ase-gui

ASE

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

2015: From quasiparticles to monoamine oxidase B

When I joined the University of Bath in 2011, I was greeted with an empty lab packed full of dusty worn out computers. I was alone for a few months before Lee Burton joined me for his PhD (he’s now at TIT). Soon after, the number of computers and people grew. We expanded like an ideal gas to fill all available space across two offices.

This year the group dynamic was spirited with an almost overwhelming number of interesting projects and results. Some of the highlights were quantifying the internal dynamics of hybrid halide perovskites, to probing phonon-phonon interactions in semiconductors, and exploring linkage isomerism in molecular crystals. It has been really fun to benchmark our simulations against a range of techniques (I am excited about some inelastic X-ray and total scattering measurements coming up next year).

It takes some time to get used to research groups being in a constant state of flux. Chris Hendon graduated this year (he’s now at MIT), while Adam Jackson and Federico Brivio are busy finalizing their theses. Clovis Caetano, who visited us from Brazil for one year, is getting ready to leave, while Suzy, Lucy and Dan are just starting their PhD adventures. There definitely is no routine to get bored by… roll on 2016.

1. ‘Chemical principles underpinning the performance of the metal-organic framework hkust-1’. Chem. Sci. (2015).
2. ‘Role of entropic effects in controlling the polymorphism in formate abx3 metal-organic frameworks’. Chem. Commun. (2015).
3. ‘Polymorph engineering of cumo2 (m = al, ga, sc, y) semiconductors for solar energy applications: from delafossite to wurtzite’. Acta Crystallogr. Sect. B Struct. Sci. Cryst. Eng. Mater. (2015).
4. ‘Photocatalytic carbon dioxide reduction with rhodium-based catalysts in solution and heterogenized within metal–organic frameworks’. ChemSusChem (2015).
5. ‘Band energy control of molybdenum oxide by surface hydration’. Appl. Phys. Lett. (2015).
6. ‘A tunable amorphous p-type ternary oxide system: the highly mismatched alloy of copper tin oxide’. J. Appl. Phys. (2015).
7. ‘Ferroelectric materials for solar energy conversion: photoferroics revisited’. Energy Environ. Sci. (2015).
8. ‘Ionic transport in hybrid lead iodide perovskite solar cells’. Nat. Commun. (2015).
9. ‘Vibrational spectra and lattice thermal conductivity of kesterite-structured cu2znsns4 and cu2znsnse4’. APL Mater. (2015).
10. ‘Electronic and optical properties of single crystal sns2: an earth-abundant disulfide photocatalyst.’ J. Mater. Chem. A (2015).
11. ‘Catalytic amine oxidation under ambient aerobic conditions: mimicry of monoamine oxidase b’. Angew. Chemie Int. Ed. (2015).
12. ‘Solid-state chemistry of glassy antimony oxides’. J. Mater. Chem. C (2015).
13. ‘Variation in surface ionization potentials of pristine and hydrated bivo4’. J. Phys. Chem. Lett. (2015).
14. ‘Lattice dynamics and vibrational spectra of the orthorhombic, tetragonal, and cubic phases of methylammonium lead iodide’. Phys. Rev. B (2015).
15. ‘Magnetoelastic coupling in the cobalt adipate metal-organic framework from quasi-harmonic lattice dynamics’. J. Mater. Chem. C (2015).
16. ‘Self-regulation mechanism for charged point defects in hybrid halide perovskites’. Angew. Chemie Int. Ed. (2015).
17. ‘Electronic excitations in molecular solids: bridging theory and experiment’. Faraday Discuss. (2015).
18. ‘Engineering solar cell absorbers by exploring the band alignment and defect disparity: the case of cu- and ag-based kesterite compounds’. Adv. Funct. Mater. (2015).
19. ‘Polymorph engineering of tio2: demonstrating how absolute reference potentials are determined by local coordination’. Chem. Mater. (2015).
20. ‘Million-fold electrical conductivity enhancement in fe2(debdc) versus mn2(debdc) (e = s, o)’. J. Am. Chem. Soc. (2015).
21. ‘Real-time observation of organic cation reorientation in methylammonium lead iodide perovskites’. J. Phys. Chem. Lett. (2015).
22. ‘Determination of the nitrogen vacancy as a shallow compensating center in gan doped with divalent metals’. Phys. Rev. Lett. (2015).
23. ‘Energetics, thermal isomerisation and photochemistry of the linkage-isomer system [ni(et4dien)(η2-o,on)(η1-no2)]’. CrystEngComm (2015).
24. ‘Assessment of polyanion (bf4- and pf6-) substitutions in hybrid halide perovskites’. J. Mater. Chem. A (2015).
25. ‘The quest for new functionality’. Nat. Chem. (2015).
26. ‘Lattice-mismatched heteroepitaxy of iv-vi thin films on pbte(001): an ab initio study’. Phys. Rev. B (2015).
27. ‘Role of microstructure in the electron–hole interaction of hybrid lead halide perovskites’. Nat. Photonics (2015).
28. ‘Buckeridge et al. reply:’ Phys. Rev. Lett. (2015).
29. ‘Absorbate-induced piezochromism in a porous molecular crystal’. Nano Lett. (2015).
30. ‘Crystal structure optimisation using an auxiliary equation of state’. J. Chem. Phys. (2015).
31. ‘Nanocrystals of cesium lead halide perovskites (cspbx3, x = cl, br, and i): novel optoelectronic materials showing bright emission with wide color gamut’. Nano Lett. (2015).
32. ‘Cation-dependent intrinsic electrical conductivity in isostructural tetrathiafulvalene-based microporous metal-organic frameworks’. J. Am. Chem. Soc. (2015).
33. ‘The cubic perovskite structure of black formamidinium lead iodide, α-[hc(nh2)2]pbi3, at 298 k’. J. Phys. Chem. Lett. (2015).
34. ‘The dynamics of methylammonium ions in hybrid organic-inorganic perovskite solar cells’. Nat. Commun. (2015).
35. ‘Influence of the exchange-correlation functional on the quasi-harmonic lattice dynamics of ii-vi semiconductors’. J. Chem. Phys. (2015).
36. ‘Phase stability and transformations in the halide perovskite cssni3’. Phys. Rev. B (2015).
37. ‘Band alignment of the hybrid halide perovskites ch3nh3pbcl3, ch3nh3pbbr3 and ch3nh3pbi3’. Mater. Horizons (2015).
38. ‘Modular design of spiro-ometad analogues as hole transport materials in solar cells’. Chem. Commun. (2015).
39. ‘Assessment of hybrid organic-inorganic antimony sulfides for earth-abundant photovoltaic applications.’ J. Phys. Chem. Lett. (2015).
40. ‘Principles of chemical bonding and band gap engineering in hybrid organic-inorganic halide perovskites’. J. Phys. Chem. C (2015).

Over 2/3 of our publications are gold open access this year; the rest are green open access in the Bath repository.

My data is your data

Academics in the UK are just coming to terms with an open access policy for publications (from paid ‘gold’ to free ‘green’ university repositories).

What has received significantly less attention is the new UK research data policy. In my experience, raising this issue in conversation is met with blank expressions… what data policy?

Some key points from https://www.epsrc.ac.uk/about/standards/researchdata/. From 1st May 2015:

Published research papers should include a short statement describing how and on what terms any supporting research data may be accessed.

The metadata must be sufficient to allow others to understand what research data exists, why, when and how it was generated, and how to access it.

My university, like most others, has put together policy and guidance documents but they are quite generic and don’t seem to have really filtered down to the researcher level.

In my field of computational materials science, there are now several options:

  • GitHub – my group has been using this a lot for research (DOIs can be generated via the EU-funded project Zenodo; 2GB limit per repository). Instead of building separate repositories for each paper, we have been collecting related information, e.g. Phonons and Crystal Structures.
  • Mendeley Data – a nice clean interface for uploading data and generating DOIs, but I haven’t seen any clear policy for storage limits or guaranteed data lifetimes.
  • Figshare – this repository plays nice with raw datasets and multimedia (e.g. a hybrid perovskite MD video). The serious drawback is a 1GB storage limit (per free account) with a 250 MB file size limit.
  • NoMaD – a new respository to “host, organize and share materials data”. I have great hopes for this one, but at the moment the website is a little jaded, and the interface is light years behind the Materials Project (which serves a different purpose of being a single source database).

Ideally, a standard protocol would be adopted in the community to avoid the individual ‘data dumps’ that university repositories enable in favour of a systematic and searchable community database. Aiida allows one to do this at the research group or collaborator level, but I hope that NoMaD can build a critical mass of researchers (and sustained funding) to make this a reality.

Too early to retire?

The new academic year begins tomorrow, so I took a few days out to hang out in Dublin. It was nice meeting up with old friends and it gave some perspective on the years that have passed. In 2016 it will be a decade since I was awarded my PhD at Trinity College, and it will be the fifth and final year of my fellowship from the Royal Society.

In terms of research, I have a wonderful team producing plenty of interesting results, so my role has changed from coding and performing calculations to: (a) keeping a steady supply of good research projects; (b) maintaining funding and computer resources; (c) reading and editing manuscripts. I still try to keep Wednesdays free for book reading and personal projects. If I could shift the balance, I would prefer to spend more time writing (an activity which most scientists I know dislike, but which I find quite therapeutic).

I have haven’t been writing much here as mentally these tasks have been quite exhausting, so when I have free time I tend to write about movies, play on instagram, and try to learn Hangul. But I do have some good topics for posts in the near future!

아론

Beginner’s guide to hybrid organic-inorganic halide perovskite (MAPI) solar cells

One challenge of working on hybrid halide perovskites is that the field is moving so rapidly. A second is that there are just too many publications. A third is that many of the older papers use different nomenclature so that it can be difficult to discover them. I started a Mendeley group to track papers, and I think we have done a decent job on the older literature (especially in the key work from the 1980s and 90s).  In 2014, there were over 400 publications on CH3NH3PbI3, and there are likely to be over 1000 in 2015 alone, so it is almost impossible to absorb all available information.

MAPI

From a Web of Science search for “hybrid perovskite OR MAPI OR CH3NH3PbI3 solar cell” with 1564 results – 28th May 2015

Here is a suggested reading list to get started:

1. Dynamic disorder in methylammoniumtrihalogenoplumbates (II) observed by millimeter‐wave spectroscopy (Journal of Chemical Physics, 1987) – Weber reported methylammonium lead iodide in 1978, but the interesting characterisation started here, with the first evidence for disorder due to molecular dipoles.

2. Calorimetric and IR spectroscopic studies of phase transitions in methylammonium trihalogenoplumbates (Journal of Physics and Chemistry of Solids, 1990) – The PhD thesis of Noriko Onoda-Yamamuro is a gold-mine of useful information and careful measurements. It began with a report of the heat capacity and IR spectrum.

3. Conducting tin halides with a layered organic-based perovskite structure (Nature, 1994) – David Mitzi kickstarted interest in the optoelectronic properties of organic-inorganic perovskites beginning here and publishing another 30 or so papers in the following decade.

4. Templating and structural engineering in organic–inorganic perovskites (Dalton Transaction, 2001) – Back to David Mitzi for a review on the chemical and structural diversity of this family of compounds.

5. Organometal Halide Perovskites as Visible-Light Sensitizers for Photovoltaic Cells (JACS, 2009) – The first solar cell from Japan, but note the substantial effort that had been put into developing these materials in advance.

6. Efficient Hybrid Solar Cells Based on Meso-Superstructured Organometal Halide Perovskites (Science, 2012) – The first high-efficiency solid-state solar cell from Henry Snaith FRS and the point in time when the world took notice.

7. Atomistic Origins of High-Performance in Hybrid Halide Perovskite Solar Cells (Nano Letters, 2014) – Essentially a think piece, trying to link experimental observations with theory, and the first suggestion that lattice polarisation is important for the photovoltaic action.

8. Compositional engineering of perovskite materials for high-performance solar cells (Nature, 2015) – Things have progressed since 2012 with solar cells made with a variety of materials in a range of architectures. Sang Il Seok’s group hold the record and it is with the complex formulation of meythlammonium/formamidinium – lead – iodide/bromide.

I wouldn’t recommend to start with reading about device hysteresis. While the case is almost closed in my opinion, there is no definitive publication yet (just plenty of data and speculation).