Giter Site home page Giter Site logo

artmenlope / double-slit-2d-schrodinger Goto Github PK

View Code? Open in Web Editor NEW
21.0 1.0 3.0 14.13 MB

This repository contains Python 3 scripts for simulating the passage of a 2D Gaussian wave packet through a double slit. For this, the 2D Schrödinger equation is solved using the Crank-Nicolson numerical method.

Home Page: https://artmenlope.github.io/solving-the-2d-schrodinger-equation-using-the-crank-nicolson-method/

License: MIT License

Python 100.00%
double-slit schrodinger schrodinger-equation 2d crank-nicolson crank-nicolson-methods sparse-matrix gaussian-wave-packet

double-slit-2d-schrodinger's Introduction

double-slit-2d-schrodinger

License: MIT Last Commit

A detailed description of the methods used for these simulations can be found at "Solving the 2D Schrödinger equation using the Crank-Nicolson method".

Summary

This repository contains Python 3 scripts for simulating the passage of a 2D Gaussian wave packet through a double slit. For this, the 2D Schrödinger equation is solved using the Crank-Nicolson numerical method.

The method

To simulate the passage of the 2D Gaussian wavepacket through the double slit, the discretized 2D schrödinger equation is solved at each time step using the Crank-Nicolson numerical method. It is important to note that this method is computationally expensive, but it is more precise and more stable than other low-order time-stepping methods [1]. It calculates the time derivative with a central finite differences approximation [1].

For further information on the Crank-Nicolson method, the mathematical details and the creation of the scripts for the simulations, please remember to check this blog post.


For this problem we consider the 2D time-dependent Schrödinger equation:

$$ i\dfrac{\partial \psi(x, y, t)}{\partial t} = - \nabla^2 \psi(x, y, t) + V(x, y, t) \psi(x, y, t) $$

which can be expanded as

$$ i\dfrac{\partial \psi(x, y, t)}{\partial t} = - \left( \dfrac{\partial^2 \psi(x, y, t)}{\partial x^2} + \dfrac{\partial^2 \psi(x, y, t)}{\partial y^2}\right) + V(x, y, t) \psi(x, y, t) $$

Here, for simplicity we have considered that $\hbar/2m=1$. Then, to solve the problem, we discretize the simulation space and, consequently, the particle's wave function $\psi$ (our Gaussian wavepacket) and the Scrödinger equation.

The chosen initial (unnormalized) Gaussian wavepacket has the form

$$ \psi(x, y, t=0) = e^{-\frac{1}{2\sigma^2}\left[(x-x_0)^2+(y-y_0)^2\right]}\cdot e^{-ik(x-x_0)} $$

and the double slit is parametrized as the following image shows:

The results

The two main scripts in this repository doubleSlit_HW_CN.py and doubleSlit_FPB_CN.py are used to simulate the system in the case of a double slit with infinite potential barrier walls and finite potential barrier walls respectively. The following two animations show how the results look like:


Hard walls double slit

Potential barrier walls double slit

References

[1]: Landau, R.H., Páez Mejía, M.J. & Bordeianu, C.C., 2015. "Heat Flow via Time Stepping". In: "Computational physics: problem solving with Python", 3rd ed. Weinheim: Wiley-VCH.

double-slit-2d-schrodinger's People

Contributors

artmenlope avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

double-slit-2d-schrodinger's Issues

memory overflow

Hi,

I have two issues:

  1. double slit FPB CN has "doubleSlit_interaction" function that is not referenced beforehand.
  2. I am having troubles running the other file....I'm using Python 3.9 on Windows 10 8GB Ram and CPU 2.7 GHz on a 64 bit processor.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.