Skip to content

c0rychu/SchrodingerEq_1D_tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SchrodingerEq_1D_tutorial

Solving 1-D Schrodinger Equation Numerically in either Python or C++.
Please refer to this blog article for more detail explaination of the code.

Files

  • SchrodingerEq_1D_tutorial.ipynb A tutorial of solving 1-D Schrodinger equation. (Simple-Harmonic-Oscillator)
  • step_potential/step_potential.py A script to generate the animation that shows a wave-packet scattered by a step-potential.
  • step_potential_cpp/step_potential_rk4.cpp The C++ source code for simulating a wave-packet scattered by a step-potential.
  • step_potential_cpp/plot.py A script to generate the animation from the result of step_potential_rk4.

Environment (macOS, suggested)

  1. Install MacPort
  2. Install ffmpeg (for MP4)
sudo port install ffmpeg +gpl +postproc +lame +theora +libogg +vorbis +xvid +x264 +a52 +faac +faad +dts +nonfree
  1. Install Miniconda
  2. Install Python packages
conda install numpy scipy matplotlib jupyter ipython imagemagick
  1. conda activate
  2. jupyter-notebook

Environment for C++ version (macOS, suggested)

  1. Install Eigen
# macOS
sudo port install eigen3

# Ubuntu
sudo apt install libeigen3-dev
  1. Modify step_potential_cpp/Makefile with proper path to your Eigen installation.
  2. Compile
cd step_potential_cpp
make
  1. Run and generate plots(animations)
cd step_potential_cpp
./step_potential_rk4
conda activate
./plot.py