QE 4 · Quantum ESPRESSO · 8 min read
How do I run my first Quantum ESPRESSO calculation?
Checked against the docs · Quantum ESPRESSO repository, tag qe-7.6 · Last checked 13 November 2026 · Spot a mistake? Tell us
Short answer
Start from the official PWscf example 1, a self-consistent (SCF) calculation of silicon: one input file, one pseudopotential, and pw.x -i si.scf.in > si.scf.out. In the output, the "estimated scf accuracy" falls at each iteration until it is below conv_thr, pw.x prints "convergence has been achieved", and the converged total energy is the line that starts with !.
What will this first run calculate?
The first step of Quantum ESPRESSO's own PWscf example 1: a self-consistent field (SCF) calculation of crystalline silicon. pw.x keeps the atoms where they are and repeats a loop for the electrons, the self-consistency loop: it starts from a superposition of the free atoms (the output says so), solves for the orbitals, and mixes each new charge density with the earlier ones (mixing_beta sets how much), until its estimate of the energy error falls below the threshold conv_thr. The result is the total energy of the structure; this input also asks for the forces and the stress.
The PWscf user guide points to this example for a single-point SCF calculation, and the repository keeps its verified output in PW/examples/example01/reference/, so you can compare yours line by line.
What goes in?
Two files:
| File | What it is |
|---|---|
si.scf.in | The input: two silicon atoms in a face-centered cubic cell (ibrav = 2, celldm(1) = 10.20 bohr), a wavefunction cutoff of 18 Ry, 10 k-points, conv_thr = 1.0d-8. Line by line: What is in a Quantum ESPRESSO input file? |
Si.pz-vbc.UPF | The silicon pseudopotential, in the folder pseudo_dir names. The example script downloads it if it is missing. See How does Quantum ESPRESSO use pseudopotentials? |
There are two ways to run it.
Run the example itself. In the Quantum ESPRESSO folder, edit the file environment_variables: BIN_DIR (where pw.x is), PSEUDO_DIR (the pseudopotentials) and TMP_DIR (a scratch folder). The general user guide warns not to point TMP_DIR at a folder holding other data, because the examples clean it. For a parallel build, also set PARA_PREFIX (for example "mpirun -np 4") and PARA_POSTFIX. Then:
cd PW/examples/example01
./run_exampleThe script writes its inputs and outputs into results/. It also runs band structures and three metals (aluminum, copper, nickel), so it goes on after silicon.
Run pw.x by hand. Copy the silicon input from run_example into si.scf.in, replace $PSEUDO_DIR and $TMP_DIR with real folders and $diago with david, and start it:
mpirun -np 4 pw.x -i si.scf.in > si.scf.outThis is the form the general user guide gives; the launcher and its options depend on your machine. The examples instead pass the input on standard input (pw.x < si.scf.in > si.scf.out); the guide says some MPI libraries have trouble with that in parallel, and that -i avoids it. On a cluster that does not allow interactive runs, the same line goes into a job script: How do I submit a job on SLURM?
What does the output say first?
The output below is the repository's reference for this run, si.scf.david.out. It was written by version 6.0 on four processors in 2016, so a current version may print some lines differently, and the general user guide notes that results can differ slightly between machines, for example when different FFT grids are chosen. The first lines:
Program PWSCF v.6.0 (svn rev. 13188) starts on 6Dec2016 at 13:23:16
This program is part of the open-source Quantum ESPRESSO suite
for quantum simulation of materials; please cite
"P. Giannozzi et al., J. Phys.:Condens. Matter 21 395502 (2009);
URL http://www.quantum-espresso.org",
in publications or presentations arising from this work. More details at
http://www.quantum-espresso.org/quote
Parallel version (MPI), running on 4 processorsThe line "Parallel version (MPI)" matters: the user guide says to check there whether your executable was compiled for parallel runs, because running several copies of a serial pw.x under mpirun "produces strange crashes".
Further down, pw.x repeats what it understood from your input. Check it against what you meant:
kinetic-energy cutoff = 18.0000 Ry
charge density cutoff = 72.0000 Ry
convergence threshold = 1.0E-08
mixing beta = 0.7000The reference input was older than the one in run_example today and gave no unit for ATOMIC_POSITIONS, so this output also carries a note, DEPRECATED: no units specified in ATOMIC_POSITIONS card; the current input says alat and does not get it.
How do I follow the electron loop?
Each pass of the loop prints a block. These are iterations 5 and 6 of the reference run:
iteration # 5 ecut= 18.00 Ry beta=0.70
Davidson diagonalization with overlap
ethr = 8.17E-08, avg # of iterations = 2.0
total cpu time spent up to now is 0.1 secs
total energy = -15.84452724 Ry
Harris-Foulkes estimate = -15.84452726 Ry
estimated scf accuracy < 0.00000006 Ry
iteration # 6 ecut= 18.00 Ry beta=0.70
Davidson diagonalization with overlap
ethr = 6.93E-10, avg # of iterations = 2.7The line to watch is estimated scf accuracy. The input reference defines convergence as this estimated energy error falling below conv_thr. In the reference run it falls at every iteration:
| Iteration | estimated scf accuracy (Ry) |
|---|---|
| 1 | 0.06142089 |
| 2 | 0.00214211 |
| 3 | 0.00007015 |
| 4 | 0.00000654 |
| 5 | 0.00000006 |
| 6 | 8.1E-10 |
After iteration 5 it is still above conv_thr (1.0E-08); after iteration 6 it is below, and the loop stops.
Where is the total energy?
After the loop, pw.x prints the band energies at each k-point (in eV), then the converged result:
! total energy = -15.84452726 Ry
Harris-Foulkes estimate = -15.84452726 Ry
estimated scf accuracy < 8.1E-10 Ry
The total energy is the sum of the following terms:
one-electron contribution = 4.79352680 Ry
hartree contribution = 1.07664155 Ry
xc contribution = -4.81493694 Ry
ewald contribution = -16.89975867 Ry
convergence has been achieved in 6 iterations- The total energy is on the line that starts with
!, in Ry: −15.84452726 Ry for these two silicon atoms. In this output it is the only line that starts with!, sogrep '^!' si.scf.outfinds it. - convergence has been achieved in 6 iterations confirms the loop met
conv_thr. - The four contributions add up to the total. The user guide notes that only the total is variational, so it converges more accurately than its parts: with a threshold of 10⁻⁸ you get about 8 digits on the total, one or two fewer on terms like the exchange-correlation and Hartree energies.
Because tprnfor and tstress were set, the forces and the stress follow. Here both forces print as zero, and the pressure line reads P= -10.24 (kbar). The run ends by writing its data folder, Writing output data file silicon.save, then a timing report and JOB DONE.
What if it does not converge?
The loop stops after electron_maxstep iterations, 100 by default. A run that reaches the limit says so; this line is from the reference output of PWscf example 14, which sets electron_maxstep = 1 on purpose:
convergence NOT achieved after 1 iterations: stoppingA total energy from such a run is not converged. The PWscf user guide's troubleshooting section suggests, assuming the input is sensible:
- check the structure first: bad input data often gives bad convergence;
- check whether the system is metallic or close to it, especially with few k-points; adding a few empty bands and a small smearing usually helps;
- reduce
mixing_betato about 0.3 to 0.1 or smaller, and try themixing_modesuited to the system ('local-TF'for slabs and elongated cells); - for ultrasoft pseudopotentials, raise
ecutrho.
A related message is the system is metallic, specify occupations. In version 7.6 pw.x prints it under Message from routine setup: when the number of electrons is odd and occupations is left at its default, and the run carries on (the PWscf user guide still calls it a stop). Take it as a warning all the same: the default occupations = 'fixed' only works for an insulator with a gap, and 'smearing' is the fix.
What do people mix up?
| The mix-up | What is true |
|---|---|
"The last total energy line is the answer." | The converged energy is the line starting with !, printed after the loop has met conv_thr. The lines inside the loop are intermediate. |
| "The run finished, so it converged." | Look for "convergence has been achieved". "convergence NOT achieved" means the loop stopped at electron_maxstep. |
| "The energy is in eV." | pw.x prints the total energy in Ry; the band energies, the Fermi energy and the highest occupied level are listed in eV. |
| "My numbers must match the reference exactly." | The user guide says small differences between machines are normal, so a plain diff against the reference does not work; compare by eye. |
"pw.x hangs at Waiting for input...." | In a parallel run, the guide says this is the MPI library not passing the input through; start pw.x with -i and the file name. |
Which value should I use?
This page runs the example's values as they are; choosing your own is a separate question.
- The cutoffs for your pseudopotentials: How does Quantum ESPRESSO use pseudopotentials?
- Every input variable and card: What is in a Quantum ESPRESSO input file?
- What k-points are and why a crystal needs them: What are k-points?
Verlet runs VASP and LAMMPS today and does not support Quantum ESPRESSO; everything on this page works without it.