FYS3150 Project 3- Numerical integration Solved

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: zip solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

Rate this product

Project 3, numerical integration

The task of this project is to integrate first in a brute force manner a six- dimensional integral which is used to determine the ground state correlation energy between two electrons in a helium atom. The integral appears in many quantum mechanical applications. However, if you are not too familiar with quantum mechanics, you can simply look at the mathematical details. We will employ both Gauss-Legendre and Gauss-Laguerre quadrature and Monte-Carlo integration. Furthermore, you will need to parallelize your codes.

We assume that the wave function of each electron can be modelled like the single-particle wave function of an electron in the hydrogen atom. The single-particle wave function for an electron i in the 1s state is given in terms of a dimensionless variable (the wave function is not properly normalized)

ri =xiex +yiey +ziez, ψ1s(ri) = e−αri ,

r i = 􏰂 x 2i + y i2 + z i2 .

as
where α is a parameter and

We will fix α = 2, which should correspond to the charge of the helium atom Z = 2.

The ansatz for the wave function for two electrons is then given by the product of two so-called 1s wave functions as

Ψ(r1, r2) = e−α(r1+r2).
Note that it is not possible to find a closed-form or analytical solution to

Schrödinger’s equation for two interacting electrons in the helium atom.

⃝c 1999-2019, “Computational Physics I FYS3150/FYS4150″:”http://www.uio.no/studier/emner/matnat/fys/FYS3150/index- eng.html”. Released under CC Attribution-NonCommercial 4.0
license

The integral we need to solve is the quantum mechanical expectation value of the correlation energy between two electrons which repel each other via the classical Coulomb interaction, namely

1􏰀∞1

⟨ ⟩ = |r1 −r2|

−∞

dr1dr2e−2α(r1+r2) . (1) |r1 −r2|

Note that our wave function is not normalized. There is a normalization factor missing, but for this project we don’t need to worry about that.

This integral can be solved in closed form and the answer is 5π2/162. Can you derive this value?

For this project you can hand in collaborative reports and pro- grams.

Project 3a): Gauss-Legendre Quadrature. Use Gauss-Legendre quadra- ture and compute the integral by integrating for each variable x1, y1, z1, x2, y2, z2 from −∞ to ∞. How many mesh points do you need before the results converges at the level of the third leading digit? Hint: the single-particle wave function e−αri is more or less zero at ri ≈ λ (find the appropriate limit). You can therefore replace the integration limits −∞ and ∞ with −λ and +λ, respectively. You need to check that this approximation is satisfactory, that is, make a plot of the function and check if the abovementioned limits are appropriate. You need also to account for the potential problems which may arise when |r1 − r2| = 0.

Project 3b): Improved Gauss-Quadrature. The Legendre polynomials are defined for x ∈ [−1, 1]. The previous exercise gave a very unsatisfactory ad hoc procedure. We wish to improve our results. It can therefore be useful to change to another coordinate frame and employ the Laguerre polynomials. The Laguerre polynomials are defined for x ∈ [0, ∞) and if we change to spherical coordinates

with

and

dr1dr2 = r12dr1r2dr2dcos(θ1)dcos(θ2)dφ1dφ2, 11

r=􏰁22
12 r1 + r2 − 2r1r2cos(β)

cos(β) = cos(θ1)cos(θ2) + sin(θ1)sin(θ2)cos(φ1 − φ2))

we can rewrite the above integral with different integration limits. Find these limits and replace the Gauss-Legendre approach in a) with Laguerre polynomials. The function gauss-laguerre.cpp in the CodeExamples folded can be used. Do your results improve? Compare with the results from a).

Important notice for c++ programmers: the function which computes the Gauss-Laguerre integration points and weights returns arrays which start at

2

1 and end n instead of the default values 0 and n − 1. You need to declare an array of length n + 1.

Project 3c): Monte Carlo Integration. Compute the same integral but now with brute force Monte Carlo and compare your results with those from the previous points. Discuss the differences. With bruce force we mean that you should use the uniform distribution.

Project 3d): Improved Monte Carlo Integration. Improve your brute force Monte Carlo calculation by using importance sampling. Hint: use the exponential distribution and transform to spherical coordinates. Does the variance decrease? Does the CPU time used compared with the brute force Monte Carlo decrease in order to achieve the same accuracy? Comment your results and make a list over the time each method uses. Compare the results also.

Project 3e): Improved Monte Carlo Integration and Parallization.

Finally, for the last exercise you should parallelize your code using openMP or MPI. Time your program with various compiler flags and comment these results as well. In particular, we want to see whether you achieve an optimal speed-up or not.

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. 3
  • Critique: if possible include your comments and reflections about the exercise, whether you felt you learnt something, ideas for improvements and other thoughts you’ve 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 don’t 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. uio.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 parametxers.
  • 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.

  • Project-3-i1wsmq.zip