ParticleInBox-Dyes - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim

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

Copyright (c) RDMCHEM LLC 2019



Interactive Concepts

Applications in Chemistry




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) = 0L2<x<L2else&comma;

and the time-independent Schrodinger equation is given by

&hslash;22 md2dx2&psi;x &plus;Vx&psi;x &equals; E&psi;x&period;

The solutions to this equation are given by

En&equals;n2h28 mL2





In the Interactive Concepts section below, you will explore the behavior of En and ψnx 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


 En&equals;n2h28 mL2         (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.]  


restart &colon; withplots&colon; withLinearAlgebra&colon; withScientificConstants&colon;

L1&semi;     &num; Enter length of box in atomic units



m1&semi;    &num; Enter mass of particle in atomic units 




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:


En&comma;Ln2 8 mL2&semi; Emax10&semi;for n from 1 by 1 while En&comma;LEmax  do  end do &colon;nn1&colon;MEVectorn&comma;1&comma;nEn&comma;L &colon;MLVectorn&comma;1&comma;nL &colon;AplotEmax&comma;x&equals;0..2 L&comma;y&equals;0..Emax&comma; tickmarks&equals;0&comma;0 &colon;BplotML&comma;ME&comma; symbolsize&equals;15&comma; style&equals;point&comma;symbol&equals;circle&comma;color&equals;Blue&colon;plotsdisplayA&comma;B




     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?  


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) = 0L2<x<L2else&comma;


the resulting wavefunctions are given by

&psi;x&equals;2Lsinn&pi;xL&plus;n&pi;2 &comma;


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

&psi;&ast;x&psi;x&equals;2L sin2n&pi;xL&plus;n&pi;2


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.



psin&comma;xsqrt2 sinnPix&plus;nPi2&semi;








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


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


For n = 2, what do you notice?


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?  


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


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


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

  &pi;π* 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.


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:


 En&equals;n2h28 meL2.          (1)


where me 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


L &equals; k&plus;1 249 pm&plus;567 pm        (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:


Ephoton &equals; &Delta;E 


h&upsilon;&equals;ELUMO EHOMO


hc&lambda;&equals;h28 meL2nLUMO2 nHOMO2 


λ&equals;8 meL2chnLUMO2 nHOMO2      (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



Chemical Formula


Length, L


π electron pairs




 lmax (Exp.) (nm)



3,3'-Diethylthiacyanine Iodide








3,3'-Diethylthiacarbocyanine Iodide









3,3'-Diethylthiadicarbocyanine Iodide








3,3'-Diethylthiatricarbocyanine Iodide







Table 1



restart&colon;withScientificConstants&colon;   &num; calls values for mass of electron, me, Planck's constant, h, and the speed of light, c




Lk&plus;1249e−12 &plus; 567e−12&semi;












&lambda;evalf8ConstantmeL2ConstantcConstanthnLUMO2 nHOMO2 &semi;





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

 &pi;π* 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.


lmax (nm) (Exp)

lmax (nm) (Method #1)

% Error

lmax (nm)

(Method #2)

% Error











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







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!


groundHartreeFockmolec&comma;charge&equals;1 &comma;spin&equals;0&comma; basis&equals;sto-3g&semi;



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.


for i from 1 by 1 while groundmo_occi&equals;2 do end do&colon; HOMOi1&semi; LUMO&equals;i&semi;






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


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:


DensityPlot3Dmolec&comma;ground&comma; orbitalindex&equals;HOMO4&comma;charge&equals;1&comma; spin&equals;0&comma; basis&equals;sto-3g&comma;densitycutoff&equals;0.001&semi;


   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).



Egapexcitede_tot  grounde_tot&semi; 








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


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?


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.

 &pi;π* 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.   


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):


Enx&comma;ny&equals;nx2&plus;ny2h28 meL2               (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

Ephoton &equals; &Delta;E 


h&upsilon;&equals;E2 E1


hc&lambda;&equals;n2&comma;x2&plus; n2&comma;y2h28 meL2 n1&comma;x2&plus; n1&comma;y2h28 meL2


λ&equals;8 meL2chn2&comma;x2&plus; n2&comma;y2  n1&comma;x2&plus; n1&comma;y2     (6)




































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



&pi;π* 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.










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.  


groundHartreeFockmolec&comma;charge&equals;0&comma;spin&equals;0&comma; basis&equals;sto-3g&semi;



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.


for i from 1 by 1 while groundmo_occi&equals;2 do end do&colon; HOMOi1&semi; LUMO&equals;i&semi;







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


Not good!


   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: again, the QuantumChemistry package defines spin = 2S, so for the first excited state, we have two unpaired electrons, so S = 1 and 2S = spin = 2).



Egapexcitede_tot  grounde_tot&semi; 







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






1. Autschbach, J. Chem. Ed., 84, 1840 (2007)

2. Lash, J. Porphyrins Phthalocyanines, 15, 1093 (2011)