How to install Quantum ESPRESSO on macOS using MateriApps Installer
Last Update:2024/02/17
1. Introduction
This review explains how to install Quantum ESPRESSO on macOS (Sonoma) using Homebrew and the MateriApps Installer.
2. Install Homebrew
Open a terminal and follow the instructions at https://brew.sh to install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/ Homebrew/install/HEAD/install.sh)"
3. Install the compiler, tools, and libraries
Using Homebrew, install GCC, OpenMPI, wget, ScaLapack, and gnuplot:
brew install gcc open-mpi wget scalapack gnuplot
4. Download MateriApps Installer
cd $HOME
git clone https://github.com/wistaria/MateriAppsInstaller.git
A set of scripts will be downloaded to $HOME/MateriAppsInstaller.
5. Setup the MateriApps Installer environment
sh $HOME/MateriAppsInstaller/setup/setup.sh
$HOME/materiapps will be created and the minimum required scripts will be installed.
6. Install gcc-wrapper and Quantum ESPRESSO
Homebrew installs GCC with a name with a version number, e.g. gcc-11. In order to be able to call GCC with a name without a version number, first install gcc-wrapper. Then, install Quantum ESPRESSO
sh $HOME/MateriAppsInstaller/tools/gcc-wrapper/install.sh
sh $HOME/MateriAppsInstaller/tools/gcc-wrapper/link.sh
sh $HOME/MateriAppsInstaller/apps/espresso/install.sh
sh $HOME/MateriAppsInstaller/apps/espresso/link.sh
Quantum ESPRESSO will be installed under $HOME/materiapps.
7. Run Quantum ESPRESSO
First, set the environment variables necessary for execution, such as $PATH, etc. The location of Quantum ESPRESSO is also set in $ESPRESSO_ROOT environment variable:
source $HOME/materiapps/espresso/espressovars.sh
Note: The above operation is required every time you open a terminal. Or, if you put the above line in $HOME/.zshrc, it will be executed automatically when you open the terminal.
As an example, let’s calculate the band diagram for GaAs.
By default, the same number of threads as the number of cores are started, which is very slow for small calculations, so set the environment variable OMP_NUM_THREADS to 1 before running simulations:
cd $HOME
wget https://github.com/cmsi/malive-tutorial/releases/download/tutorial-20210520/qe_GaAs.tgz
tar zxvf qe_GaAs.tgz
cd qe_GaAs
wget https://pseudopotentials.quantum-espresso.org/upf_files/Ga.pbe-dn-kjpaw_psl.1.0.0.UPF
wget https://pseudopotentials.quantum-espresso.org/upf_files/As.pbe-n-kjpaw_psl.1.0.0.UPF
export OMP_NUM_THREADS=1
pw.x < GaAs.scf.in | tee GaAs.scf.out
pw.x < GaAs.nscf.in | tee GaAs.nscf.out
bands.x < GaAs.band.in | tee GaAs.band.out
gnuplot -persistent plot.gp
If the simulation is successful, you will see the same band diagram as in the review article “Draw GaAs band structure using Quantum ESPRESSO”.
Note: Confirmed execution on macOS Sonoma; OMP_NUM_THREADS environment variable setting added (February 17, 2024).