[Solved] FYS4150 Project 2

$25

File Name: FYS4150__Project_2.zip
File Size: 169.56 KB

SKU: [Solved] FYS4150 – Project 2 Category: Tag:
5/5 - (1 vote)

Eigenvalue problems, from the equations of a buckling beam to Schroedingers equation for two electrons in a threedimensional harmonic oscillator well

Introduction. The aim of this project is to develop your own code for solving eigenvalue problems. The matrix to diagonalize is the same as the one we encountered in project one, a so-called tridiagonal Toeplitz matrix. This matrix has analytical eigenpairs (eigenvalues and eigenvectors) and gives us an excellent testing ground for our algorithms. In this project we will develop an eigenvalue solver based on Jacobis method. The project will also introduce you to units tests and we will compare our results against other eigenvalue solvers (from LAPACK and/or numpy).

This project aims also at introducing to you the concept of scaling of equations. This means often either making various variables dimensionless or introducing units which are more convenient.

We will start with the two-point boundary value problem of a buckling beam or a spring fastened at both ends. This is one of the problems which has analytical solutions. Thereafter, by simply adding a new variable along the diagonal elements, we can study quantum mechanical problems. In particular, we will study the harmonic oscillator problem in three dimensions, with one or two electrons. For the latter case we can study the role of the repulsive Coulomb interaction and extract interesting physics results. For selected frequencies, this interacting two-electron problem exhibits analytical solutions, one of the few cases of an interacting system where wecan find analytical solutions. See M. Taut, Phys. Rev. A 48, 3561 (1993) for the derivation of analytical expressions for the eigenpairs..

Electrons confined in small areas in semiconductors, so-called quantum dots, form a hot research area in modern solid-state physics, with applications spanning from such diverse fields as quantum nano-medicine to the contruction of quantum gates. The article on quantum computing with quantum dots by Loss and DiVincenzo is an excellent read for those interested in this exciting topic.

c 1999-2019, Computational Physics I

FYS3150/FYS4150:http://www.uio.no/studier/emner/matnat/fys/FYS3150/indexeng.html. Released under CC Attribution-NonCommercial 4.0

license

The buckling beam problem, a classical wave function problem in one dimension. We start with the following differential equation, namely

d2u(x)

= Fu(x), dx2

where u(x) is the vertical displacement of the beam in the y direction. The beam has length L, x [0,L] and F is a force applied at (L,0) in the direction towards the origin. The parameter is a constant defined by properties like the rigidity of the beam. We apply again so-called Dirichlet boundary conditions and set u(0) = u(L) = 0.

In this specific case two of the parameters , F and L are known. As an example, assume we know F and L. Then the eigenvalue problem we set up below will allow us to find .

We define a dimensional variable

x = ,

L

meaning that we have [0,1]. By reordering the equation as

d2u() FL2

= u() = u(), d2

with = FL2/ we have an equation that when discretized, becomes an eigenvalue problem. We use the same expression for the second derivative of a function u as we did in project 1, namely

00 u( + h) 2u() + u( h) 2

u = + O(h ), (1) h2

where h is our step. Next we define minimum and maximum values for the variable , min = 0 and max = 1, respectively. With a given number of mesh points, N, we define the step length h as, with min = 0 and max = N,

N 0 h = .

N

The value of at a point i is then

i = 0 + ih i = 1,2,,N.

We can rewrite the differential equation for a value i as

u(i + h) 2u(2i) + u(i h) = u(i),

h

or in a more compact way as

ui+1 2u2i + ui1 = ui.

h

Following our approach from project 1, we can rewrite this equation in a more a general form, but now as an eigenvalue problem, that is

d a 0 0 0 0 u1 u1

a d a 0 0 0 u2 u2

0 a d a 0 0 u3 u3 . (2)

=

0 a d a uN2 uN2

0 a d uN1 uN1

As in project 1, we have not included the endpoints u0 and uN. We have defined d = 2/h2 and the non-diagonal ones as a = 1/h2. This eigenvalue problem has analytical eigenpairs, with eigenvalues given as

j j = d + 2acos( ) j = 1,2,N. N + 1

Project 2 a): Mathematical intermezzo. A unitary transformation preserves the orthogonality of the obtained eigenvectors. To see this consider first a basis of vectors vi,

vi1

vi =

vin

We assume that the basis is orthogonal, that is

vjTvi = ij.

Show that an orthogonal or unitary transformation

wi = Uvi,

preserves the dot product and orthogonality.

Project 2 b): Setting up a code for tridiagonal Toeplitz matrix. Your task now is to write a function which implements Jacobis rotation algorithm (see Lecture notes chapter 7) in order to solve Eq. (2). However, the first simple check is to set up the matrix to diagonalize for a given N and use either armadillos or numpys functions for diagonalizing a matrix. You can then check that you obtain the analytical eigenvalues.

For Jacobis method, we define the quantities tan = t = s/c, with s = sin and c = cos and

all akk cot2 = = .

2akl

We can then define the angle so that the non-diagonal matrix elements of the transformed matrix akl become non-zero and we obtain the quadratic equation

(using cot2 = 1/2(cot tan)

t2 + 2t 1 = 0,

resulting in

t = p1 + 2,

and c and s are easily obtained via

c ,

and s = tc.

How many similarity transformations are needed before you reach a result where all non-diagonal matrix elements are essentially zero? Try to estimate the number of transformations and extract a behavior as function of the dimensionality of the matrix. Compare your results with the analytical ones.

You can check your results against the Armadillo function for solving eigenvalue problems. The armadillo function eigsys can be used to find eigenvalues and eigenvectors. A Python program which solves this part of the project is available under the project writing slides.

Comment your results (here you could for example compute the time needed for both algorithms for a given dimensionality of the matrix).

Project 2 c): Implementing tests in your code. In this project (and later ones as well) we will implement so-called unit tests. Our unit tests are mainly meant to test mathematical properties of our algorithm. During the development phase of a program it is useful to devise tests that your program should pass. One of these is to make sure that for a given simple test matrix (say a 5 5 matrix) our algorithm for searching for the largest non-diagonal element always returns the correct answer. Furthermore, for a known simple matrix, irrespective of changes made, we should always get the same and correct eigenvalues. Another test is to make sure that the orthogonality shown in exercise (a) is preserved. Try to figure out other tests your code should pass, based either on the mathematical properties of the algorithms or more program specific tests. Implement at least two unit tests in this project.

Extending our machinery to quantum mechanics. Here we will assume that these electrons move in a three-dimensional harmonic oscillator potential (they are confined by for example quadrupole fields) and repel each other via the static Coulomb interaction. We assume spherical symmetry. You dont need to think of quantum mechanics when solving this project, look at it as another diagonalization problem.

We are first interested in the solution of the radial part of Schroedingers equation for one electron. This equation reads

d r2 d l(l + 1)R(r) + V (r)R(r) = ER(r).

2m r2 dr dr r2

In our case V (r) is the harmonic oscillator potential (1/2)kr2 with k = m2 and E is the energy of the harmonic oscillator in three dimensions. The oscillator frequency is and the energies are

3

Enl ,

with n = 0,1,2, and l = 0,1,2,.

Since we have made a transformation to spherical coordinates it means that r [0,). The quantum number l is the orbital momentum of the electron. Then we substitute R(r) = (1/r)u(r) and obtain

~2 d2 l(l + 1) ~2

u(r) + V (r) + u(r) = Eu(r).

2m dr2 r2 2m

The boundary conditions are u(0) = 0 and u() = 0.

We introduce a dimensionless variable = (1/)r where is a constant with dimension length and get

~2 d2 l(l + 1) ~2

u() + V () + u() = Eu().

2m2 d2 2 2m2

We will set in this project l = 0. Inserting V () = (1/2)k22 we end up with

~2 d2 u() + k22u() = Eu().

2m2 d2 2

We multiply thereafter with 2m2/~2 on both sides and obtain

d2 u() + mk42u() = 2m2 Eu(). d2 ~2 ~2

The constant can now be fixed so that

mk 4 = 1,

~2

or

= . mk

Defining

E,

we can rewrite Schroedingers equation as

d2 u() + 2u() = u(). d2

This is the first equation to solve numerically. In three dimensions the eigenvalues for l = 0 are 0 = 3,1 = 7,2 = 11,.

We define minimum and maximum values for the variable , min = 0 and max, respectively. You need to check your results for the energies against different values max, since we cannot set max = .

