Use the QE(Quantum Espresso) on WSL
After few days of hard work, I finally have successfully downloaded and set the Quantum Espresso on my windows computer using WSL(Windows subsystem for Linux). So this is a record of the setting process.
Set the WSL
Reference: Install WSL | Microsoft Learn. Basically, just type the following code in PowerShell and windows will do the rest things for you.
wsl --install
It’s relatively easy, and there is nothing difficult.
Cooperate with VScode(Optional)
Reference: Get started using VS Code with WSL | Microsoft Learn If you want to use your VScode as the editor when using WSL, you can connect them. The only tricky step is to connect from VScode, sometimes it will encounter some errors. Try connecting from the WSL in this situation, type the following code in the WSL terminal
code .
Download the QE
Reference: User’s Guide for Quantum-ESPRESSO This can be tricky if you are not familiar with Linux like me few days ago. There are two ways to download the QE:
Download from the official website
First, install build dependencies
# Step 1: Install dependencies
sudo apt update
sudo apt install -y \
build-essential \
gfortran \
mpifort \
libfftw3-dev \
libblas-dev \
liblapack-dev \
libscalapack-mpi-dev \
make
Then Type the following code in the WSL terminal
# Step 2: get the package from the official website
wget "official website"
(for example:wget https://www.quantum-espresso.org/rdm-download/488/v7-4-1/7ea7262b594ab757b2c13aaad1214c27/qe-7.4.1-ReleasePack.tar.gz)
Now you have got the package of the QE, then extract the source code by
# step 3: extract the source
tar -xvf 'name of the package'
(for example: qe-7.4.1-ReleasePack.tar.gz)
cd 'The folder name'
(for example: qe-7.4.1-ReleasePack.tar.gz)
Then configure the code
# step 4: configure
./configure
Then build the code
# step 5: make all
make all
Finally, you have completed the installation. You can test the installation by
# Step 6: Test installation
./bin/pw.x -v
These are some mysterious Linux code and you can always ask ChatGPT if you don’t understand them.
Download via git
The procedure is nearly the same.
# Step 1: Install dependencies
sudo apt update
sudo apt install -y \
build-essential \
gfortran \
mpifort \
libfftw3-dev \
libblas-dev \
liblapack-dev \
libscalapack-mpi-dev \
git \
wget \
make
# Step 2: Clone Quantum ESPRESSO source code
git clone https://github.com/QEF/q-e.git
cd q-e
# Optional: Check out a stable release (e.g., 7.2)
git checkout qe-7.2
# Step 3: Configure
./configure
# Step 4: Build all modules (can take several minutes)
make all
# Step 5: Test installation
pw.x -v
Add executables to PATH
Reference: How do I add an executable to my search path? - Ask Ubuntu You can add executables to PATH so you can call these program conveniently by
(Optional) Add executables to PATH
echo 'export PATH="$PWD/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Run some tests
The QE already contains some test suites in the program. You can check Test suite and test farm · Wiki · QEF - Quantum ESPRESSO Foundation / q-e · GitLab. If you cannot run them properly, you can use the examples provided by yyyu200/DFTbook: An introduction to DFT. to try again.