Question
STARTER CODE #pragma rtGlobals=3 // Use modern global access method and strict wave access. Function Schrodinger_wells(U0, mass, width, spacer, Nrepeats, dx,plotfigs,scalefactor, name) // solves 1D
STARTER CODE
#pragma rtGlobals=3 // Use modern global access method and strict wave access.
Function Schrodinger_wells(U0, mass, width, spacer, Nrepeats, dx,plotfigs,scalefactor, name) // solves 1D schrodinger equation for quantum wells Variable U0 // height of well in eV Variable width, spacer // well width and spacer (barrier) width in Angstrom Variable mass // effective mass in units of electron mass m0 Variable Nrepeats // number of repeats Variable dx // mesh step in Angstrom Variable plotfigs // 1 to plot figures, 0 no figures Variable scalefactor // for plotting psi_sq string name
// make potential Variable cellpoints = round((spacer+width)/dx) make /o = (cellpoints*Nrepeats+round(spacer/dx),1) potential setscale /P x, 0, dx, potential
Variable i for (i=0; i //width=10; offset=0.5; testfun=erf(x*width+offset*width)/2+1/2 // assemble H Variable m0 = 9.10938e-31/(1e20*1.6e-19); // eV s^2 / Angstrom^2 Variable hbar = 6.582e-16; // eV*s Variable t0 = hbar^2/(2*mass*m0*dx^2) make /o =(dimsize(potential,0),dimsize(potential,0)) H Variable j for (i=0; i // diagonalize H // Wave /z m_eigenvectors, w_eigenvalues Make /o =(dimsize(potential,0),1) w_eigenvalues Make /o =(dimsize(potential,0),dimsize(potential,0)) m_eigenvectors MatrixEigenV /sym /evec H setscale /P x, 0, dx, m_eigenvectors make /o =(dimsize(m_eigenvectors,0),dimsize(m_eigenvectors,0)) psi_sq setscale /P x, 0, dx, psi_sq for (i=0; i // plot the bound states if (plotfigs==1) display potential ModifyGraph offset(potential)={0,-U0} ModifyGraph rgb(potential)=(0,0,0) ModifyGraph mirror=2 Label left "potential" SetAxis left -U0*1.1, U0*0.1 Label bottom "x" for (i=0; i //print "energies of bound states [eV]:" //print i, energies[i]-U0 else AppendToGraph psi_sq[][i] ModifyGraph muloffset($("psi_sq#"+num2str(i)))={0,scalefactor/WaveMax(psi_sq)} ModifyGraph offset($("psi_sq#"+num2str(i)))={0,energies[i]-U0} //print i, energies[i]-U0 endif endif endfor endif Killwaves M_eigenVectors, W_eigenvalues, H rename potential $("potential_" + name) rename psi_sq $("psi_sq_" + name) rename energies $("energies_" + name) End
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started