With a given number of mesh points, N, we define the step length h as, with min = 0 and max = N,

N 0 h = .

N

The value of at a point i is then

i = 0 + ih i = 1,2,,N.

We can rewrite the Schroedinger equation for a value i as

u(i + h) 2u(2i) + u(i h) + 2iu(i) = u(i), h

or in a more compact way

ui+1 2u2i + ui1 + 2iui = ui+1 2u2i + ui1 + Viui = ui, h h

where Vi = 2i is the harmonic oscillator potential. We define first the diagonal matrix element

2

di = h2 + Vi,

and the non-diagonal matrix element

1

ei = 2 . h

In this case the non-diagonal matrix elements are given by a mere constant. All non-diagonal matrix elements are equal. With these definitions the Schroedinger

equation takes the following form

diui + eiui1 + eiui+1 = ui,

where ui is unknown. We can write the latter equation as a matrix eigenvalue
problem
d1e1 0 00 e1d2 e2 0 e2d3 00 e3 0eN3 0 0dN2 eN2 0 u1 u1 0 u2 u2 0 . = eN2 dN1 uN1 uN1 (3)

Note here that we have not included the endpoints since we assume that they are knowm (as we did in project 1). The matrix is also symmetric in this case.

Project 2 d): Quantum dots in three dimensions, one electron. Add the harmonic oscillator potential to your tridiagonal Toeplitz matrix from 2a-2c and diagonalize the matrix. Study the results as functions of the number of integration points N and your approximation to max. The analytical results with our scaling for the one-electron energies are = 3,7,11,15,. How many integration points do you need in order to reproduce the analytical results with say four leading digits after the decimal point?

You can reuse the code you wrote for part (b), but you need to add the potential 2 to the diagonal elements.

Project 2 e): Quantum dots in three dimensions, two electrons. Note: if you are not interested in the explicit quantum physics case here, you can replace this part with either 2g or 2h below. The latter ones are optional exercises if you do this.

We will now study two electrons in a harmonic oscillator well which also interact via a repulsive Coulomb interaction. Let us start with the single-electron equation written as

~2 d2

u kr2u(r) = E(1)u(r), 2m dr2 2

where E(1) stands for the energy with one electron only. For two electrons with no repulsive Coulomb interaction, we have the following Schroedinger equation

~2 d2 ~2 d22 + 12kr 2kr u(r1,r2).

2 2m dr2

2m dr1

Note that we deal with a two-electron wave function u(r1,r2) and two-electron energy E(2).

With no interaction this can be written out as the product of two singleelectron wave functions, that is we have a solution on closed form.

We introduce the relative coordinate r = r1 r2 and the center-of-mass coordinate R = 1/2(r1+r2). With these new coordinates, the radial Schroedinger equation reads

~2 d2 ~2 d2 + 1kr2 + kR2u(r,R) = E(2)u(r,R). m dr2 4m dR2 4

The equations for r and R can be separated via the ansatz for the wave function u(r,R) = (r)(R) and the energy is given by the sum of the relative energy Er and the center-of-mass energy ER, that is

E(2) = Er + ER.

We add then the repulsive Coulomb interaction between two electrons, namely a term

V (r1,r2) = with e2 = 1.44 eVnm.

e2 e2

= ,

|r1 r2| r

Adding this term, the r-dependent Schroedinger equation becomes

~2 d2 1 2 e2

2 + 4kr + r (r) = Er(r). m dr

This equation is similar to the one we had previously in (b) and we introduce again a dimensionless variable = r/. Repeating the same steps as above, we arrive at

d22 () + 14 mk~2 42() + me~2 2 () = m~22 Er(). d

We want to manipulate this equation further to make it as similar to that in (a) as possible. We define a new frequency

2 1 mk 4 r = 4 ~2 ,

and fix the constant by requiring

me2

= 1

~2

or ~2 = . me2

Defining

m2

= E,

~2

we can rewrite Schroedingers equation as

d22 () + r22() + 1 = (). d

We treat r as a parameter which reflects the strength of the oscillator potential.

Here we will study the cases r = 0.01, r = 0.5, r = 1, and r = 5 for the ground state only, that is the lowest-lying state.

With no repulsive Coulomb interaction you should get a result which corresponds to the relative energy of a non-interacting system. Make sure your results are stable as functions of max and the number of steps.

We are only interested in the ground state with l = 0. We omit the center-ofmass energy.

You can reuse the code you wrote for part (b), but you need to add the potential r22 + 1/ to the diagonal elements.

Comment the results for the lowest state (ground state) as function of varying strengths of r.

For specific oscillator frequencies, the above equation has answers in an analytical form, see the article by M. Taut, Phys. Rev. A 48, 3561 (1993).

Project 2 f): First optional exercise: Quantum physics analysis of the results. This exercise is a continuation of the previous and adds more quantum physics to the analysis. In this exercise we want to plot the wave function for two electrons as functions of the relative coordinate r and different values of r. With no Coulomb interaction you should have a result which corresponds to the non-interacting case. Plot either the function itself or the probability distribution (the function squared) with and without the repulsion between the two electrons. Varying r, the shape of the wave function will change.

We are only interested in the wave function for the ground state with l = 0 and omit again the center-of-mass motion.

The eigenvectors are normalized. Plot then the normalized wave functions for different values of r and comment the results.

Project 2 g): Second optional challenge: Smarter way of finding the eigenvalues. This exercise is also optional and is an algorithmic challenge. Your matrix is already tridiagonal. Can you devise a more efficient way to find the eigenvalues and eigenvectors instead of the brute force application of Jacobis method? Hint: Use the bisection method discussed in for example Barth, Martin and Wilkinson, Numerische Mathematik 9, 386 (1967).

Project 2 h): Third optional challenge: Implementing Lanczos algorithm. This exercise is optional and is meant more as a challenge for those of you with an interest in other algorithms for solving eigenvalue problems. Implement the iterative Lanczos algorithm discussed in the lecture notes and compute the lowest eigenvalues as done in exercise (c) or (d) above. Compare your results and discuss faults and merits of the iterative method versus direct methods like Jacobis method.

Introduction to numerical projects

Here follows a brief recipe and recommendation on how to write a report for each project.

  • Give a short description of the nature of the problem and the eventual numerical methods you have used.
  • Describe the algorithm you have used and/or developed. Here you may find it convenient to use pseudocoding. In many cases you can describe the algorithm in the program itself.
  • Include the source code of your program. Comment your program properly.
  • If possible, try to find analytic solutions, or known limits in order to test your program when developing the code.
  • Include your results either in figure form or in a table. Remember to label your results. All tables and figures should have relevant captions and labels on the axes.
  • Try to evaluate the reliabilty and numerical stability/precision of your results. If possible, include a qualitative and/or quantitative discussion of the numerical stability, eventual loss of precision etc.
  • Try to give an interpretation of you results in your answers to the problems.
  • Critique: if possible include your comments and reflections about the exercise, whether you felt you learnt something, ideas for improvements and other thoughts youve made when solving the exercise. We wish to keep this course at the interactive level and your comments can help us improve it.
  • Try to establish a practice where you log your work at the computerlab. You may find such a logbook very handy at later stages in your work, especially when you dont properly remember what a previous test version of your program did. Here you could also record the time spent on solving the exercise, various algorithms you may have tested or other topics which you feel worthy of mentioning.

Format for electronic delivery of report and programs

The preferred format for the report is a PDF file. You can also use DOC or postscript formats or as an ipython notebook file. As programming language we prefer that you choose between C/C++, Fortran2008 or Python. The following prescription should be followed when preparing the report:

  • Use Devilry to hand in your projects, log in at http://devilry.ifi. no with your normal UiO username and password and choose either

fys3150 or fys4150. There you can load up the files within the deadline.

  • Upload only the report file! For the source code file(s) you have developed please provide us with your link to your github domain. The report file should include all of your discussions and a list of the codes you have developed. Do not include library files which are available at the course homepage, unless you have made specific changes to them.
  • In your git repository, please include a folder which contains selected results. These can be in the form of output from your code for a selected set of runs and input parameters.
  • In this and all later projects, you should include tests (for example unit tests) of your code(s).
  • Comments from us on your projects, approval or not, corrections to be made etc can be found under your Devilry domain and are only visible to you and the teachers of the course.

Finally, we encourage you to work two and two together. Optimal working groups consist of 2-3 students. You can then hand in a common report.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] FYS4150 Project 2
$25