ParticleInBox-Dyes - Maple Help

A Particle in a Symmetric Box: With Applications to UV/Vis Spectroscopy

 Overview While early theories that quantized energies of light and matter were able to reproduce results of these early experiments, they did not explain why energy was quantized.   De Broglie provided a glimpse into the source of quantization in describing the wave-particle duality of light and matter.  If matter were to behave like a wave, then there must be a wave-equation for matter! This activity introduces the wave-equation for matter, known as Schrodinger equation, and the simplest ideal system: a particle in symmetric box.   In this chapter, you will explore two hallmarks of quantum mechanics: discrete allowed energy levels and the probabilistic motion of matter, in stark contrast to classical mechanics with its continuous energies and deterministic trajectories.   How can these seemingly contradictory behaviors of matter both be true?  To answer this question, you will explore the concept of the Bohr correspondence principle, which says that as system size or energy increases, a quantum system will approach classical behavior.  To illustrate this concept, consider the simplest of all quantum systems: a particle of mass m in a one-dimensional symmetrical box of length L.     The potential energy term for this system is described by V(x) = $\left\{\begin{array}{cc}0& -\frac{L}{2} and the time-independent Schrodinger equation is given by The solutions to this equation are given by and $\mathrm{ψ}n\left(x\right)=\sqrt{\frac{2}{L}}\mathrm{sin}\left(\frac{\mathrm{nπx}}{L}+\frac{\mathrm{nπ}}{2}\right).$     In the Interactive Concepts section below, you will explore the behavior of En and as m, L, and n increase.  Despite its simplicity, this model can be used to describe translational motion of ideal gases, for example.  In the Applications to Chemistry section, you will also see that the particle in a box can be used to model π-electrons in conjugated compounds!

Interactive Concepts

Discrete Energy Levels, Density of States, and the Bohr Correspondence Principle



In this section, you will explore the energies of the particle in a 1D Box, which are given by

(1)

where n = 1, 2, 3, ....  In particular, you will see how En depends on the length of the box, L, and the particle mass, m.  From the Equation (1), it is clear that as L increases, En decreases. Likewise for m.

It may be more instructive to see how the energy levels change. For this, you will make use of the plot function in Maple to visualize the density of states as a function of L and m. The density of states is related to the number of allowed energy levels that exist in a given energy range and is important in how energy is distributed throughout the system. For classical systems with a continuum of energy levels, the density of states is essentially infinite, meaning any energy is allowed in a given energy range.   However, for quantum systems, such as atoms and molecules with a discrete energy manifold, the density of states is finite.  This begs the question: when does a particle behave classically or quantum mechanically?

To answer this question, consider the simplest quantum particle, the particle in a box, and begin by looking at the effect of increasing m and L.  In the Maple Input provided below, enter any positive real value for m and for L to see how the energy levels of the particle in a box are affected.   [Note: To avoid the hassle of thinking in such small magnitudes , we use 'atomic units', whose magnitudes are on the order of unity.  In atomic units, Z = 1, the unit for length is the Bohr radius, a0, and the unit for mass is the mass of the electron, me.  Therefore, a length of L = 2 is actually 2 a0, or 1.058×10-31 m.  Likewise, a mass of m = 2 is actually 2 ⋅ (9.11×10-31kg),  or 1.822×10-30 kg The unit for energy is the Hartree, EH.]

 >
 >
 ${L}{≔}{1}$ (2.1.1)
 >
 ${m}{≔}{1}$ (2.1.2)

Now, the next set few lines of Maple input will create a plot of the energies (in atomic units) of the particle in a box up to a maximum energy:

 >
 ${E}{≔}\left({n}{,}{L}\right){↦}\frac{{{n}}^{{2}}}{{8}{\cdot }{m}{\cdot }{{L}}^{{2}}}$
 ${\mathrm{Emax}}{≔}{10}$

Now increase L and m in the Maple input above to see how the density of states changes as each increases.  What do you notice?  What happens to the density of states as m and L increase?

 Answer What we see is a demonstration of the Bohr correspondence principle, which says that as the size or energy of a quantum system increases, it approaches the behavior of a classical system.   For example, for a small m and L, the spacing between energy levels is relatively large, and the discrete nature of the quantum system is clearly evident.  But as m and L increase, the spacing between adjacent energy levels decreases, and for large enough m or L, the system appears to be more classical with 'all' energies being possible!

Wavefunctions for the Particle in a Box

In the section above, you saw a terrific illustration of the Bohr correspondence principle in seeing the density of states for the particle in a box increase with increasing m and L.  Another hallmark of quantum mechanics is the interpretation of the wavefunction as a probability amplitude for finding the particle at a given value of x. Now, you will again consider the correspondence principle as you look at the wavefunctions and the resulting probability density for a particle in a 1D symmetrical box.  For the potential

V(x) = $\left\{\begin{array}{cc}0& -\frac{L}{2}

the resulting wavefunctions are given by

where n = 1, 2, 3, ....  The corresponding probability density then is given by

In the Maple input below, you will plot the ψ*ψ for a particle in a box with L = 1.  Use the slide bar to change the value of n and answer the discussion questions.



 > $\mathrm{restart}:\mathrm{with}\left(\mathrm{plots}\right):$
 >
 ${\mathrm{\psi }}{≔}\left({n}{,}{x}\right){↦}\sqrt{{2}}{\cdot }{\mathrm{sin}}{}\left({n}{\cdot }{\mathrm{\pi }}{\cdot }{x}{+}\frac{{1}}{{2}}{\cdot }{n}{\cdot }{\mathrm{\pi }}\right)$ (2.2.1)
 > $\mathrm{Explore}\left(\mathrm{plot}\left({\left(\sqrt{2}\mathrm{sin}\left(⌊n⌉\mathrm{\pi }x+\frac{⌊n⌉\mathrm{\pi }}{2}\right)\right)}^{2},x=-0.5..0.5,\mathrm{numpoints}=500,\mathrm{labels}=\left[x,""\right]\right),'\mathrm{parameters}'=\left[n=1..100\right],'\mathrm{initialvalues}'=\left[n=1.00000000\right]\right);$

$\mathbf{n}$

For n = 1, what do you notice?  Is the probability for finding the particle a constant, as in the classical analogue?

 Answer No, a maximum probability is seen in the center of the box!  Very non-classical behavior!

For n = 2, what do you notice?

 Answer There is a maxima at x = ± L/4 and a node in the center of the box where the probability for finding the particle is zero!  That is, one will  never find a particle in state n = 2 at the center of the box!! Even more non-classical behavior!!

What happens as energy of the system increases even further?

 Answer n maxima and (n - 1) nodes are evenly distributed throughout the box.

What happens as n goes to 10, 20, 30, 40, 50, ..., 100?

 Answer As n increases, we see essentially classical behavior with an equal probability for finding the particle at any x, in accord with the Bohr correspondence principle!!

Applications in Chemistry

$\mathrm{π}\to$π* Transitions in Conjugated Dyes: 1D Particle in a Box

Despite its simplicity, the 1D particle in a box model can be used to describe π to π* transitions in conjugated chain compounds, such as β-carotene shown in Figure 1.

 > $\mathrm{QuantumChemistry}:-\mathrm{SkeletalStructure}\left("betacarotene"\right);$

Figure 1: Skeletal structure of the molecule β-carotene which gives carrots their orange color

In such a strongly delocalized system, the potential attraction of the π electrons for the nuclei in the conjugated chain can be considered to be constant. (This is of course an approximation, but as it turns out, it is a rather good one!)  Therefore, the conjugated chain can be thought of as a 1D box in which the π electrons are able to move.  Accordingly, you can use Eqn. (1) from Introductory Concepts to calculate the allowed energy levels of the π electrons:

.          (1)

where ${m}_{e}$ is the mass of the electron.  The only unknown parameter in the above equation is the length of the conjugated chain, L. Based on the average C-C bond length in ethane and ethene, geometric considerations for the zigzag configuration of carbon atoms, and the terminal N atoms, the length of the box can be approximated as

(2)

(Note there are other approximation schemes for determining L that give more accurate results, but the geometric approach is more intuitive).  In a  family of cyanine dyes, which we will study here, the number of π electron pairs in a conjugated chain with a given k is simply

p = k + 3.     (3)

According to the Aufbau and Pauli exclusion principles, the values of n for the HOMO and LUMO are nHOMO = p and nLUMO = p + 1, respectively. The wavelength corresponding to a HOMO-LUMO transition (π - π*) can be calculated by applying the Bohr frequency condition:

(4)

In this activity, you will consider a series of thiacarbocyanine dyes. Table 1 contains a list of  corresponding to k = 0, 1, 2, and 3.  Using Eqns. 2 - 4 and the Maple input prompts below Table 1, calculate the length, L, number of electron pairs, p, and the wavelength corresponding to the π-π* transition, λmax.  The Maple prompts can be reused, each time updating k and recalculating each entry.  Compare the calculated value with experimentally measured λmax from UV/Vis spectroscopy.

Table 1

 k Nomenclature Chemical Formula Structure Length, L (pm) π electron pairs (nHOMO) lmax(PB) (nm) lmax (Exp.) (nm) %Error 0 3,3'-Diethylthiacyanine Iodide C19H19N2S2I  421 1 3,3'-Diethylthiacarbocyanine Iodide C21H21N2S2I  559 2 3,3'-Diethylthiadicarbocyanine Iodide C23H23N2S2I  653 3 3,3'-Diethylthiatricarbocyanine Iodide C25H25N2S2I  763
Table 1

 >
 > $k≔0;$
 ${k}{≔}{0}$ (3.1.1)
 >
 ${L}{≔}{8.16}{}{{10}}^{{-10}}$ (3.1.2)
 > $p≔k+3;$
 ${p}{≔}{3}$ (3.1.3)
 > ${n}_{\mathrm{HOMO}}≔p;$
 ${{n}}_{{\mathrm{HOMO}}}{≔}{3}$ (3.1.4)
 > ${n}_{\mathrm{LUMO}}≔p+1;$
 ${{n}}_{{\mathrm{LUMO}}}{≔}{4}$ (3.1.5)
 >

 ${\mathrm{\lambda }}{≔}{3.136360199}{}{{10}}^{{-7}}$ (3.1.6)

Repeat the above calculations for each of the dyes in Table 1 by specifying the value of k = 0, 1, 2, or 3.

$\mathrm{π}\to$π* Transitions in Conjugated Dyes: QuantumChemistry Package

In this section, you will again calculate the wavelength corresponding to the π-π* transition, but instead of using the particle in a box approximation and a semi-empirical estimation for the length of the box, you will use the Hartree-Fock (HF) method to calculate the electronic structure of each dye.  You will proceed in two ways: you will calculate the HF energy of the ground, singlet state and approximation the transition as being from the HOMO to the LUMO (Method #1), and you will calculate the energy of both the singlet ground state and the excited triplet state to determine the energy gap (Method #2).  Which method do you think will be more accurate?

Table 2.

 Nomenclature lmax (nm) (Exp) lmax (nm) (Method #1) % Error lmax (nm) (Method #2) % Error 3,3'-Diethylthiacyanine 421     3,3'-Diethylthiacarbocyanine 559     3,3'-Diethylthiadicarbocyanine 653     3,3'-Diethylthiatricarbocyanine 763    

Begin by loading the QuantumChemistry package, increasing the precision for accuracy, and reading in the coordinates of the current dye from a file, either "dye1.xyz", "dye2.xyz", "dye3.xyz", or "dye4.xyz":

 > $\mathrm{restart}:\mathrm{with}\left(\mathrm{QuantumChemistry}\right):\mathrm{with}\left(\mathrm{ScientificConstants}\right):\mathrm{Digits}≔15:$
 > $\mathrm{molec}≔\mathrm{ReadXYZ}\left("dye2.xyz"\right);$
 ${\mathrm{molec}}{≔}\left[\left[{"S"}{,}{2.62388500}{,}{-1.49503900}{,}{-0.03405300}\right]{,}\left[{"S"}{,}{-2.62392000}{,}{-1.49509600}{,}{0.03377700}\right]{,}\left[{"N"}{,}{3.69554300}{,}{0.91136800}{,}{-0.14366200}\right]{,}\left[{"N"}{,}{-3.69559200}{,}{0.91130300}{,}{0.14339200}\right]{,}\left[{"C"}{,}{4.80523900}{,}{0.03234200}{,}{-0.13217500}\right]{,}\left[{"C"}{,}{-4.80521600}{,}{0.03232200}{,}{0.13200300}\right]{,}\left[{"C"}{,}{2.46658300}{,}{0.31916200}{,}{-0.07542400}\right]{,}\left[{"C"}{,}{-2.46659700}{,}{0.31913500}{,}{0.07528500}\right]{,}\left[{"C"}{,}{3.87538800}{,}{2.38501300}{,}{-0.19299600}\right]{,}\left[{"C"}{,}{-3.87532300}{,}{2.38488700}{,}{0.19316200}\right]{,}\left[{"C"}{,}{4.43839500}{,}{-1.32203900}{,}{-0.08682500}\right]{,}\left[{"C"}{,}{-4.43847000}{,}{-1.32206300}{,}{0.08688300}\right]{,}\left[{"C"}{,}{1.23573400}{,}{0.98086200}{,}{-0.03815400}\right]{,}\left[{"C"}{,}{-1.23577000}{,}{0.98086300}{,}{0.03799200}\right]{,}\left[{"C"}{,}{6.16071300}{,}{0.38676700}{,}{-0.16293600}\right]{,}\left[{"C"}{,}{-6.16070100}{,}{0.38680300}{,}{0.16273700}\right]{,}\left[{"C"}{,}{5.38356300}{,}{-2.34184900}{,}{-0.08182000}\right]{,}\left[{"C"}{,}{-5.38363700}{,}{-2.34186600}{,}{0.08210000}\right]{,}\left[{"C"}{,}{1.00000000}{}{{10}}^{{-6}}{,}{0.33334500}{,}{0.00014600}\right]{,}\left[{"C"}{,}{3.97700900}{,}{3.01519400}{,}{1.20092400}\right]{,}\left[{"C"}{,}{-3.97677900}{,}{3.01557800}{,}{-1.20055700}\right]{,}\left[{"C"}{,}{7.11578500}{,}{-0.63364500}{,}{-0.15695900}\right]{,}\left[{"C"}{,}{-7.11579800}{,}{-0.63358700}{,}{0.15701300}\right]{,}\left[{"C"}{,}{6.73657700}{,}{-1.98449200}{,}{-0.11869300}\right]{,}\left[{"C"}{,}{-6.73665000}{,}{-1.98444800}{,}{0.11897300}\right]{,}\left[{"H"}{,}{4.77655400}{,}{2.57532900}{,}{-0.77987700}\right]{,}\left[{"H"}{,}{3.04255800}{,}{2.80334600}{,}{-0.76246500}\right]{,}\left[{"H"}{,}{-4.77655400}{,}{2.57511300}{,}{0.77998800}\right]{,}\left[{"H"}{,}{-3.04255300}{,}{2.80301300}{,}{0.76287900}\right]{,}\left[{"H"}{,}{1.24429400}{,}{2.06543100}{,}{-0.02895500}\right]{,}\left[{"H"}{,}{-1.24431500}{,}{2.06542700}{,}{0.02832600}\right]{,}\left[{"H"}{,}{6.47555400}{,}{1.42254400}{,}{-0.18421200}\right]{,}\left[{"H"}{,}{-6.47551800}{,}{1.42259000}{,}{0.18389200}\right]{,}\left[{"H"}{,}{5.08418500}{,}{-3.38262400}{,}{-0.04911800}\right]{,}\left[{"H"}{,}{-5.08429400}{,}{-3.38264900}{,}{0.04948700}\right]{,}\left[{"H"}{,}{-0.00001500}{,}{-0.75618600}{,}{0.00057600}\right]{,}\left[{"H"}{,}{4.82418000}{,}{2.60552100}{,}{1.75926900}\right]{,}\left[{"H"}{,}{4.12107700}{,}{4.09659400}{,}{1.10803700}\right]{,}\left[{"H"}{,}{3.06776100}{,}{2.83971500}{,}{1.78440300}\right]{,}\left[{"H"}{,}{-4.82398500}{,}{2.60621900}{,}{-1.75908300}\right]{,}\left[{"H"}{,}{-4.12067800}{,}{4.09697000}{,}{-1.10733300}\right]{,}\left[{"H"}{,}{-3.06754200}{,}{2.84013700}{,}{-1.78406900}\right]{,}\left[{"H"}{,}{8.16737000}{,}{-0.37210700}{,}{-0.18030100}\right]{,}\left[{"H"}{,}{-8.16736800}{,}{-0.37198300}{,}{0.18035500}\right]{,}\left[{"H"}{,}{7.49418500}{,}{-2.75934500}{,}{-0.11477500}\right]{,}\left[{"H"}{,}{-7.49426700}{,}{-2.75929400}{,}{0.11518100}\right]\right]$ (3.2.1)
 > $\mathrm{PlotMolecule}\left(\mathrm{molec}\right);$

Now calculate the ground electronic energy using a Hartree-Fock and a minimal basis set: sto-3g, being sure to specify a charge = +1 and a spin = 0 (singlet).  If desired, you may consider better basis sets or higher levels of electronic structure theory to improve your calculations!

 >
 ${\mathrm{table}}{}\left({\mathrm{%id}}{=}{18446745123914323326}\right)$ (3.2.2)

You can determine the orbital indices of the HOMO and LUMO by looking at the occupation numbers of the molecular orbitals.  Below,  loop over the occupation numbers to find the orbital index of the LUMO, the first orbital with an occupation number of 0. You can then make the approximation to the π-π* energy gap as E[LUMO] - E[HOMO] and calculate the corresponding wavelength.

 > $\mathrm{LUMO_HOMO}≔\mathrm{ground}\left[\mathrm{mo_energy}\right]\left[i\right]-\mathrm{ground}\left[\mathrm{mo_energy}\right]\left[i-1\right];\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}$$\mathrm{wavelength}≔\mathrm{evalf}\left(\frac{\mathrm{Constant}\left(h\right)\cdot \mathrm{Constant}\left(c\right)}{\mathrm{LUMO_HOMO}\cdot 4.35974ⅇ-18\cdot 1eâˆ’9}\right)$;
 ${\mathrm{HOMO}}{≔}{96}$
 ${\mathrm{LUMO}}{=}{97}$
 ${\mathrm{LUMO_HOMO}}{≔}{0.30623651}$
 ${\mathrm{wavelength}}{≔}{148.78500772}$ (3.2.3)

How does this compare to the experimental value or the Particle in a box value?  Repeat

 Answer We see that the energy gap is much too big, giving rise to a peak wavelength that is much too small!

You can visualize the HOMO and LUMO molecular orbitals and compare them with your intuition based on the particle in a box:

 >

Now, let's see if you can improve upon this by calculating the energy of the first excited triplet state using a Hartree-Fock and a minimal basis set: sto-3g.  You can then approximate the π-π* energy gap as E(excited) - E(ground) and calculate the corresponding wavelength. (NOTE:  the QuantumChemistry package defines spin = 2S, so for the first excited state, there two unpaired electrons, so S = 1 and 2S = spin = 2).

 > $\mathrm{excited}≔\mathrm{HartreeFock}\left(\mathrm{molec},\mathrm{charge}=1,\mathrm{spin}=2,\mathrm{basis}="sto-3g"\right);$
 ${\mathrm{table}}{}\left({\mathrm{%id}}{=}{18446745124085983486}\right)$ (3.2.4)
 >
 ${\mathrm{Egap}}{≔}{0.07760502}$ (3.2.5)
 > $\mathrm{wavelength}≔\mathrm{evalf}\left(\frac{\mathrm{Constant}\left(h\right)\cdot \mathrm{Constant}\left(c\right)}{\mathrm{Egap}\cdot 4.35974ⅇ-18\cdot 1eâˆ’9}\right);$
 ${\mathrm{wavelength}}{≔}{587.11927486}$ (3.2.6)

How does this compare to the experimental value or the Particle in a box value?

 Answer The wavelength is much closer to the experimental value and particle in a box approximate value.

Now, repeat these calculations for the other 3 dyes and fill in Table 2!

Although less accurate, did Method #1 follow the correct trend?  What do you notice regarding the accuracy of Method #2 as the length of the chain increases?

 Answer Method 1 did follow the correct trend: as L increases, the peak wavelength also increases. The error in the peak wavelength increases for increasing chain length.  In order to improve accuracy, one could use a higher level of electronic structure theory (coupled cluster or DFT) and a better basis set.

$\mathrm{π}\to$π* Transitions in Porphin: 2D Particle in a Box

Porphin is a heterocyclic compound composed of four pyrrole rings linked by methine bridges (=CH-) (Figure 2a). Substituted porphines comprise a class of compounds known as porphyrins, the best known being the heme cofactor of the hemoglobin protein.  Porphyrins are very stable compounds with 26 π conjugated electrons that absorb strongly in the visible region.

 > $\mathrm{QuantumChemistry}:-\mathrm{SkeletalStructure}\left("porphin"\right);$

Figure 2: Porphin

The π electrons in porphin can be treated as particles in a symmetrical 2D box with length L  ≈ 1nm.   Accordingly, the energy levels of the 2D particle in a box are given by Eqn. (5):

(5)

The energy levels of the symmetrical 2D particle in a box are two-fold degenerate for nx ≠ ny  (Figure 3):

Figure 3:  2D particle in a box energy diagram for 26 π electrons of porphin.

The lowest energy π to π* transition therefore corresponds to the HOMO to LUMO transition, or (2,4) to (3,4). Applying the Bohr frequency condition, the wavelength corresponding to a transition is given by

(6)

 >
 > $L≔10eâˆ’10$
 ${L}{≔}{1.00000000}{}{{10}}^{{-9}}$ (3.3.1)
 > $n\left[1,x\right]≔4$
 ${{n}}_{{1}{,}{x}}{≔}{4}$ (3.3.2)
 > $n\left[1,y\right]≔2$
 ${{n}}_{{1}{,}{y}}{≔}{2}$ (3.3.3)
 > $E\left[1\right]≔\frac{\left(n{\left[1,x\right]}^{2}+n{\left[1,y\right]}^{2}\right)\cdot \mathrm{Constant}{\left(h\right)}^{2}}{8\cdot \mathrm{Constant}\left(m\left[e\right]\right)\cdot {L}^{2}}$
 ${{E}}_{{1}}{≔}\frac{{2.50000000}{}{{10}}^{{18}}{}{{\mathrm{Constant}}{}\left({h}\right)}^{{2}}}{{\mathrm{Constant}}{}\left({{m}}_{{e}}\right)}$ (3.3.4)
 > $n\left[2,x\right]≔5$
 ${{n}}_{{2}{,}{x}}{≔}{5}$ (3.3.5)
 > $n\left[2,y\right]≔1$
 ${{n}}_{{2}{,}{y}}{≔}{1}$ (3.3.6)
 > $E\left[2\right]≔\frac{\left(n{\left[2,x\right]}^{2}+n{\left[2,y\right]}^{2}\right)\cdot \mathrm{Constant}{\left(h\right)}^{2}}{8\cdot \mathrm{Constant}\left(m\left[e\right]\right)\cdot {L}^{2}}$
 ${{E}}_{{2}}{≔}\frac{{3.25000000}{}{{10}}^{{18}}{}{{\mathrm{Constant}}{}\left({h}\right)}^{{2}}}{{\mathrm{Constant}}{}\left({{m}}_{{e}}\right)}$ (3.3.7)
 > $\mathrm{dE}≔E\left[2\right]-E\left[1\right]$
 ${\mathrm{dE}}{≔}\frac{{7.50000000}{}{{10}}^{{17}}{}{{\mathrm{Constant}}{}\left({h}\right)}^{{2}}}{{\mathrm{Constant}}{}\left({{m}}_{{e}}\right)}$ (3.3.8)
 > $\mathrm{λ}≔\mathrm{evalf}\left(\frac{\mathrm{Constant}\left(h\right)\cdot \mathrm{Constant}\left(c\right)}{\mathrm{dE}}\right)$
 ${\mathrm{\lambda }}{≔}{5.49531265}{}{{10}}^{{-7}}$ (3.3.9)
 >
 ${18197.32677505}$ (3.3.10)
 > 

How well did this transition compare to the UV/Vis plot in Figure 3?

$\mathrm{π}\to$π* Transitions in Porphin: QuantumChemistry Package

In this section, you will use the Hartree-Fock method to calculate the peak wavelength of Porphin, similar to the approach you used above for the conjugated dyes.

 > $\mathrm{with}\left(\mathrm{QuantumChemistry}\right):\mathrm{with}\left(\mathrm{ScientificConstants}\right):\mathrm{Digits}≔15:$
 >
 ${\mathrm{molec}}{≔}\left[\left[{"N"}{,}{-1.62058500}{,}{-1.35841100}{,}{-0.00004500}\right]{,}\left[{"N"}{,}{1.62042400}{,}{-1.35852600}{,}{-0.00009500}\right]{,}\left[{"N"}{,}{-1.57898000}{,}{1.33345500}{,}{0.00027900}\right]{,}\left[{"N"}{,}{1.57912800}{,}{1.33329300}{,}{-0.00026600}\right]{,}\left[{"C"}{,}{-1.27247000}{,}{-2.69668000}{,}{0.00024100}\right]{,}\left[{"C"}{,}{1.27217700}{,}{-2.69676300}{,}{0.00031100}\right]{,}\left[{"C"}{,}{-3.00281900}{,}{-1.21613100}{,}{-0.00051500}\right]{,}\left[{"C"}{,}{3.00267300}{,}{-1.21642300}{,}{-0.00028500}\right]{,}\left[{"C"}{,}{-0.00016600}{,}{-3.27300100}{,}{0.00055400}\right]{,}\left[{"C"}{,}{-2.51334300}{,}{-3.43612200}{,}{0.00013200}\right]{,}\left[{"C"}{,}{2.51294900}{,}{-3.43634000}{,}{0.00024600}\right]{,}\left[{"C"}{,}{-3.55872200}{,}{-2.54069000}{,}{-0.00034400}\right]{,}\left[{"C"}{,}{3.55842900}{,}{-2.54101500}{,}{0.00016400}\right]{,}\left[{"C"}{,}{-3.63768700}{,}{0.02511200}{,}{-0.00061100}\right]{,}\left[{"C"}{,}{3.63773300}{,}{0.02474200}{,}{-0.00044500}\right]{,}\left[{"C"}{,}{-2.95501700}{,}{1.24875700}{,}{-0.00024700}\right]{,}\left[{"C"}{,}{2.95521500}{,}{1.24846000}{,}{-0.00035900}\right]{,}\left[{"C"}{,}{-1.27258700}{,}{2.67294600}{,}{0.00036400}\right]{,}\left[{"C"}{,}{1.27286200}{,}{2.67274100}{,}{0.00017600}\right]{,}\left[{"C"}{,}{0.00017500}{,}{3.25342200}{,}{0.00036700}\right]{,}\left[{"C"}{,}{-3.55030400}{,}{2.58382300}{,}{-0.00002800}\right]{,}\left[{"C"}{,}{3.55059000}{,}{2.58346400}{,}{-0.00045100}\right]{,}\left[{"C"}{,}{-2.50983200}{,}{3.46576200}{,}{0.00046900}\right]{,}\left[{"C"}{,}{2.51016700}{,}{3.46547700}{,}{0.00019800}\right]{,}\left[{"H"}{,}{-0.00017100}{,}{-4.35835700}{,}{0.00090700}\right]{,}\left[{"H"}{,}{-1.06231600}{,}{-0.49153600}{,}{0.00028100}\right]{,}\left[{"H"}{,}{1.06235700}{,}{-0.49148500}{,}{0.00004000}\right]{,}\left[{"H"}{,}{-2.57314000}{,}{-4.51439200}{,}{0.00038500}\right]{,}\left[{"H"}{,}{2.57252600}{,}{-4.51461900}{,}{0.00038400}\right]{,}\left[{"H"}{,}{-4.61490100}{,}{-2.76464200}{,}{-0.00062200}\right]{,}\left[{"H"}{,}{4.61460100}{,}{-2.76500800}{,}{0.00017400}\right]{,}\left[{"H"}{,}{-4.72223800}{,}{0.03505700}{,}{-0.00090700}\right]{,}\left[{"H"}{,}{4.72228200}{,}{0.03449200}{,}{-0.00050400}\right]{,}\left[{"H"}{,}{0.00026800}{,}{4.34141600}{,}{0.00063100}\right]{,}\left[{"H"}{,}{-4.60947300}{,}{2.79979000}{,}{-0.00015400}\right]{,}\left[{"H"}{,}{4.60975700}{,}{2.79940900}{,}{-0.00066000}\right]{,}\left[{"H"}{,}{-2.55314700}{,}{4.54611800}{,}{0.00079700}\right]{,}\left[{"H"}{,}{2.55354400}{,}{4.54583900}{,}{0.00050700}\right]\right]$ (3.4.1)
 > $\mathrm{PlotMolecule}\left(\mathrm{molec}\right);$

Now, calculate the ground electronic energy using Hartree-Fock and a minimal basis set, sto-3g, or for better results, using DFT and a 6-31G basis.

 >
 ${\mathrm{table}}{}\left({\mathrm{%id}}{=}{18446745124380869086}\right)$ (3.4.2)

Determine the orbital indices of the HOMO  by looking at the occupation numbers of the molecular orbitals.  Below, we provide a loop over the occupation numbers to find the orbital index of the LUMO, the first orbital with an occupation number of 0. You can then make our approximation to the π-π* energy gap as E[LUMO] - E[HOMO] and calculate the corresponding wavelength.

 > $\mathrm{LUMO_HOMO}≔\mathrm{ground}\left[\mathrm{mo_energy}\right]\left[i\right]-\mathrm{ground}\left[\mathrm{mo_energy}\right]\left[i-1\right];\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}$$\mathrm{wavelength}≔\mathrm{evalf}\left(\frac{\mathrm{Constant}\left(h\right)\cdot \mathrm{Constant}\left(c\right)}{\mathrm{LUMO_HOMO}\cdot 4.35974ⅇ-18\cdot 1eâˆ’9}\right)$;
 ${\mathrm{HOMO}}{≔}{81}$
 ${\mathrm{LUMO}}{=}{82}$
 ${\mathrm{LUMO_HOMO}}{≔}{0.25735441}$