9

I am trying to represent the difference between the an anharmonic and harmonic treatment of vibrations. The easiest way to do this is to present an example of a harmonic and anharmonic potential energy surface (PES).

I would like to present a figure similar to the one attached below (from Herzberg),$^1$ where we have the morse oscillator function presented with the vibrational energy levels indicated.

Anharmonic PES of HCl with vibrational levels indicated by horizontal lines

I have some spectroscopic data from an undergraduate experiment I did about $\ce{I2}$, and have the data points (or the equation) to draw the PES, and the energies of the vibrations in order to plot their values.

Is there any software which is able to generate something like this for me, or are there any tricks people know where this can be done in other graphing software (preferably Excel or Igor Pro)? The difference between the spacing of each successive overtone in an experimental vs. harmonic spectrum is part of the explanation, so it's important to illustrate that in the figure, if at all possible.

EDIT I have since come across a Python script which will do the job (see answer below); however, I'm sure that other ways to generate these diagrams that people know would be appreciated (particularly for people who do not know much about Python, such as myself...)!

  1. G. Herzberg, Spectra of Diatomic Molecules, Krieger Publishing Company, Malabar, Florida, Reprint edn., 1989.
isolated matrix
  • 492
  • 1
  • 11
  • 1
    In general, this is most easy using software like R or python, but in Excel you can do it in the following way: Assume column A contains $r$ values and column B contains your potential values $V(r)$. Using =IF($B1>En0, NA(), En0) for the values in column C where En0 is your first energy. Use the other columns for the additional eigenvalues and plot with Scatter. – Paul Jul 10 '23 at 10:59
  • @Paul what do you mean by my 'first energy'? Do you mean the first vibration (i.e. $\upsilon = 1$)? – isolated matrix Jul 10 '23 at 13:56
  • @isolated_matrix, could be any vibration (note that vibrations with $v=0$ also exist). The cell formula only provides a plottable result if the potential energy is lower than the eigenenergy so that the horizontal level energies are bounded by the potential. – Paul Jul 10 '23 at 16:55
  • @Paul so, if I understand this right, I would actually not only need a column C, but also columns D, E, F, etc., so that each vibration has its own column? – isolated matrix Jul 10 '23 at 17:11
  • 1
    Perhaps the question is suitable for mattermodelling.se (example). – Buttonwood Jul 10 '23 at 20:22
  • @isolatedmatrix indeed, every level requires its own column. – Paul Jul 10 '23 at 20:31
  • 1
    @Buttonwood that did occur to me;I saw that exact post on this exchange, and a similar comment on that, but that comment also said it would be appropriate on either exchange (assume we call these different 'topics' exchanges?). I also thought it would be something relatively common in chemistry, which is why I'm so surprised there are no programs which do it automatically! – isolated matrix Jul 11 '23 at 06:56
  • 1
    @Buttonwood I don't think it fits there. The question is about how to draw a Morse potential from experimental values. This should have all the information you need: https://chem.libretexts.org/Courses/Duke_University/CHEM310L_-_Physical_Chemistry_I_Lab_Manual/05%3A_Molecular_Spectroscopy_of_Iodine/5.03%3A_Potential_Energy_Curves – Martin - マーチン Jul 12 '23 at 00:30
  • https://pubs.acs.org/doi/10.1021/ed051p282 I'm sure you'll find a copy of that somewhere. Oh, and you can use any program that can draw a function. I recommend gnuplot for science stuff. – Martin - マーチン Jul 12 '23 at 00:33
  • I wrote a program that generated the figure here: https://mattermodeling.stackexchange.com/a/1005/5 and you can see some more examples here: https://arxiv.org/pdf/1509.07041.pdf I would have to find it to post it here. – user1271772 Jul 12 '23 at 03:46
  • @user1271772 that is perfect, and exactly what I am looking for! If you can find it, and post it as an answer, I’d definitely accept it – isolated matrix Jul 13 '23 at 05:12
  • @Buttonwood I have all of that information, I know about the Morse potential, etc. – isolated matrix Jul 13 '23 at 05:15
  • @Martin-マーチン I actually came across that article (I was looking for articles on anharmonicity because I don’t understand perturbation theory as well as I would like), but I’ve got all the data I need ($\omega_e$ and $\omega_e x_e$, etc.). I will look up gnuplot (although I was hoping to avoid a command-line based program, if I could avoid it) – isolated matrix Jul 13 '23 at 05:19
  • @isolatedmatrix by when do you need this? – user1271772 Jul 13 '23 at 07:02
  • @user1271772 Don't worry about it – I found a python script which will do the job – isolated matrix Jul 13 '23 at 07:34

2 Answers2

