<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Quantum ESPRESSO Hands-on Tutorial (Graphene) | Suecreamm</title><link>https://suecreamm.github.io/docs/qe/</link><atom:link href="https://suecreamm.github.io/docs/qe/index.xml" rel="self" type="application/rss+xml"/><description>Quantum ESPRESSO Hands-on Tutorial (Graphene)</description><generator>Hugo Blox Builder (https://hugoblox.com)</generator><language>en-us</language><lastBuildDate>Tue, 08 Apr 2025 00:00:00 +0000</lastBuildDate><image><url>https://suecreamm.github.io/media/logo.svg</url><title>Quantum ESPRESSO Hands-on Tutorial (Graphene)</title><link>https://suecreamm.github.io/docs/qe/</link></image><item><title>Building Quantum ESPRESSO and Submitting Jobs</title><link>https://suecreamm.github.io/docs/qe/env/qe-install/</link><pubDate>Fri, 11 Apr 2025 00:00:00 +0000</pubDate><guid>https://suecreamm.github.io/docs/qe/env/qe-install/</guid><description>&lt;hr>
&lt;p>Below is a brief overview of the basic steps required to install Quantum ESPRESSO (QE) and run calculations on a computing cluster.&lt;/p>
&lt;div class="hb-steps">
&lt;h3 id="download-the-source-code">Download the source code&lt;/h3>
&lt;p>Download the desired version of the QE source code from the official Quantum ESPRESSO website (&lt;a href="https://www.quantum-espresso.org" target="_blank" rel="noopener">quantum-espresso.org&lt;/a>) or its GitHub repository. You can also download it directly using commands such as &lt;code>wget&lt;/code> or &lt;code>git&lt;/code>.&lt;/p>
&lt;h3 id="build-qe">Build QE&lt;/h3>
&lt;p>Move to the downloaded source directory and run the following commands to configure and compile QE. Depending on your system, you may need to specify compilers, library paths, or optimization options during the &lt;code>./configure&lt;/code> step.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">./configure
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">make all
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="submit-a-calculation-to-a-cluster">Submit a calculation to a cluster&lt;/h3>
&lt;p>First prepare a QE input file (&lt;code>.in&lt;/code>), then submit the calculation through the job scheduler used by your cluster, such as SLURM or PBS.&lt;/p>
&lt;p>For example, on a SLURM system, a job can be submitted using:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">sbatch job_script.sh
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The job script typically contains an MPI command such as:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">mpirun -np &lt;span class="m">16&lt;/span> pw.x -in input.in &amp;gt; output.out
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/div>
&lt;hr>
&lt;h3 id="1-downloading-and-building-quantum-espresso">1. Downloading and Building Quantum ESPRESSO&lt;/h3>
&lt;p>First, download the latest or desired version of QE from the official &lt;a href="https://www.quantum-espresso.org" target="_blank" rel="noopener">Quantum ESPRESSO website&lt;/a> or its GitHub repository.&lt;/p>
&lt;p>In this tutorial, I assume that all work starts from the &lt;code>/home/hwang/&lt;/code> directory.&lt;/p>
&lt;p>On Linux systems, a &lt;strong>home directory&lt;/strong> is the personal working directory assigned to each user. It usually follows the form &lt;code>/home/username&lt;/code>. Since the username used in this example is &lt;code>hwang&lt;/code>, &lt;code>/home/hwang/&lt;/code> will be used as the home directory throughout this tutorial.&lt;/p>
&lt;h4 id="11-check-the-current-directory-pwd">1.1 Check the current directory (&lt;code>pwd&lt;/code>)&lt;/h4>
&lt;p>After logging into a cluster, you will usually start in your home directory. For this tutorial, I will assume that the directory is initially empty.&lt;/p>
&lt;p>You can check your current location using:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">pwd&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Since this tutorial is also intended for users who are relatively new to Linux:&lt;/p>
&lt;ul>
&lt;li>&lt;code>pwd&lt;/code> (&lt;strong>print working directory&lt;/strong>) displays the full path of your current directory.&lt;/li>
&lt;/ul>
&lt;p>Expected output:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">/home/hwang
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h4 id="12-download-the-source-code-wget-or-git">1.2 Download the source code (&lt;code>wget&lt;/code> or &lt;code>git&lt;/code>)&lt;/h4>
&lt;p>If your current directory is &lt;code>/home/hwang&lt;/code>, you can download QE using either &lt;code>wget&lt;/code> or &lt;code>git&lt;/code>.&lt;/p>
&lt;p>This tutorial uses the QE 7.4.1 source archive downloaded with &lt;code>wget&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">wget https://gitlab.com/QEF/q-e/-/archive/qe-7.4.1/q-e-qe-7.4.1.tar.gz
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ls
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Expected output:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">q-e-qe-7.4.1.tar.gz
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Alternatively, you can clone the GitHub repository:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">git clone https://github.com/QEF/q-e.git
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ls
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Expected output:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">q-e
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Some useful Linux commands:&lt;/p>
&lt;ul>
&lt;li>&lt;code>wget&lt;/code>: Downloads files from the internet.&lt;/li>
&lt;li>&lt;code>git clone&lt;/code>: Creates a local copy of a Git repository.&lt;/li>
&lt;li>&lt;code>ls&lt;/code> (&lt;strong>list&lt;/strong>): Displays files and directories in the current directory. It is similar to &lt;code>dir&lt;/code> on Windows.&lt;/li>
&lt;/ul>
&lt;h4 id="13-extract-the-archive-and-enter-the-directory">1.3 Extract the archive and enter the directory&lt;/h4>
&lt;p>The downloaded file is a &lt;code>.tar.gz&lt;/code> archive, so it must first be extracted:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">tar -xvf q-e-qe-7.4.1.tar.gz
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;ul>
&lt;li>
&lt;p>&lt;code>tar -xvf&lt;/code>: Extracts the archive.&lt;/p>
&lt;ul>
&lt;li>&lt;code>x&lt;/code>: extract&lt;/li>
&lt;li>&lt;code>v&lt;/code>: verbose&lt;/li>
&lt;li>&lt;code>f&lt;/code>: file&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;p>After extraction, move into the newly created directory:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> q-e-qe-7.4.1
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;ul>
&lt;li>&lt;code>cd&lt;/code> (&lt;strong>change directory&lt;/strong>) moves into another directory.&lt;/li>
&lt;/ul>
&lt;p>The command itself does not print anything, but your current directory should now be:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">/home/hwang/q-e-qe-7.4.1
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h4 id="14-configure-and-build-qe-configure-and-make">1.4 Configure and build QE (&lt;code>./configure&lt;/code> and &lt;code>make&lt;/code>)&lt;/h4>
&lt;h5 id="standard-desktop-environment">&lt;em>&lt;strong>Standard desktop environment&lt;/strong>&lt;/em>&lt;/h5>
&lt;p>Before compiling QE, the build system must first be configured for your machine.&lt;/p>
&lt;p>For a standard Linux or WSL environment where you are not specifically configuring parallel computing libraries, you can usually start with:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">./configure
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;ul>
&lt;li>&lt;code>./configure&lt;/code>: Detects the available compilers and libraries and prepares the build configuration.&lt;/li>
&lt;/ul>
&lt;p>Additional options can be specified when necessary, for example to configure MPI support or external libraries.&lt;/p>
&lt;h5 id="systems-with-parallel-computing-libraries-such-as-intel-mkl">&lt;em>&lt;strong>Systems with parallel computing libraries, such as Intel MKL&lt;/strong>&lt;/em>&lt;/h5>
&lt;p>One of the reasons I originally wrote this note was to keep a record of the configuration options I used for an Intel-based HPC environment.&lt;/p>
&lt;p>An example configuration is:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">./configure &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> &lt;span class="nv">MPIF90&lt;/span>&lt;span class="o">=&lt;/span>mpiifort &lt;span class="nv">F90&lt;/span>&lt;span class="o">=&lt;/span>ifort &lt;span class="nv">CC&lt;/span>&lt;span class="o">=&lt;/span>icc &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --prefix&lt;span class="o">=&lt;/span>/usr/local &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --with-scalapack&lt;span class="o">=&lt;/span>&lt;span class="s1">&amp;#39;-lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64&amp;#39;&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --with-blas&lt;span class="o">=&lt;/span>&lt;span class="s1">&amp;#39;-lmkl_intel_lp64 -lmkl_sequential -lmkl_core&amp;#39;&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --enable-openmp
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The exact configuration depends on the compilers, MPI implementation, and mathematical libraries available on your system. If you are using a university or institutional cluster, it is usually best to check its documentation or available environment modules first.&lt;/p>
&lt;details class="spoiler " id="spoiler-1">
&lt;summary class="cursor-pointer">What do Intel MKL and HPC have to do with DFT calculations?&lt;/summary>
&lt;div class="rounded-lg bg-neutral-50 dark:bg-neutral-800 p-2">
&lt;p>Density functional theory (DFT) codes such as VASP and Quantum ESPRESSO perform electronic-structure calculations that involve computationally expensive operations, including large matrix operations, diagonalization, and fast Fourier transforms (FFTs).&lt;/p>
&lt;ul>
&lt;li>
&lt;p>&lt;strong>Intel MKL:&lt;/strong> Intel Math Kernel Library provides optimized implementations of numerical libraries such as BLAS, LAPACK, and FFT routines. These libraries can significantly improve the performance of operations that frequently appear in DFT calculations.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>HPC:&lt;/strong> DFT calculations can become computationally demanding as the number of atoms, k-points, bands, or other numerical parameters increases. High-performance computing (HPC) clusters allow calculations to be distributed across many CPU cores or multiple nodes using parallelization frameworks such as MPI and OpenMP.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Why are they useful?&lt;/strong> Optimized numerical libraries improve the performance of mathematical operations, while HPC resources make it possible to distribute larger workloads across multiple processors. Together, they can substantially reduce the time required for large electronic-structure calculations.&lt;/p>
&lt;/li>
&lt;/ul>
&lt;p>HPC is also widely used outside electronic-structure calculations, including weather forecasting, fluid dynamics, molecular simulations, and machine learning.&lt;/p>
&lt;/div>
&lt;/details>
&lt;h4 id="15-verify-the-build">1.5 Verify the build&lt;/h4>
&lt;p>If all required dependencies are available and the configuration succeeds without errors, the &lt;code>./configure&lt;/code> step should generate a &lt;code>make.inc&lt;/code> file.&lt;/p>
&lt;p>Next, compile QE using:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">make all
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>If the build completes successfully, check whether a &lt;em>&lt;strong>&lt;code>bin/&lt;/code>&lt;/strong>&lt;/em> directory has been created inside the QE directory.&lt;/p>
&lt;p>It should contain executables such as:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">pw.x
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ph.x
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">pp.x
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">...
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Among these, &lt;code>pw.x&lt;/code> is one of the main executables used for Quantum ESPRESSO calculations.&lt;/p>
&lt;p>Once the required executables have been successfully built, QE is ready to run calculations.&lt;/p>
&lt;hr>
&lt;h3 id="2-preparing-and-submitting-a-calculation">2. Preparing and Submitting a Calculation&lt;/h3>
&lt;p>To perform an actual QE calculation on a cluster, you need two main things:&lt;/p>
&lt;ol>
&lt;li>A QE input file&lt;/li>
&lt;li>A job script for the cluster scheduler&lt;/li>
&lt;/ol>
&lt;h4 id="21-prepare-an-input-file">2.1 Prepare an input file&lt;/h4>
&lt;p>QE includes example and benchmark input files in its &lt;code>test-suite&lt;/code> directory.&lt;/p>
&lt;p>For this example, I will use:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">/home/hwang/q-e-qe-7.4.1/test-suite/benchmarks/pw/ausurf.in
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>You can also use another appropriate input file from the &lt;code>test-suite&lt;/code> directory.&lt;/p>
&lt;p>First, create a directory for the calculation if necessary:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">mkdir qe-test
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> qe-test
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Then copy the example input file into the current directory:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">cp /home/hwang/q-e-qe-7.4.1/test-suite/benchmarks/pw/ausurf.in .
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;ul>
&lt;li>&lt;code>cp&lt;/code> (&lt;strong>copy&lt;/strong>) copies a file.&lt;/li>
&lt;li>&lt;code>.&lt;/code> represents the current directory.&lt;/li>
&lt;/ul>
&lt;p>A QE &lt;code>.in&lt;/code> file contains the information required to define the physical system and the type of calculation you want to perform.&lt;/p>
&lt;p>In other words, this is where you specify the problem that QE will solve.&lt;/p>
&lt;h4 id="22-create-a-job-script">2.2 Create a job script&lt;/h4>
&lt;p>Calculations on HPC clusters are generally submitted through a job scheduler.&lt;/p>
&lt;p>Common schedulers include:&lt;/p>
&lt;ul>
&lt;li>SLURM&lt;/li>
&lt;li>PBS&lt;/li>
&lt;li>LSF&lt;/li>
&lt;/ul>
&lt;p>The exact job script depends on the cluster you are using. If your university or institution provides a computing cluster, follow its documentation for resource allocation, modules, and MPI commands.&lt;/p>
&lt;p>Here, I will use SLURM as an example.&lt;/p>
&lt;p>Create a file called &lt;code>job_script.sh&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">vi job_script.sh
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Then add something similar to the following:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="cp">#!/bin/bash
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="cp">&lt;/span>&lt;span class="c1">#SBATCH --job-name=qe_ausurf&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1">#SBATCH --nodes=1&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1">#SBATCH --ntasks-per-node=16&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1">#SBATCH --time=01:00:00&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">module load mpi
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">mpirun -np &lt;span class="m">16&lt;/span> /home/hwang/q-e-qe-7.4.1/bin/pw.x -in ausurf.in &amp;gt; ausurf.out
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>A few important lines are:&lt;/p>
&lt;ul>
&lt;li>&lt;code>#!/bin/bash&lt;/code>: Specifies that the script should be executed using the Bash shell.&lt;/li>
&lt;li>&lt;code>#SBATCH --nodes=1&lt;/code>: Requests one compute node.&lt;/li>
&lt;li>&lt;code>#SBATCH --ntasks-per-node=16&lt;/code>: Requests 16 tasks on that node.&lt;/li>
&lt;li>&lt;code>#SBATCH --time=01:00:00&lt;/code>: Sets a maximum runtime of one hour.&lt;/li>
&lt;/ul>
&lt;p>The main execution command is:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">mpirun -np &lt;span class="m">16&lt;/span> /home/hwang/q-e-qe-7.4.1/bin/pw.x -in ausurf.in &amp;gt; ausurf.out
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>This runs &lt;code>pw.x&lt;/code> using 16 MPI processes, reads the calculation settings from &lt;code>ausurf.in&lt;/code>, and writes the output to &lt;code>ausurf.out&lt;/code>.&lt;/p>
&lt;p>The path&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">/home/hwang/q-e-qe-7.4.1/bin/pw.x
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>points to the &lt;code>pw.x&lt;/code> executable generated when QE was compiled.&lt;/p>
&lt;blockquote>
&lt;p>The correct MPI command and module configuration depend on the cluster. Some systems use &lt;code>srun&lt;/code> instead of &lt;code>mpirun&lt;/code>, so always check the documentation for your HPC environment.&lt;/p>
&lt;/blockquote>
&lt;h4 id="23-submit-the-job">2.3 Submit the job&lt;/h4>
&lt;p>Submit the job script to SLURM using:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">sbatch job_script.sh
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Once submitted, the scheduler will allocate the requested resources and start the calculation when those resources become available.&lt;/p>
&lt;p>You can check your current jobs using:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">squeue -u &lt;span class="nv">$USER&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;ul>
&lt;li>&lt;code>sbatch&lt;/code>: Submits a job script to SLURM.&lt;/li>
&lt;li>&lt;code>squeue -u $USER&lt;/code>: Displays jobs submitted by the current user.&lt;/li>
&lt;li>&lt;code>$USER&lt;/code>: Automatically expands to your current username.&lt;/li>
&lt;/ul>
&lt;p>When the calculation finishes, the QE output should be stored in:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">ausurf.out
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h4 id="24-check-the-output">2.4 Check the output&lt;/h4>
&lt;p>To display the output file:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">cat ausurf.out
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;ul>
&lt;li>&lt;code>cat&lt;/code>: Prints the entire contents of a file to the terminal.&lt;/li>
&lt;/ul>
&lt;p>For longer calculations, it is often more useful to monitor the output while the calculation is running:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">tail -f ausurf.out
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;ul>
&lt;li>&lt;code>tail -f&lt;/code>: Displays the last few lines of a file and continuously updates the terminal whenever new output is written.&lt;/li>
&lt;/ul>
&lt;p>Other useful commands include:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">less ausurf.out
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">more ausurf.out
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>You can also edit or inspect files using editors such as:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">nano ausurf.out
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">vim ausurf.out
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The best choice depends on your workflow and personal preference.&lt;/p>
&lt;div class="flex px-4 py-3 rounded-md bg-primary-100 dark:bg-primary-900">
&lt;span class="pr-3 pt-1 text-primary-400">
&lt;svg height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">&lt;path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m11.25 11.25l.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0a9 9 0 0 1 18 0m-9-3.75h.008v.008H12z"/>&lt;/svg>
&lt;/span>
&lt;span class="dark:text-neutral-300">&lt;p>If a QE calculation terminates abnormally, a file named &lt;em>&lt;strong>&lt;code>CRASH&lt;/code>&lt;/strong>&lt;/em> may be created in the working directory. You can check for it using:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">ls
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The &lt;code>CRASH&lt;/code> file and the main QE output file usually provide useful information for debugging.&lt;/p>
&lt;p>Errors can arise for many reasons, including incorrectly formatted input files, missing or incorrect pseudopotentials, invalid calculation parameters, insufficient resources, or problems with the software environment.&lt;/p>
&lt;/span>
&lt;/div></description></item><item><title>1. Graphene SCF Calculation</title><link>https://suecreamm.github.io/docs/qe/example/graphene-scf/</link><pubDate>Tue, 01 Sep 2026 00:00:00 +0000</pubDate><guid>https://suecreamm.github.io/docs/qe/example/graphene-scf/</guid><description>&lt;p>In this example, we perform a self-consistent field (SCF) calculation for graphene using QE.&lt;/p>
&lt;p>The SCF calculation determines the ground-state electron density and provides the starting point for later calculations such as band structures and density of states.&lt;/p>
&lt;div class="hb-steps">
&lt;h3 id="prepare-the-graphene-structure">Prepare the graphene structure&lt;/h3>
&lt;p>Define a two-atom graphene unit cell with sufficient vacuum along the \(z\)-direction.&lt;/p>
&lt;h3 id="prepare-the-scf-input">Prepare the SCF input&lt;/h3>
&lt;p>Set the plane-wave cutoffs, k-point mesh, pseudopotential, and electronic convergence parameters.&lt;/p>
&lt;h3 id="run-the-calculation">Run the calculation&lt;/h3>
&lt;p>Execute &lt;code>pw.x&lt;/code> locally or submit the calculation to an HPC cluster.&lt;/p>
&lt;h3 id="check-convergence">Check convergence&lt;/h3>
&lt;p>Inspect the output file and confirm that the SCF cycle has converged successfully.&lt;/p>
&lt;/div>
&lt;hr>
&lt;h2 id="1-graphene-structure">1. Graphene Structure&lt;/h2>
&lt;p>Graphene is a two-dimensional material consisting of carbon atoms arranged in a honeycomb lattice.&lt;/p>
&lt;p>Because QE uses periodic boundary conditions in all three directions, vacuum is added along the \(z\)-direction to separate periodically repeated graphene layers.&lt;/p>
&lt;p>In this example, the graphene unit cell contains two carbon atoms and a cell length of 20 Å along the \(z\)-direction.&lt;/p>
&lt;div class="flex px-4 py-3 rounded-md bg-primary-100 dark:bg-primary-900">
&lt;span class="pr-3 pt-1 text-primary-400">
&lt;svg height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">&lt;path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m11.25 11.25l.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0a9 9 0 0 1 18 0m-9-3.75h.008v.008H12z"/>&lt;/svg>
&lt;/span>
&lt;span class="dark:text-neutral-300">For two-dimensional materials, the vacuum region should be large enough to reduce artificial interactions between periodically repeated layers.&lt;/span>
&lt;/div>
&lt;hr>
&lt;h2 id="2-scf-input-file">2. SCF Input File&lt;/h2>
&lt;p>Before running the calculation, prepare the pseudopotential used in the input file.&lt;/p>
&lt;h3 id="pseudopotential">Pseudopotential&lt;/h3>
&lt;p>For this tutorial, pseudopotentials can be obtained from &lt;a href="https://www.pseudo-dojo.org/" target="_blank" rel="noopener">PseudoDojo ↗&lt;/a>.&lt;/p>
&lt;p>Download a pseudopotential appropriate for the exchange-correlation functional and calculation setup you intend to use, then place the file in the directory specified by &lt;code>pseudo_dir&lt;/code>.&lt;/p>
&lt;p>In this example:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">pseudo_dir = &amp;#39;pseudo/&amp;#39;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>so the pseudopotential file should be placed inside the &lt;code>pseudo/&lt;/code> directory.&lt;/p>
&lt;div class="flex px-4 py-3 rounded-md bg-primary-100 dark:bg-primary-900">
&lt;span class="pr-3 pt-1 text-primary-400">
&lt;svg height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">&lt;path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m11.25 11.25l.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0a9 9 0 0 1 18 0m-9-3.75h.008v.008H12z"/>&lt;/svg>
&lt;/span>
&lt;span class="dark:text-neutral-300">The pseudopotential, &lt;code>ecutwfc&lt;/code>, and &lt;code>ecutrho&lt;/code> should be treated as a consistent set. When changing the pseudopotential, check the recommended cutoff values and perform convergence tests for the quantities relevant to your calculation.&lt;/span>
&lt;/div>
&lt;h3 id="input-file">Input File&lt;/h3>
&lt;p>The input file used in this example is available in my GitHub repository:&lt;/p>
&lt;p>&lt;a href="https://github.com/suecreamm/materials/blob/main/01graphene/qe/1scf.in" target="_blank" rel="noopener">View &lt;code>1scf.in&lt;/code> on GitHub ↗&lt;/a>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">&amp;amp;CONTROL
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">calculation = &amp;#39;scf&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">etot_conv_thr = 2.0000d-05
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">forc_conv_thr = 1.0000d-04
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">outdir = &amp;#39;./out/&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">prefix = &amp;#39;graphene&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">pseudo_dir = &amp;#39;pseudo/&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">tprnfor = .true.
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">tstress = .true.
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">verbosity = &amp;#39;high&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">/
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&amp;amp;SYSTEM
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">degauss = 0.01
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ecutrho = 200
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ecutwfc = 40
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ibrav = 0
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">nat = 2
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">nosym = .false.
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ntyp = 1
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">occupations = &amp;#39;smearing&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">smearing = &amp;#39;mv&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">/
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&amp;amp;ELECTRONS
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">conv_thr = 4.000d-10
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">electron_maxstep = 80
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">mixing_beta = 0.4
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">/
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ATOMIC_SPECIES
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">C 12.011 C.upf
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ATOMIC_POSITIONS angstrom
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">C 0.0000000000 1.4202816622 0.0000000000
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">C 1.2300000000 0.7101408311 0.0000000000
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">K_POINTS automatic
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">12 12 1 0 0 0
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">CELL_PARAMETERS angstrom
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">2.4600000000 0.0000000000 0.0000000000
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">-1.2300000000 2.1304224933 0.0000000000
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">0.0000000000 0.0000000000 20.0000000000
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="flex px-4 py-3 rounded-md bg-primary-100 dark:bg-primary-900">
&lt;span class="pr-3 pt-1 text-primary-400">
&lt;svg height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">&lt;path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m11.25 11.25l.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0a9 9 0 0 1 18 0m-9-3.75h.008v.008H12z"/>&lt;/svg>
&lt;/span>
&lt;span class="dark:text-neutral-300">The pseudopotential filename shown in &lt;code>ATOMIC_SPECIES&lt;/code> must match the actual file stored in &lt;code>pseudo_dir&lt;/code>.&lt;/span>
&lt;/div>
&lt;hr>
&lt;h2 id="3-understanding-the-input">3. Understanding the Input&lt;/h2>
&lt;h3 id="control">CONTROL&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">calculation = &amp;#39;scf&amp;#39;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>specifies a self-consistent field calculation.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">prefix = &amp;#39;graphene&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">outdir = &amp;#39;./out/&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">pseudo_dir = &amp;#39;pseudo/&amp;#39;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;ul>
&lt;li>&lt;code>prefix&lt;/code> defines the common name used for files generated during the calculation.&lt;/li>
&lt;li>&lt;code>outdir&lt;/code> specifies where temporary calculation data are stored.&lt;/li>
&lt;li>&lt;code>pseudo_dir&lt;/code> points to the directory containing the pseudopotential files.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">tprnfor = .true.
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">tstress = .true.
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>These options request the calculation of atomic forces and the stress tensor.&lt;/p>
&lt;h3 id="system">SYSTEM&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">ibrav = 0
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>means that the lattice vectors are defined explicitly using &lt;code>CELL_PARAMETERS&lt;/code>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">nat = 2
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ntyp = 1
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The unit cell contains two atoms and one atomic species.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">ecutwfc = 40
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ecutrho = 200
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>These parameters define the kinetic-energy cutoffs for the wavefunctions and charge density.&lt;/p>
&lt;h3 id="smearing">Smearing&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">occupations = &amp;#39;smearing&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">smearing = &amp;#39;mv&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">degauss = 0.01
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>This calculation uses Marzari-Vanderbilt smearing with a smearing width of 0.01 Ry.&lt;/p>
&lt;details class="spoiler " id="spoiler-4">
&lt;summary class="cursor-pointer">Why use smearing for graphene?&lt;/summary>
&lt;div class="rounded-lg bg-neutral-50 dark:bg-neutral-800 p-2">
&lt;p>Graphene is a zero-gap semimetal: the valence and conduction bands meet at the Dirac point.&lt;/p>
&lt;p>A small amount of smearing can make Brillouin-zone integration and SCF convergence more stable when electronic states lie very close to the Fermi level.&lt;/p>
&lt;p>The smearing width should still be chosen carefully because an unnecessarily large value can broaden electronic features and affect calculated quantities.&lt;/p>
&lt;/div>
&lt;/details>
&lt;h3 id="electronic-convergence">Electronic Convergence&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">conv_thr = 4.000d-10
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">electron_maxstep = 80
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">mixing_beta = 0.4
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;ul>
&lt;li>&lt;code>conv_thr&lt;/code> controls the convergence threshold of the electronic SCF cycle.&lt;/li>
&lt;li>&lt;code>electron_maxstep&lt;/code> sets the maximum number of SCF iterations.&lt;/li>
&lt;li>&lt;code>mixing_beta&lt;/code> controls how strongly the charge density is mixed between iterations.&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h2 id="4-atomic-structure-and-vacuum">4. Atomic Structure and Vacuum&lt;/h2>
&lt;p>The atomic coordinates are defined as:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">ATOMIC_POSITIONS angstrom
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">C 0.0000000000 1.4202816622 0.0000000000
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">C 1.2300000000 0.7101408311 0.0000000000
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The lattice vectors are specified explicitly:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">CELL_PARAMETERS angstrom
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">2.4600000000 0.0000000000 0.0000000000
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">-1.2300000000 2.1304224933 0.0000000000
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">0.0000000000 0.0000000000 20.0000000000
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The third lattice vector gives a 20 Å cell length along the \(z\)-direction.&lt;/p>
&lt;p>Since graphene lies in the \(xy\)-plane, most of this length acts as vacuum separating periodic images.&lt;/p>
&lt;hr>
&lt;h2 id="5-k-point-sampling">5. K-point Sampling&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">K_POINTS automatic
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">12 12 1 0 0 0
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>A \(12 \times 12 \times 1\) k-point mesh is used.&lt;/p>
&lt;p>The dense sampling is applied in the two periodic in-plane directions, while only one k-point is used along the vacuum direction.&lt;/p>
&lt;div class="flex px-4 py-3 rounded-md bg-primary-100 dark:bg-primary-900">
&lt;span class="pr-3 pt-1 text-primary-400">
&lt;svg height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">&lt;path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m11.25 11.25l.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0a9 9 0 0 1 18 0m-9-3.75h.008v.008H12z"/>&lt;/svg>
&lt;/span>
&lt;span class="dark:text-neutral-300">&lt;p>The k-point mesh should also be tested for convergence.&lt;/p>
&lt;p>For graphene and other two-dimensional materials, the important sampling is primarily in the in-plane directions.&lt;/p>
&lt;/span>
&lt;/div>
&lt;hr>
&lt;h2 id="6-run-the-calculation">6. Run the Calculation&lt;/h2>
&lt;h3 id="local-execution">Local execution&lt;/h3>
&lt;p>For a simple local run, QE can be executed directly from the terminal.&lt;/p>
&lt;p>&lt;strong>Serial execution&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">pw.x -in 1scf.in &amp;gt; 1scf.out
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>Parallel execution using MPI&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">mpirun -np &lt;span class="m">16&lt;/span> pw.x -in 1scf.in &amp;gt; 1scf.out
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Here, &lt;code>-np 16&lt;/code> launches 16 MPI processes.&lt;/p>
&lt;h3 id="hpc-job-submission">HPC job submission&lt;/h3>
&lt;p>On an HPC cluster, calculations are usually submitted to a &lt;strong>job scheduler&lt;/strong> rather than run directly in the login shell.&lt;/p>
&lt;p>For example, on a SLURM-based cluster, I submit my QE calculation with:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">sbatch qe_job_submit.sh
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The scheduler places the job in a queue and starts it when the requested computational resources become available.&lt;/p>
&lt;p>&lt;a href="https://github.com/suecreamm/materials/blob/main/scripts/qe/qe_job_submit.sh" target="_blank" rel="noopener">View my &lt;code>qe_job_submit.sh&lt;/code> on GitHub ↗&lt;/a>&lt;/p>
&lt;div class="flex px-4 py-3 rounded-md bg-primary-100 dark:bg-primary-900">
&lt;span class="pr-3 pt-1 text-primary-400">
&lt;svg height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">&lt;path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m11.25 11.25l.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0a9 9 0 0 1 18 0m-9-3.75h.008v.008H12z"/>&lt;/svg>
&lt;/span>
&lt;span class="dark:text-neutral-300">&lt;p>The exact execution command depends on the cluster configuration.&lt;/p>
&lt;p>Some systems use &lt;code>mpirun&lt;/code>, while others may use &lt;code>srun&lt;/code> or another MPI launcher. Resource requests and module settings should follow the documentation of the HPC system you are using.&lt;/p>
&lt;/span>
&lt;/div>
&lt;p>For a more detailed walkthrough of building QE and submitting jobs on a cluster:&lt;/p>
&lt;div class="hb-cards mt-4 grid gap-4 not-prose" style="--hb-cols: 1;">
&lt;a
class="hb-card group"href="../../env/qe-install" >
&lt;span class="hb-card-title pt-4 px-4">
&lt;svg style="height: 1em; width: 1em;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">&lt;!--! Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc. -->&lt;path d="M288 32c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 242.7-73.4-73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l128 128c12.5 12.5 32.8 12.5 45.3 0l128-128c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L288 274.7 288 32zM64 352c-35.3 0-64 28.7-64 64l0 32c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-32c0-35.3-28.7-64-64-64l-101.5 0-45.3 45.3c-25 25-65.5 25-90.5 0L165.5 352 64 352zm368 56a24 24 0 1 1 0 48 24 24 0 1 1 0-48z"/>&lt;/svg>Building Quantum ESPRESSO and Submitting Jobs&lt;/span>&lt;div class="hb-card-subtitle">QE installation, HPC setup, and SLURM job submission.&lt;/div>&lt;/a>
&lt;/div>
&lt;hr>
&lt;h2 id="7-check-the-output">7. Check the Output&lt;/h2>
&lt;p>After the calculation finishes, inspect the output file:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">tail -50 1scf.out
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>A converged SCF calculation should contain:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">convergence has been achieved
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The final total energy can be found using:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">grep &lt;span class="s2">&amp;#34;!&amp;#34;&lt;/span> 1scf.out
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Quantum ESPRESSO marks the final total energy with an exclamation mark (&lt;code>!&lt;/code>).&lt;/p>
&lt;details class="spoiler " id="spoiler-8">
&lt;summary class="cursor-pointer">What should I check if the SCF calculation does not converge?&lt;/summary>
&lt;div class="rounded-lg bg-neutral-50 dark:bg-neutral-800 p-2">
&lt;p>If the calculation does not converge, useful parameters to inspect include:&lt;/p>
&lt;ul>
&lt;li>&lt;code>conv_thr&lt;/code>&lt;/li>
&lt;li>&lt;code>mixing_beta&lt;/code>&lt;/li>
&lt;li>&lt;code>electron_maxstep&lt;/code>&lt;/li>
&lt;li>the k-point mesh&lt;/li>
&lt;li>the smearing settings&lt;/li>
&lt;li>the pseudopotential and cutoff energies&lt;/li>
&lt;/ul>
&lt;p>The output file usually contains the most useful clues for identifying where the calculation failed.&lt;/p>
&lt;/div>
&lt;/details>
&lt;hr>
&lt;h2 id="8-what-comes-next">8. What Comes Next?&lt;/h2>
&lt;p>The converged ground-state electron density can be reused in subsequent electronic-structure calculations.&lt;/p>
&lt;p>In the next examples, we will use this graphene calculation to obtain:&lt;/p>
&lt;ul>
&lt;li>the electronic band structure,&lt;/li>
&lt;li>the density of states,&lt;/li>
&lt;li>and phonon properties.&lt;/li>
&lt;/ul>
&lt;h2 id="next">Next&lt;/h2>
&lt;div class="hb-cards mt-4 grid gap-4 not-prose" style="--hb-cols: 1;">
&lt;a
class="hb-card group"href="../graphene-bands" >
&lt;span class="hb-card-title pt-4 px-4">
&lt;svg style="height: 1em; width: 1em;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512">&lt;!--! Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc. -->&lt;path d="M576 0c17.7 0 32 14.3 32 32l0 448c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-448c0-17.7 14.3-32 32-32zM448 96c17.7 0 32 14.3 32 32l0 352c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-352c0-17.7 14.3-32 32-32zM352 224l0 256c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-256c0-17.7 14.3-32 32-32s32 14.3 32 32zM192 288c17.7 0 32 14.3 32 32l0 160c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-160c0-17.7 14.3-32 32-32zM96 416l0 64c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-64c0-17.7 14.3-32 32-32s32 14.3 32 32z"/>&lt;/svg>Graphene Band Structure&lt;/span>&lt;div class="hb-card-subtitle">Calculate the electronic bands along a high-symmetry path.&lt;/div>&lt;/a>
&lt;/div></description></item><item><title>2. Graphene Band Structure Calculation</title><link>https://suecreamm.github.io/docs/qe/example/graphene-bands/</link><pubDate>Wed, 02 Sep 2026 00:00:00 +0000</pubDate><guid>https://suecreamm.github.io/docs/qe/example/graphene-bands/</guid><description>&lt;p>This tutorial continues from the &lt;a href="../graphene-scf">graphene SCF calculation&lt;/a> and calculates the electronic band structure along the high-symmetry path \(\Gamma \rightarrow M \rightarrow K \rightarrow \Gamma\).&lt;/p>
&lt;p>The important point is that the band calculation reuses the converged ground-state data from the previous SCF calculation.&lt;/p>
&lt;div class="hb-steps">
&lt;h3 id="create-a-working-directory">Create a working directory&lt;/h3>
&lt;p>Make a separate directory for the band-structure calculation and copy the SCF input using a relative path.&lt;/p>
&lt;h3 id="prepare-the-band-input">Prepare the band input&lt;/h3>
&lt;p>Reuse the SCF setup, change the calculation type to &lt;code>bands&lt;/code>, and define a high-symmetry k-point path.&lt;/p>
&lt;h3 id="run-pwx">Run &lt;code>pw.x&lt;/code>&lt;/h3>
&lt;p>Calculate the Kohn-Sham eigenvalues along the selected path.&lt;/p>
&lt;h3 id="post-process-with-bandsx">Post-process with &lt;code>bands.x&lt;/code>&lt;/h3>
&lt;p>Collect the calculated eigenvalues into a convenient band-data file for plotting.&lt;/p>
&lt;/div>
&lt;hr>
&lt;h2 id="1-create-a-band-calculation-directory">1. Create a Band-Calculation Directory&lt;/h2>
&lt;p>Start from the directory where the previous SCF calculation was prepared.&lt;/p>
&lt;p>Create a separate directory for the band calculation:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">mkdir 99band
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> 99band
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Copy the previous SCF input into the new directory using a relative path:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">cp ../1scf.in ./99band.1pw.in
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Here, &lt;code>..&lt;/code> means the parent directory and &lt;code>.&lt;/code> means the current directory.&lt;/p>
&lt;p>The copied file will be used as the starting point for the band input, so the lattice, atomic positions, pseudopotential, cutoffs, and other basic settings remain consistent with the SCF calculation.&lt;/p>
&lt;div class="flex px-4 py-3 rounded-md bg-primary-100 dark:bg-primary-900">
&lt;span class="pr-3 pt-1 text-primary-400">
&lt;svg height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">&lt;path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m11.25 11.25l.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0a9 9 0 0 1 18 0m-9-3.75h.008v.008H12z"/>&lt;/svg>
&lt;/span>
&lt;span class="dark:text-neutral-300">&lt;p>The band calculation must use the same &lt;code>prefix&lt;/code> and the same SCF data stored in &lt;code>outdir&lt;/code>.&lt;/p>
&lt;p>Because &lt;code>99band/&lt;/code> is a subdirectory, the relative paths to the SCF output and pseudopotential directories need to be adjusted.&lt;/p>
&lt;p>For example:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">outdir = &amp;#39;../out/&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">pseudo_dir = &amp;#39;../pseudo/&amp;#39;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/span>
&lt;/div>
&lt;p>For the SCF setup used in this tutorial:&lt;/p>
&lt;div class="hb-cards mt-4 grid gap-4 not-prose" style="--hb-cols: 1;">
&lt;a
class="hb-card group"href="../graphene-scf" >
&lt;span class="hb-card-title pt-4 px-4">
&lt;svg style="height: 1em; width: 1em;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512">&lt;!--! Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc. -->&lt;path d="M64 0C28.7 0 0 28.7 0 64L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-384c0-35.3-28.7-64-64-64L64 0zM96 64l192 0c17.7 0 32 14.3 32 32l0 32c0 17.7-14.3 32-32 32L96 160c-17.7 0-32-14.3-32-32l0-32c0-17.7 14.3-32 32-32zm32 160a32 32 0 1 1 -64 0 32 32 0 1 1 64 0zM96 352a32 32 0 1 1 0-64 32 32 0 1 1 0 64zM64 416c0-17.7 14.3-32 32-32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-96 0c-17.7 0-32-14.3-32-32zM192 256a32 32 0 1 1 0-64 32 32 0 1 1 0 64zm32 64a32 32 0 1 1 -64 0 32 32 0 1 1 64 0zm64-64a32 32 0 1 1 0-64 32 32 0 1 1 0 64zm32 64a32 32 0 1 1 -64 0 32 32 0 1 1 64 0zM288 448a32 32 0 1 1 0-64 32 32 0 1 1 0 64z"/>&lt;/svg>Graphene SCF Calculation&lt;/span>&lt;div class="hb-card-subtitle">Ground-state calculation used as the starting point for the band structure.&lt;/div>&lt;/a>
&lt;/div>
&lt;p>The original SCF input is also available on GitHub:&lt;/p>
&lt;p>&lt;a href="https://github.com/suecreamm/materials/blob/main/01graphene/qe/1scf.in" target="_blank" rel="noopener">View &lt;code>1scf.in&lt;/code> on GitHub ↗&lt;/a>&lt;/p>
&lt;hr>
&lt;h2 id="2-prepare-the-band-input">2. Prepare the Band Input&lt;/h2>
&lt;p>Open the copied file:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">vi 99band.1pw.in
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The main changes from the SCF calculation are:&lt;/p>
&lt;ul>
&lt;li>change &lt;code>calculation = 'scf'&lt;/code> to &lt;code>calculation = 'bands'&lt;/code>&lt;/li>
&lt;li>point &lt;code>outdir&lt;/code> and &lt;code>pseudo_dir&lt;/code> to the directories in the parent folder&lt;/li>
&lt;li>optionally specify &lt;code>nbnd&lt;/code>&lt;/li>
&lt;li>replace the automatic k-point mesh with a high-symmetry path&lt;/li>
&lt;/ul>
&lt;p>A band input based on the previous graphene SCF calculation can be written as:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">&amp;amp;CONTROL
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">calculation = &amp;#39;bands&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">etot_conv_thr = 2.0000d-05
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">forc_conv_thr = 1.0000d-04
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">outdir = &amp;#39;../out/&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">prefix = &amp;#39;graphene&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">pseudo_dir = &amp;#39;../pseudo/&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">tprnfor = .true.
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">tstress = .true.
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">verbosity = &amp;#39;high&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">/
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&amp;amp;SYSTEM
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">degauss = 0.01
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ecutrho = 200
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ecutwfc = 40
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ibrav = 0
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">nat = 2
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">nbnd = 8
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">nosym = .false.
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ntyp = 1
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">occupations = &amp;#39;smearing&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">smearing = &amp;#39;mv&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">/
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&amp;amp;ELECTRONS
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">conv_thr = 4.000d-10
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">electron_maxstep = 80
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">mixing_beta = 0.4
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">/
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ATOMIC_SPECIES
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">C 12.011 C.upf
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ATOMIC_POSITIONS angstrom
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">C 0.0000000000 1.4202816622 0.0000000000
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">C 1.2300000000 0.7101408311 0.0000000000
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">K_POINTS crystal_b
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">4
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">0.000000000 0.000000000 0.000000000 30
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">0.500000000 0.000000000 0.000000000 30
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">0.333333333 0.333333333 0.000000000 30
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">0.000000000 0.000000000 0.000000000 0
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">CELL_PARAMETERS angstrom
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">2.4600000000 0.0000000000 0.0000000000
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">-1.2300000000 2.1304224933 0.0000000000
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">0.0000000000 0.0000000000 20.0000000000
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="flex px-4 py-3 rounded-md bg-primary-100 dark:bg-primary-900">
&lt;span class="pr-3 pt-1 text-primary-400">
&lt;svg height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">&lt;path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m11.25 11.25l.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0a9 9 0 0 1 18 0m-9-3.75h.008v.008H12z"/>&lt;/svg>
&lt;/span>
&lt;span class="dark:text-neutral-300">&lt;p>&lt;code>nbnd = 8&lt;/code> is an example value chosen to include several conduction bands above the occupied states.&lt;/p>
&lt;p>The number of bands should be adjusted depending on the energy range you want to visualize.&lt;/p>
&lt;/span>
&lt;/div>
&lt;hr>
&lt;h2 id="3-define-the-high-symmetry-path">3. Define the High-Symmetry Path&lt;/h2>
&lt;p>For graphene, a commonly used path through the two-dimensional Brillouin zone is:&lt;/p>
\[
\Gamma \rightarrow M \rightarrow K \rightarrow \Gamma
\]
&lt;p>In the input above, this is specified using:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">K_POINTS crystal_b
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">4
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">0.000000000 0.000000000 0.000000000 30
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">0.500000000 0.000000000 0.000000000 30
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">0.333333333 0.333333333 0.000000000 30
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">0.000000000 0.000000000 0.000000000 0
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The fourth number on each line controls the number of points generated between that high-symmetry point and the next one.&lt;/p>
&lt;details class="spoiler " id="spoiler-4">
&lt;summary class="cursor-pointer">Why not use K_POINTS automatic for a band structure?&lt;/summary>
&lt;div class="rounded-lg bg-neutral-50 dark:bg-neutral-800 p-2">
&lt;p>An SCF calculation samples the Brillouin zone with a mesh in order to obtain a converged ground-state electron density.&lt;/p>
&lt;p>A band-structure calculation has a different purpose: it evaluates the eigenvalues along a selected path through reciprocal space.&lt;/p>
&lt;p>Therefore, instead of an automatic mesh, we explicitly specify a sequence of high-symmetry points.&lt;/p>
&lt;/div>
&lt;/details>
&lt;hr>
&lt;h2 id="4-run-the-band-calculation">4. Run the Band Calculation&lt;/h2>
&lt;h3 id="local-execution">Local execution&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">pw.x -in 99band.1pw.in &amp;gt; 99band.1pw.out
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>For an MPI calculation:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">mpirun -np &lt;span class="m">16&lt;/span> pw.x -in 99band.1pw.in &amp;gt; 99band.1pw.out
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="hpc-job-submission">HPC job submission&lt;/h3>
&lt;p>On a SLURM-based cluster, the calculation can be submitted through the same job-submission workflow used for the SCF calculation.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">sbatch qe_job_submit.sh
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>If the job script contains a fixed input filename, change it from &lt;code>1scf.in&lt;/code> to &lt;code>99band.1pw.in&lt;/code> before submission.&lt;/p>
&lt;p>&lt;a href="https://github.com/suecreamm/materials/blob/main/scripts/qe/qe_job_submit.sh" target="_blank" rel="noopener">View my &lt;code>qe_job_submit.sh&lt;/code> on GitHub ↗&lt;/a>&lt;/p>
&lt;div class="flex px-4 py-3 rounded-md bg-primary-100 dark:bg-primary-900">
&lt;span class="pr-3 pt-1 text-primary-400">
&lt;svg height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">&lt;path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m11.25 11.25l.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0a9 9 0 0 1 18 0m-9-3.75h.008v.008H12z"/>&lt;/svg>
&lt;/span>
&lt;span class="dark:text-neutral-300">&lt;p>The band calculation should read the converged SCF data associated with the same &lt;code>prefix&lt;/code> and &lt;code>outdir&lt;/code>.&lt;/p>
&lt;p>If QE cannot find the previous calculation, check the relative &lt;code>outdir&lt;/code> path first.&lt;/p>
&lt;/span>
&lt;/div>
&lt;hr>
&lt;h2 id="5-check-the-band-output">5. Check the Band Output&lt;/h2>
&lt;p>After the calculation finishes, inspect the end of the output file:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">tail -50 99band.1pw.out
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>You can also check that the job finished normally:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">grep &lt;span class="s2">&amp;#34;JOB DONE&amp;#34;&lt;/span> 99band.1pw.out
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>At this stage, &lt;code>pw.x&lt;/code> has calculated the eigenvalues along the selected k-point path.&lt;/p>
&lt;p>The next step is to collect the band data using &lt;code>bands.x&lt;/code>.&lt;/p>
&lt;hr>
&lt;h2 id="6-post-process-with-bandsx">6. Post-process with &lt;code>bands.x&lt;/code>&lt;/h2>
&lt;p>Create an input file named &lt;code>99band.2pp.in&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">&amp;amp;BANDS
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">prefix = &amp;#39;graphene&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">outdir = &amp;#39;../out/&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">filband = &amp;#39;graphene.bands&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">/
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Run:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">bands.x -in 99band.2pp.in &amp;gt; 99band.2pp.out
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>This creates:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">graphene.bands
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>which contains the band energies in a form that can be used for plotting.&lt;/p>
&lt;div class="flex px-4 py-3 rounded-md bg-primary-100 dark:bg-primary-900">
&lt;span class="pr-3 pt-1 text-primary-400">
&lt;svg height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">&lt;path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m11.25 11.25l.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0a9 9 0 0 1 18 0m-9-3.75h.008v.008H12z"/>&lt;/svg>
&lt;/span>
&lt;span class="dark:text-neutral-300">&lt;p>&lt;code>bands.x&lt;/code> does not perform a new electronic-structure calculation.&lt;/p>
&lt;p>It post-processes the eigenvalues already calculated by &lt;code>pw.x&lt;/code> during the &lt;code>bands&lt;/code> calculation.&lt;/p>
&lt;/span>
&lt;/div>
&lt;hr>
&lt;h2 id="7-workflow-summary">7. Workflow Summary&lt;/h2>
&lt;p>The complete workflow is:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">SCF
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> ↓
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">Converged ground-state density
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> ↓
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">BANDS calculation along Γ-M-K-Γ
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> ↓
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">bands.x
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> ↓
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">Band data
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> ↓
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">Plot
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The characteristic feature to look for in graphene is the crossing of the valence and conduction bands at the \(K\) point, forming the Dirac cone.&lt;/p>
&lt;details class="spoiler " id="spoiler-7">
&lt;summary class="cursor-pointer">Why is the K point important in graphene?&lt;/summary>
&lt;div class="rounded-lg bg-neutral-50 dark:bg-neutral-800 p-2">
&lt;p>In ideal graphene, the valence and conduction bands meet at the \(K\) and \(K'\) points of the Brillouin zone.&lt;/p>
&lt;p>Near these points, the electronic bands are approximately linear in energy versus momentum, which gives rise to the well-known Dirac-cone dispersion.&lt;/p>
&lt;/div>
&lt;/details>
&lt;hr>
&lt;h2 id="next">Next&lt;/h2>
&lt;div class="hb-cards mt-4 grid gap-4 not-prose" style="--hb-cols: 1;">
&lt;a
class="hb-card group"href="../graphene-dos" >
&lt;span class="hb-card-title pt-4 px-4">
&lt;svg style="height: 1em; width: 1em;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">&lt;!--! Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc. -->&lt;path d="M448 96l0 128-160 0 0-128 160 0zm0 192l0 128-160 0 0-128 160 0zM224 224L64 224 64 96l160 0 0 128zM64 288l160 0 0 128L64 416l0-128zM64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64L64 32z"/>&lt;/svg>Graphene Density of States&lt;/span>&lt;div class="hb-card-subtitle">Calculate the electronic density of states using an NSCF calculation and dos.x.&lt;/div>&lt;/a>
&lt;/div></description></item></channel></rss>