Skip to content

Repository files navigation

spectroplot

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)

Install

pip install .

Quick start

spectroplot [OPTION] filename

or

python3 -m spectroplot [OPTION] filename

It will save the plot as SVG: spectrum.svg

Examples

# TD-DFT absorption in nm
spectroplot data/TD-DFT/UV_c60-Ih.out -s -n -pnm

TD-DFT absorption

# TD-DFT + experimental overlaid
spectroplot data/TD-DFT/UV_c60-Ih.out data/experimental/C60.asc -s -n

TD-DFT + experimental

# ESD fluorescence in nm with Gaussian lineshape
spectroplot data/ESD/FLUOR/lw100/FLUOR_c60-Ih_esd.spectrum -s -n --lineshape_gauss

ESD fluorescence

# 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

ESD absorption roots

# PL spectrum
spectroplot data/experimental/C60_PL.asc -s -n -PL

PL spectrum

# Experimental Raman spectrum
spectroplot data/experimental/C90-raman.asc -s -n -Raman

Experimental Raman spectrum

# Custom output as PNG
spectroplot data/TD-DFT/UV_c60-Ih.out -o spectrum.png

Custom PNG output

# Harmonic IR spectrum
spectroplot data/IR/FRQ_tungsten_hexacarbonyl_f.out -s -n

IR spectrum

# VPT2 anharmonic IR spectrum with overtones and combination bands
spectroplot data/VPT2/VPT2_furan_vpt2.out -s -n -x0 0 -x1 6500

VPT2 spectrum

# Raman spectrum
spectroplot data/Raman/RAM_c60-Ih_r.out -s -n -x0 200 -x1 1650

Raman spectrum

Command-line options

  • filename , required: filename (.out, .asc, .spectrum, .spectrum.rootX)
  • -s , optional: shows the matplotlib window
  • -n , optional: do not save the spectrum
  • -acs , optional: format the plot to ACS publications standard format
  • -o str , optional: output filename (.svg default, 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)
  • -wnm N , optional: line width of the line shape for the nm scale (default is N = 20)
  • -wwn N , optional: line width of the line shape for the cm-1 scale (default is N = 1000)
  • -wev N , optional: line width of the line shape for the eV scale (default is N = 0.1)
  • -x0 N , optional: start spectrum at N nm or N cm-1 (x0 => 0)
  • -x1 N , optional: end spectrum at N nm or N cm-1 (x1 => 0)
  • -y1 N , optional: end statically spectrum at N arb. units (y1 => 0)
  • -swn N , optional: shift the spectrum by N cm-1 (default is N = 0)
  • -sev N , optional: shift the spectrum by N eV (default is N = 0)

Script options

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.

Remarks

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.

Requirements

  • numpy
  • pandas
  • matplotlib
  • seaborn
  • scipy

Contributor

Contributed by Emmanuel Bourret

Based on orca_uv by Sebastian Dechert

TO DO

Planned features

  • 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 -arb flag to fall back to arbitrary units. Add double y-axis support or auto-switch to arbitrary units when incompatible types are plotted together.

About

Plot optical spectra from ORCA output files (TD-DFT, IR, Raman, VPT2, ESD), and experimental data.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages