Plot absorption and fluorescence spectra from ORCA output files, experimental data, and much more.
A Python 3 package for plotting optical spectra with peak detection and annotation. It combines the stick spectrum with the convoluted spectrum (lorentzian or gaussian line shape). The package supports energy (wave number or electron-volt, cm-1 or eV) and wavelength (λ, nm) plots. The full spectrum or parts of the spectrum can be plotted.
Supported data types:
- TD-DFT (
.out): absorption and fluorescence from ORCA time-dependent density functional theory calculations - ESD (
.spectrum): absorption and fluorescence from ORCA excited state dynamics module - ESD roots (
.spectrum.rootX): individual root contributions from ESD - Experimental (
.asc): experimental spectra loaded as wavelength/intensity pairs - IR (
.out): harmonic IR spectra from ORCA frequency calculations (auto-detected) - Raman (
.out): Raman spectra from ORCA frequency calculations (auto-detected) - VPT2 (
.out): anharmonic VPT2-corrected IR spectra with overtones and combination bands (auto-detected)
pip install .spectroplot [OPTION] filenameor
python3 -m spectroplot [OPTION] filenameIt will save the plot as SVG: spectrum.svg
# TD-DFT absorption in nm
spectroplot data/TD-DFT/UV_c60-Ih.out -s -n -pnm# TD-DFT + experimental overlaid
spectroplot data/TD-DFT/UV_c60-Ih.out data/experimental/C60.asc -s -n# ESD fluorescence in nm with Gaussian lineshape
spectroplot data/ESD/FLUOR/lw100/FLUOR_c60-Ih_esd.spectrum -s -n --lineshape_gauss# ESD absorption in eV (all roots, 3-8 eV range)
spectroplot data/ESD/ABS/ABS_pyrene_esd.spectrum.root* -s -n --plotev -x0 3 -x1 8# PL spectrum
spectroplot data/experimental/C60_PL.asc -s -n -PL# Experimental Raman spectrum
spectroplot data/experimental/C90-raman.asc -s -n -Raman# Custom output as PNG
spectroplot data/TD-DFT/UV_c60-Ih.out -o spectrum.png# Harmonic IR spectrum
spectroplot data/IR/FRQ_tungsten_hexacarbonyl_f.out -s -n# VPT2 anharmonic IR spectrum with overtones and combination bands
spectroplot data/VPT2/VPT2_furan_vpt2.out -s -n -x0 0 -x1 6500# Raman spectrum
spectroplot data/Raman/RAM_c60-Ih_r.out -s -n -x0 200 -x1 1650filename, required: filename (.out, .asc, .spectrum, .spectrum.rootX)-s, optional: shows thematplotlibwindow-n, optional: do not save the spectrum-acs, optional: format the plot to ACS publications standard format-ostr, optional: output filename (.svgdefault, supports.png/.pdf)-pnm, optional: plot the wavelength (λ, nm) spectrum-pwn, optional: plot the wave number (energy, cm-1) spectrum (default)-pev, optional: plot the electron-volt (energy, eV) spectrum-lsg, optional: use the gaussian line shape function (default is lorentzian line shape)-IR, optional: label experimental data as IR spectrum (changes y-axis label)-ABS, optional: label experimental data as absorption spectrum (changes y-axis label)-Raman, optional: label experimental data as Raman spectrum (changes y-axis label)-PL, optional: use the PL Intensity y-axis label (default is Absorbance)-wnmN, optional: line width of the line shape for the nm scale (default isN = 20)-wwnN, optional: line width of the line shape for the cm-1 scale (default isN = 1000)-wevN, optional: line width of the line shape for the eV scale (default isN = 0.1)-x0N, optional: start spectrum at N nm or N cm-1 (x0 => 0)-x1N, optional: end spectrum at N nm or N cm-1 (x1 => 0)-y1N, optional: end statically spectrum at N arb. units (y1 => 0)-swnN, optional: shift the spectrum by N cm-1 (default isN = 0)-sevN, optional: shift the spectrum by N eV (default isN = 0)
There are numerous ways to configure the spectrum.
Check # plot config section - configure here in src/spectroplot/global_constants.py.
You can even configure the script to plot of the single line shape functions.
The SVG file will be replaced every time you run the script with the same output name. For TD-DFT data, the absorption spectrum is taken from the section "ABSORPTION SPECTRUM VIA TRANSITION ELECTRIC DIPOLE MOMENTS" in the ORCA output.
numpypandasmatplotlibseabornscipy
Contributed by Emmanuel Bourret
Based on orca_uv by Sebastian Dechert
- Change the line color/style when the same type of data type is plotted multiple times.
- Add transmittance mode (-tr/--transmittance) for IR/Raman/VPT2 spectra.
- Use specific unit labels per data type (e.g., IR in % transmittance, Raman in counts) instead of "arb. units". Add
-arbflag to fall back to arbitrary units. Add double y-axis support or auto-switch to arbitrary units when incompatible types are plotted together.









