{"id":6037,"date":"2019-05-10T10:52:51","date_gmt":"2019-05-10T14:52:51","guid":{"rendered":"http:\/\/pages.vassar.edu\/magnes\/?p=6037"},"modified":"2019-05-10T11:01:57","modified_gmt":"2019-05-10T15:01:57","slug":"computational-methods-in-quantum-mechanics","status":"publish","type":"post","link":"https:\/\/pages.vassar.edu\/magnes\/2019\/05\/10\/computational-methods-in-quantum-mechanics\/","title":{"rendered":"Computational Methods in Quantum Mechanics"},"content":{"rendered":"<p>In this post I will attempt to teach the reader two computational methods that are commonly used to analyse quantum systems. These methods are known as the matching method and the Monte Carlo method. These methods each have their own advantages and disadvantages in various scenarios which is why I believe it would be useful to the reader to have both of these methods under their tool belt.<\/p>\n<p>The basis of all of our calculations in a quantum system will typically be based on the time independent Schr\u00f6dinger equation, so lets first analyse this equation to see how it can be used computationally.<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-6038\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq1-300x80.png\" alt=\"\" width=\"300\" height=\"80\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq1-300x80.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq1.png 391w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>We can approximate the double partial derivative of the wave function as:<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq2a-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6054\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq2a-1.png\" alt=\"\" width=\"1683\" height=\"147\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq2a-1.png 1683w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq2a-1-300x26.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq2a-1-768x67.png 768w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq2a-1-1024x89.png 1024w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq2a-1-624x55.png 624w\" sizes=\"auto, (max-width: 1683px) 100vw, 1683px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq2b.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-6043\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq2b-300x61.png\" alt=\"\" width=\"300\" height=\"61\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq2b-300x61.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq2b-624x126.png 624w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq2b.png 633w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Now that we have an equation for\u00a0the double partial derivative, we can enter this back into the\u00a0Schr\u00f6dinger equation and rearrange the terms in the following way:<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq3-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-6044\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq3-1-300x43.png\" alt=\"\" width=\"300\" height=\"43\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq3-1-300x43.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq3-1-768x109.png 768w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq3-1-624x89.png 624w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq3-1.png 822w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>We now have an equation that allows us to compute any wavefunction given an energy and potential.<\/p>\n<p><strong>Matching Method<\/strong><\/p>\n<p>Now that we can calculate a wavefunction we must find the eigenenergies associated with a system in order to determine the eigenstate. There are multiple ways to do this, one such is the matching method which is particularly useful for asymmetric potential systems. The goal of the matching function is to generate a smooth and continuous wave function by combining two wavefunctions which are generated from the left and right corners of the potential array.<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Matching.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6045 size-full\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Matching.gif\" alt=\"\" width=\"700\" height=\"525\" \/><\/a><\/p>\n<p>Figure (1) &#8211; Matching method inside an infinite square well.<\/p>\n<p>The\u00a0 inputs\u00a0 of a matching method function are an initial energy guess, the potential array, the spatial step size, and an indexing point which we will use to check the slope of each wavefunction.\u00a0 In order to calculate each wave function, there are unique initial conditions for even and odd parity solutions:<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screenshot-9.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-6046\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screenshot-9-300x61.png\" alt=\"\" width=\"300\" height=\"61\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screenshot-9-300x61.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screenshot-9-624x128.png 624w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screenshot-9.png 718w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Using equation 3 and the initial conditions, we can calculate the first wavefunction using our initial energy guess. Then, we repeat this process by first flipping the potential array and generating a second wavefunction with the same initial conditions. We then flip this second wavefunction so that we have effectively generated one array from left to right and a second array from right to left. We then normalize each wavefunction at the indexed point so that they intersect.<\/p>\n<p>Now we may calculate the slope of each wavefunction at the index. We then call a secondary matching function which keeps track of the orientation of the slopes. If each slope&#8217;s relative orientation remains the same, then our &#8216;change in energy&#8217; value, which we will add afterwords, remains the same. If each slope&#8217;s relative orientation changes, then our &#8216;change in energy&#8217; value is halved and negated. In either case, we then add a &#8216;change in energy&#8217; value to the original energy guess, recalculate the left and right wavefunctions and repeat the process.<\/p>\n<p>This function allows us to find eigenstates and hone in on the eigenenergies of a system. Once we reach a certain limit, the &#8216;change in energy&#8217; value will be so small that we can stop the program and merge the two functions at the index point.<\/p>\n<p>There are many useful applications of this method, one such is the quantum harmonic oscillator. The quantum harmonic oscillator is a useful analog for many arbitrary potentials which have stable equilibrium points.<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/SHOg.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6049 size-full\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/SHOg.gif\" alt=\"\" width=\"700\" height=\"525\" \/><\/a><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/sholevels.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6050 size-full\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/sholevels.jpg\" alt=\"\" width=\"700\" height=\"525\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/sholevels.jpg 700w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/sholevels-300x225.jpg 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/sholevels-624x468.jpg 624w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<p>Figure (2) &#8211; Top shows the matching method running on the first 6 energy levels of a quantum harmonic oscillator. Bottom shows the end result.<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/shoprob.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6051 size-full\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/shoprob.jpg\" alt=\"\" width=\"700\" height=\"525\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/shoprob.jpg 700w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/shoprob-300x225.jpg 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/shoprob-624x468.jpg 624w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<p>Figure (3) &#8211; The probability distribution of the 100th energy level as a result of the matching method.<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/LJMatching.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6052 size-full\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/LJMatching.gif\" alt=\"\" width=\"700\" height=\"525\" \/><\/a><\/p>\n<p>Figure (4) &#8211; Another useful potential to study is the Lennard Jones potential. This potential is used to model the van der Waals forces between inert atoms.<\/p>\n<p><strong>Monte Carlo Method<\/strong><\/p>\n<p>Another useful computational method is the Monte Carlo method. Rather than guessing at the energy as in the matching method, in this method we will be guessing at the wavefunction and iterating on this guess. The idea of a Monte Carlo method is that we randomly change a system and only keep the changes that bring us closer to a solution we would expect. In the case of quantum mechanics, this will be used to randomly change the wavefunction and only keep the changes that lower the energy of the system.<\/p>\n<p>In order to implement this approach, we must first understand how to calculate energy using equation 4 below:<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6055\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq4.png\" alt=\"\" width=\"204\" height=\"68\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq4.png 521w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq4-300x100.png 300w\" sizes=\"auto, (max-width: 204px) 100vw, 204px\" \/><\/a><\/p>\n<p>In order to preform these integrals in discrete space, we can use several different methods, but for this process I chose to use the trapezoidal integration method:<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6056\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq5.png\" alt=\"\" width=\"411\" height=\"71\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq5.png 713w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq5-300x52.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq5-624x108.png 624w\" sizes=\"auto, (max-width: 411px) 100vw, 411px\" \/><\/a><\/p>\n<p>Applying this method to the quotient and denominator of equation 4 leaves us with the following equations:<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6057\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq6.png\" alt=\"\" width=\"550\" height=\"59\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq6.png 842w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq6-300x32.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq6-768x83.png 768w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq6-624x67.png 624w\" sizes=\"auto, (max-width: 550px) 100vw, 550px\" \/><\/a> <a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6058\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq7.png\" alt=\"\" width=\"465\" height=\"64\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq7.png 656w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq7-300x41.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq7-624x86.png 624w\" sizes=\"auto, (max-width: 465px) 100vw, 465px\" \/><\/a><\/p>\n<p>Now equation 4 becomes:<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq8a.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6059\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq8a.png\" alt=\"\" width=\"467\" height=\"89\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq8a.png 882w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq8a-300x57.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq8a-768x146.png 768w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq8a-624x119.png 624w\" sizes=\"auto, (max-width: 467px) 100vw, 467px\" \/><\/a><\/p>\n<p>But now we have energy on both sides of the equation. In order to resolve this, we need to substitute in\u00a0the time independent Schr\u00f6dinger equation (Eq. 1) which gives us<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq8b.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6060\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq8b.png\" alt=\"\" width=\"1181\" height=\"190\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq8b.png 1181w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq8b-300x48.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq8b-768x124.png 768w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq8b-1024x165.png 1024w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq8b-624x100.png 624w\" sizes=\"auto, (max-width: 1181px) 100vw, 1181px\" \/><\/a><\/p>\n<p>Finally, in order to get rid of the double partial derivatives, we substitute in equation 2 and find:<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq8c.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6061\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq8c.png\" alt=\"\" width=\"1235\" height=\"147\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq8c.png 1235w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq8c-300x36.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq8c-768x91.png 768w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq8c-1024x122.png 1024w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/eq8c-624x74.png 624w\" sizes=\"auto, (max-width: 1235px) 100vw, 1235px\" \/><\/a><\/p>\n<p>This is the final solution which will allow us to calculate the energy in any system given a wavefunction and potential array.<\/p>\n<p>Now that we can calculate energy, we can utilize the Monte Carlo method. This method is actually quite simple; we create a function that takes in an arbitrary guess of the wavefunction and calculate the energy of this guess. Then we randomly pick a point of the wavefunction and change it by a random amount. Then we recalculate the energy of the system and if the energy has decreased, we can keep that random change, otherwise discard the change and revert to the previous wavefunction. We repeat this process over and over again until we reach a point in which the energy does not change after a certain number of attempts. At this point we can assume the we reached the ground state of our potential system.<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/MonteCarlo.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6062\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/MonteCarlo.gif\" alt=\"\" width=\"700\" height=\"525\" \/><\/a><\/p>\n<p>Figure (5) &#8211; The Monte Carlo method in an infinite square well. This animation takes place over ~5 million iterations.<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/MClj.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6063\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/MClj.gif\" alt=\"\" width=\"700\" height=\"525\" \/><\/a><\/p>\n<p>Figure (6) &#8211; Monte Carlo method in a Lennard Jones potential.\u00a0This animation takes place over ~50 million iterations.<\/p>\n<p>Typically when using the Monte Carlo method on a new potential system, it is actually quite difficult in order to tell when we have reached the ground state unless we actually watch the iterations as they happen. As the wavefunction starts to change less and less we can assume that we are nearing the ground state.\u00a0 This is still a very slow process and it can take vastly different times to reach the ground state depending on your initial wavefunction guess and the step size of your random changes.<\/p>\n<p>While the Monte Carlo method is significantly slower than the matching method, it is still incredibly useful in finding the ground state energy of an arbitrary system. We typically need little to no intuition as to what the ground state looks like when we make our initial wavefunction guess. As long as the Monte Carlo method is run for a sufficient amount of time, the function will approach a ground state. Another downside of the Monte Carlo method is that it will only search for the ground state. The matching method, however, is useful in finding multiple energy levels. This method will resonate around any eigenstate as long as our initial energy guess and &#8216;change in energy&#8217; value permits it. Overall, both functions have their applications and can be very useful in tandem.<\/p>\n<p>As an aside, I should also say that both of these methods are only useful if we already understand how to describe the potential of a system and only seek the eigenenergies of said system. In the real world, most researchers are typically suffering from the inverse problem, in which we know the energies of the system but must use this information in order to construct a potential that coincides with these energies. While these methods may not be useful for those researchers, I still think these are valuable, especially to the student who wishes to study systems that we may already know how to describe.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post I will attempt to teach the reader two computational methods that are commonly used to analyse quantum systems. These methods are known as the matching method and the Monte Carlo method. These methods each have their own advantages and disadvantages in various scenarios which is why I believe it would be useful [&hellip;]<\/p>\n","protected":false},"author":8110,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6037","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/posts\/6037","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/users\/8110"}],"replies":[{"embeddable":true,"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/comments?post=6037"}],"version-history":[{"count":4,"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/posts\/6037\/revisions"}],"predecessor-version":[{"id":6065,"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/posts\/6037\/revisions\/6065"}],"wp:attachment":[{"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/media?parent=6037"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/categories?post=6037"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/tags?post=6037"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}