Installing Phonopy on Mac OSX

July 20, 2013

"Phonopy is an open source package of phonon calculations based on the supercell approach." It is a wonderful lattice dynamics package, developed by Prof. Atsushi Togo, which links to a wide variety of electronic structure packages. Since it is only used for pre- and post-processing of phonons, it is light enough to run on your laptop.

There is an official Mac installation guide on the website, but I am not a big fan of MacPorts. Each step is simple, but there are many of them. I had help along the way from Adam Jackson. The basic starting point is having XCode with command-line tools (note in OS 10.9, this requires you to run xcode-select --install after installation).

1. Feed your Python with Scipy Superpack
- A script to install the latest versions of NumPy (linear algebra), SciPy (numerical algorithms), Matplotlib (plotting), iPython (interactive shell for python).
chmod +x install_superpack.sh
./install_superpack.sh

2. Pip your Python
- Two more dependencies (and yet another package manager):
sudo easy_install pip
sudo pip install lxml
sudo pip install pyyaml

3. C hack
- Depending on your version of XCode, the default C compiler might be Clang (which fails for Phonopy with "'omp.h' file not found"). Change it back to gcc by using export CC=gcc.

4. Nearly there...
- You can now download Phonopy. Enter the main directory and run
python setup.py install --home=.
and you will need to add its path to .bash_profile:
export PYTHONPATH=/Volumes/Unix/progs/phonopy/phonopy-1.7.1/lib/python

5. Happy phonons
Once the phonopy bin is in your path, simply type phonopy

aron$ phonopy</p>

_ __ | |__   ___  _ __   ___   _ __  _   _
| '_ \| '_ \ / _ \| '_ \ / _ \ | '_ \| | | |
| |_) | | | | (_) | | | | (_) || |_) | |_| |
| .__/|_| |_|\___/|_| |_|\___(_) .__/ \__, |
|_|                            |_|    |___/

1.7.1</code>