11

I have made this basic python 3 script which runs in a Jupyter notebook (or in Visual Studio Code). With different molecules you will need to adjust the plot scale. The first 10 levels are plotted then every third one. You can adjust all this.

The code plots the potential, energy levels and wavefunctions.

# import all python add-ons etc that will be needed later on 
%matplotlib inline.  # for jupyter notebook only
import numpy as np
import matplotlib.pyplot as plt
from scipy.special import eval_genlaguerre   #associate Laguerre polynom
init_printing()  
plt.rcParams.update({'font.size': 14})   # set font size for plots

HCl and Iodine

Assoc Laguerre polys & Morse potential. n is quantum number

wavefunct not normalised

fig = plt.figure(figsize=(5,5))

hbar = 1.05449e-34 # Js/2pi c = 2.9979e8 # m/s nm = 1.0e-9 # nanometres amu = 1.66043e-27 # atomic mass unit

mol = 1

if mol == 0:

m1   = 127            # iodine
m2   = 127
we   = 128.0          # frequency cm^{-1}
xewe = 0.834          # anharmionicity no units 
reB  = 0.3016         # equilib bond length nm
xm1  = 2              # used to limit plot length
xm0  =0.8

else: m1 = 1 # HCl m2 = 35 we = 2989.7 # frequency cm^{-1} xewe = 52.05 # anharmionicity no units reB = 0.123746 # equilib bond length nm xm1 = 3.5 xm0 = 0.5

mass = m1*m2/(m1 + m2) # reduceD mass

fac3 = hbar/(amu2np.pi100cnm*2) # factor to get constants sorted

DeqB = we*2/(4.0xewe) # Morse dissn energy cm^{-1}

k = 4.0DeqB/we
beta = we
np.sqrt(mass/(2.0fac3DeqB)) # 1/nm

d = k/2.0
zeta = lambda x: np.exp(-betax)
psi = lambda n,x : np.exp(-zeta(x)
k/2.0)
np.exp(-beta
x(k-2.0n-1.0)/2.0)eval_genlaguerre(n,(k-2n-1),k*zeta(x))

En = lambda n: we(n+0.5)-xewe(n+0.5)**2 # energy levels cm^{-1} nm = 0 while En(nm + 1) > En(nm): nm = nm + 1 print('max Q number',nm)

V = lambda x: DeqB(1-np.exp(-betax) )**2 # Morse potential cm^{-1}

xm = lambda E: -np.log(1-np.sqrt(E/DeqB) )/beta+reB # find limits of potential xp = lambda E: -np.log(1+np.sqrt(E/DeqB) )/beta+reB

x = np.linspace(xm0reB, xm1reB, 500) # nm

for n in range(11): # plot first 10 levels E0 = En(n) n0 = max(abs(psi(n,x-reB)) )*3/we # normalise on plot plt.plot([xm(E0),xp(E0)],[E0,E0],color='red',linewidth=0.5) plt.plot(x,psi(n,x-reB)/n0+E0,linewidth=1,color='grey') plt.text(x[-1],E0,str(n),fontsize=10)

for n in range(11, nm, 3): # plot some higher q number wavefunctions gaps of 3 E0 = En(n) n0 = max(abs(psi(n,x-reB)) )*3/we # normalise on plot plt.plot([xm(E0),xp(E0)],[E0,E0],color='red',linewidth=0.5) plt.plot(x,psi(n,x-reB)/n0+E0,linewidth=1,color='grey') plt.text(x[-1],E0,str(n),fontsize=10)

plt.plot(x,V(x-reB),color='blue',linewidth=1) plt.axhline(DeqB,linewidth=1,color='red') plt.ylim([0,1.05*DeqB]) plt.xlim([x[0],x[-1]]) plt.xlabel(r'$r; /; nm$') plt.ylabel(r'$Energy; /;cm^{-1}$')

plt.tight_layout() plt.show()

An example plot is shown below

HCl morse

porphyrin
  • 30,319
  • 1
  • 57
  • 86
6

I have come across two Python scripts which will do the job, written by Christian Hill. The links to them are:

Visualizing vibronic transitions in a diatomic molecule

The Morse oscillator

For example, here is a diagram for the $\ce{O2}$ PES generated by one of the codes linked above (I edited it slightly to remove the wave functions which you can overlay on the vibrational levels): PES of O2 molecule

They are not exactly what I was looking for (the curve could extend a little further towards the lower $r$ values to show how the energy keeps increasing beyond the dissociation energy), but it does plot the vibrational transitions the way I want.

Martin - マーチン
  • 44,013
  • 13
  • 159
  • 319
isolated matrix
  • 492
  • 1
  • 11