How to compute the Eigenvalue and Eigenstates of Quantum well with Effective mass using finite difference method in Python?

I want to compute the eigenvalues and eigenstates of a quantum well with different effective masses of electron in the barrier and in the quantum well. As can be seen : https://github.com/mholtrop/QMPython/blob/master/Finite%20Well%20Bound%20States.ipynb , the mass of the electron is constant, therefore the Hamiltonian can be easily diagonalized and eigenvalues/eigenstates can be evaluated.

However, in my situation, the mass of the electron takes different values in the barrier and the well. Could any one suggest how I could obtain the matrix which satisfies the effective mass condition, and hence can be used to compute eigenvalues and states using similar method.

$$a_i\psi_{i-1}+b_i\psi_{i}+c_i\psi_{i+1}=E\psi_{i}$$

$$a_{i+1}=c_i=\frac{-\hbar^2}{2m^*(\delta z)^2} \text{ and } b_i=\frac{\hbar^2}{m^*(\delta z)^2}+V_i$$

In the above equations, it is apparent that the Hamiltonian can be diagonalized as mentioned in the link above.

$$a_{i+1}=c_i=\frac{-\hbar^2}{2m_{i+\frac{1}{2}}^*(\delta z)^2} \text{ and } b_i=\frac{\hbar^2}{2(\delta z)^2}\bigg(\frac{1}{m^*_{i+\frac{1}{2}}}+\frac{1}{m^*_{i-\frac{1}{2}}}\bigg)+V_i$$

My question is: how can I diagonalize my Hamiltonian with $$m^*$$(z) being different in the barrier and the well using the finite difference.

The complete Schrodinger equation can be written as,

$$\frac{-\hbar}{2}\frac{\partial}{\partial z}\frac{1}{m^*(z)}\frac{\partial}{\partial z}\psi(z)+V(z)\psi(z)=E\psi(z)$$

$$\qquad\qquad\qquad\qquad\qquad\quad$$ Here, mass depends on z growth axis of quantum well (in picture its x instead of z) $$m^*(z)$$ in case of finite quantum well the value mass in barrier remains same in both regions 1 and 3 and is different in the well region 2.

I would like to know how can I use the same approach as mentioned  to solve the Schrodinger equation with a spatially dependent mass.

• Would Computational Science be a better home for this question? Sep 29 '21 at 12:17
• Thank you, I will do that. Sep 29 '21 at 13:00
• I don't understand the question. The way you write it down, you already have a matrix eigenvalue problem. You just need to combine all of your equations into a matrix and throw the matrix into an eigenvalue solver. I assume you have already done that for the case of same-mass electrons. It's not clear to me what is different about the case with different masses if you can numerically solve the case with same masses. Sep 29 '21 at 14:33
• Can you write down the original differential equation for your problem? Sep 29 '21 at 16:39
• @celerion when including equations, please use mathjax formatting rather than an image. Images aren't searchable and can't be interpreted by screen readers. Sep 30 '21 at 13:50