Supported by Q-MS

Quantum ESPRESSO in Python

QEpy turns Quantum ESPRESSO (QE) into a programmable DFT engine. Drive SCF and beyond from Python scripts or Jupyter notebooks: inject external potentials, swap XC functionals on the fly, and integrate with ASE and DFTpy.

QE 7.2Current stable target
Python ≥3.8Serial & MPI parallel
20+Jupyter examples

Programmable DFT

Control QE from Python with the Driver class: step through SCF iterations, modify density and potentials, and restart calculations without leaving your script.

Nonstandard workflows

Add external potentials, custom exchange–correlation functionals (via DFTpy), real-time TDDFT, and multiscale embedding: workflows that are awkward or impossible with plain QE input files alone.

Drop-in QE replacement

Run standard QE packages from the command line: python -m qepy --pw.x -i qe.in. Almost all QE executables are supported, plus QEpy-specific tools.


Architecture

How QEpy works

QEpy wraps selected QE routines with Python bindings (via f90wrap). A thin Python layer exposes the Driver, while an embedded Fortran object (EMBED) bridges Python and the PWSCF engine.

PythonDriver · Calculator · QEInput
EMBEDFortran bridge object
PWSCFQE electrons & ions

Minor modifications to QE (e.g. electrons.f90) plus f90wrap compilation. QEpy tracks the latest QE stable release.

Example

Iterative SCF in Python

Step through SCF one iteration at a time, inspect density, inject corrections, or couple to an external model between QE calls.

Notebook

Jupyter walkthrough

QEpy iterative SCF notebook updating the electron density
Script

Minimal example

from qepy import Driver

driver = Driver('si.scf.in', iterative=True)
while not driver.check_convergence():
    driver.diagonalize()
    driver.mix()
    rho = driver.get_density()
    # ... modify density or potential ...
driver.stop()

See tutorials for serial and MPI examples, Jupyter notebooks, and HPC launch instructions.

People & funding

Contributors

Thanks to

  • The Quantum ESPRESSO developers
  • Quantum Multiscale (Q-MS) collaboration
  • NSF CyberTraining funding
  • NSF CTMC and DOE CTC funding
  • Thanks to all participants to the various hackathons over the years, especially Quinn Campbell and Andrew Baczewski
Quick links

Start here

If you like QEpy, you may also enjoy DFTpy for grid-based DFT and custom XC.