Quantum ESPRESSO Band, DOS/PDOS, Fatband, and Analysis Toolkit
QEPlotter is a Python library for post-processing and visualization of Quantum ESPRESSO (QE) outputs.
With a unified high-level API, you can generate publication-ready plots and also perform structure analysis, projection conversion, and band gap detection.
pip install git+https://github.com/shubics/QEPlotter.git
Or work from the source:
git clone https://github.com/shubics/QEPlotter.git
cd QEPlotter
pip install -e .
Requirements:
- Python 3.8+
numpy
,matplotlib
Optional: TeX Live (LaTeX labels), PDF/Matlab/Mathematica export tools
- Modes:
normal
: classic band plotatomic
,orbital
,element_orbital
: colored bands based on contributionoverlay_band
: compare two band structures
- Bubble Modes:
atomic
,orbital
,element_orbital
- Line Modes:
o_atomic
,o_orbital
,o_element_orbital
- Heatmap Modes:
heat_total
,heat_atomic
,heat_orbital
,heat_element_orbital
- Layer Mode:
- Visualize interlayer contributions in bilayers
- Total and projected DOS plots
detect_band_gap(band_file, kpt_file, fermi=None)
: Automatically detects direct or indirect band gaps and reports VBM/CBM.analyse_file(path)
: Analyzes bilayer stacking and calculates vertical/3D interatomic distances.convert_soc_proj_to_ml(...)
: Convertsproj.out
files into QEPlotter-compatible fatband files with atomic/orbital resolution.
File Type | Description |
---|---|
*.bands.dat.gnu |
Band structure file (from bands.x ) |
*.kpath |
High-symmetry k-point file |
proj.out |
Output from projwfc.x |
*_pdos |
Directory of projected DOS files |
*.dos |
Total DOS file from dos.x |
Name | Type | Applies to | Description |
---|---|---|---|
plot_type | str |
all | 'band' , 'dos' , 'pdos' , 'fatbands' |
band_file | str |
band, fatbands | QE .bands.dat.gnu file |
kpath_file | str |
band, fatbands | QE K_POINTS crystal_b file |
dos_file | str |
dos (+fatbands) | Two-column file with energy and DOS |
pdos_dir | str |
pdos | Folder with pdos_atm# files |
fatband_dir | str |
fatbands | Folder with fatband projection files |
band_mode | str |
band | 'normal' , 'atomic' , 'orbital' , 'element_orbital' , 'most' |
pdos_mode | str |
pdos | 'atomic' , 'orbital' , 'element_orbital' |
fatbands_mode | str |
fatbands | Various bubble, line, heatmap, or layer modes |
highlight_channel | str / list |
line, heatmap | Emphasize specific atom/orbital/channel |
dual | bool |
line | Blend colors between two highlight channels |
spin | bool |
band, fatbands | Plot spin-resolved results |
sub_orb | bool |
band, fatbands | Show sub-orbital separation |
fermi_level | float |
all | Reference Fermi energy |
shift_fermi | bool |
all | Shift Fermi level to 0 eV |
y_range | (float,float) |
all | Set y-axis limits |
cmap_name | str |
all | Matplotlib colormap |
s_min, s_max | float |
bubble/heatmap | Marker size range |
weight_threshold | float |
bubble/heatmap | Ignore small weights |
dpi | int |
all | Image resolution |
layer_assignment | dict[str,str] |
layer | Atom-to-layer mapping |
plot_total_dos | bool |
fatbands | Show total DOS beside fatbands |
overlay_bands_in_heat | bool |
heatmap | Overlay band lines on heatmap |
heat_vmin, heat_vmax | float |
heatmap | Color scale normalization |
savefig | str |
all | Output path (omit to show interactively) |
plot_from_file(
plot_type='band',
band_file='BBS.bands.dat.gnu',
kpath_file='BBS.kpath',
fermi_level=10.7431,
shift_fermi=True,
y_range=(-3, 3),
band_mode='normal',
spin=True
)
plot_from_file(
plot_type='fatbands',
band_file='Bandx.dat.gnu',
kpath_file='proj.kpath',
fatband_dir='BBN_pdos',
fatbands_mode='atomic',
fermi_level=-5.3321,
shift_fermi=True,
y_range=(-3,3),
cmap_name='tab10',
spin=True
)
plot_from_file(
plot_type='fatbands',
band_file='BBS.bands.dat.gnu',
kpath_file='BBS.kpath',
fatband_dir='BBS_pdos',
fatbands_mode='element_orbital',
fermi_level=10.7431,
shift_fermi=True,
cmap_name='magma',
weight_threshold=0.05,
s_max=300,
s_min=2,
spin=True
)
plot_from_file(
plot_type='fatbands',
band_file='BBS.bands.dat.gnu',
kpath_file='BBS.kpath',
fatband_dir='BBS_pdos',
fatbands_mode='o_orbital',
fermi_level=10.7431,
shift_fermi=True,
dual=False,
highlight_channel=('p',),
spin=True
)
plot_from_file(
plot_type='fatbands',
band_file='BBS.bands.dat.gnu',
kpath_file='BBS.kpath',
fatband_dir='BBS_pdos',
fatbands_mode='o_element_orbital',
fermi_level=10.7431,
shift_fermi=True,
dual=True,
highlight_channel=('Bi1-p','O8-p'),
spin=True
)
plot_from_file(
plot_type='band',
band_file='BBS.bands.dat.gnu',
kpath_file='BBS.kpath',
fatband_dir='BBS_pdos',
band_mode='atomic',
spin=True
)
plot_from_file(
plot_type='overlay_band',
band_file='MMS.bands.dat.gnu',
kpath_file='MMS.kpath',
band_file2='MMN.bands.dat.gnu',
kpath_file2='MMN.kpath',
label1='MoS2 Bulk Spin',
label2='MoS2 Bulk Non-Spin',
shift_fermi=True,
color1='blue',
color2='red'
)
plot_from_file(
plot_type='fatbands',
band_file='Bandx.dat.gnu',
kpath_file='proj.kpath',
fatband_dir='BBN_pdos',
fatbands_mode='layer',
layer_assignment={'Mo2':'bottom', 'S3':'top', 'S4':'bottom', 'S5':'top'},
shift_fermi=True,
spin=True
)
plot_from_file(
plot_type='fatbands',
band_file='BBS.bands.dat.gnu',
kpath_file='BBS.kpath',
fatband_dir='BBS_pdos',
fatbands_mode='heat_atomic',
shift_fermi=True,
heat_vmax=40,
heat_vmin=0,
highlight_channel=('Bi',),
spin=True
)
plot_from_file(
plot_type='fatbands',
band_file='W-W.AA.bands.dat.gnu',
kpath_file='W-W.AA.kpath',
fatband_dir='W-W.AA_pdos',
fatbands_mode='element_orbital',
sub_orb=True,
spin=False
)
- Computes direct/indirect band gap
- Locates VBM and CBM high-symmetry points
- Automatically detects stacking type (AA, AB, AAβ²)
- Calculates all vertical and 3D distances from QE
ibrav
input
- Converts
proj.out
to QEPlotter-compatible.pdos
files - Supports j-split orbitals
- Fully supports SOC and spin
- β‘ Automated: No manual editing of QE files
- π― Precise: Detects and visualizes fine structural details
- π Flexible: Works for bulk, 2D, and heterostructures
- π§© Modular: Easy integration with ML pipelines
QEPlotter/
βββ qeplotter/
β βββ __init__.py
β
β βββ qep.py
βββ saved/
βββ requirements.txt
βββ README.md
MIT Β© shubics