Skip to content

gucio321/potential-well

Repository files navigation

Potential Well Simulator

This programm simulates the movement of a particle in a 1D potential well.

Installation/setup

You need to have Python 3 installed on your computer.

To set up the project, do the following:

git clone https://github.com/gucio321/potential-well && cd potential-well
python3 -m virtualenv venv
. venv/bin/activate
python3 -m pip install -r requirements.txt

Then to run it, do python3 main.py.

Technologies

  • Python 3
  • Dear PyGui (Dear ImGui warapper for python)
  • GitHub (for version control)

USP

  • The program uses rejection sampling for simulating theoritical particle movement.
  • There is a numerical equation solver for the transcendental equation (which cannot be solved analytically).
  • We're using Simpson's rule for numerical integration (needed to apply boundry conditions for Schrödinger equation solutions).
  • A whole lot of math behind the scenes used to compute SE solutions' constants.

Math

Schrödinger equation

After solving the Schrödinger equation for a particle in finite potential well, we get the following solutions:

ψ ( x ) = { A sin ( k x ) + B cos ( k x ) for  0 x L C exp ( α x ) for  x < 0 D exp ( α ( x L ) ) for  x > a

where

k = 2 m E 2

α = 2 m ( V E ) 2

After applying boundry conditions, we get the following coefficients conditions:

B = C

A = α k B

D = B ( α k sin ( k L ) + cos ( k L ) )

α D = B k ( α k cos ( k L ) sin ( k L ) )

As you can see it is impossible to calculate all parameters. The last condition is the normalization condition:

| ψ ( x ) | 2 d x = 1

From 2 last conditions we can get transcendental equation for:

( k α α k ) 2 1 tan ( k L ) = 0

We solve this numerically.

Here is a graph that shows above equations:

image

Click to open desmos.

As you can see from the above, the Energy of a particle could not have any random value in range [0, V] (to keep ψ continous) - try yourself on the graph above.

walls height

We need max Psi value (e.g. for wall width):

f ( x ) = A sin ( k x ) + B cos ( k x )

f ( x ) = k ( A cos ( k x ) B sin ( k x ) ) = 0

tan ( k x ) = A B

x = arctan ( A / B ) k

x = arctan ( α / k ) k

Motivation

This is a project for Python Lab https://sylabusy.agh.edu.pl/pl/document/8cdc4249-ac97-43c9-b0f7-ea2abdeb50a9.html. Coop with @michal1563.

References

About

Finite Potential Well Simulation in Python.

Topics

Resources

License

Stars

Watchers

Forks

Languages