This project contains the implementation of the Schrodinger
class, which serves as a solver for the Time-Dependent Schrödinger's Equation (TDSE) using the Crank-Nicholson method. The class provides a flexible framework to simulate the behavior of a 1D-particle trapped in a box under various potential conditions.
Nx
: Number of spatial grid points.Nt
: Number of time steps.kappa
,sigma
: Parameters for the Gaussian wave packet.L
: Length of the spatial domain.x0
: Initial position of the wave packet.potential
: Type of potential (default is Infinite Square Well).tmax
: Maximum time for simulation.
getPotential(choice)
: Method to define the potential energy based on the chosen potential type ("ISW", "tunneling", "double_part").infiniteSquareWell()
: Method to define the infinite square well potential.tunneling(x, x1, width, amp)
: Method to define the tunneling potential.getAB()
: Method to calculate matrices A and B for Crank-Nicholson.gaussianPacket(x, x0, kappa, sigma, norm=True)
: Method to generate a Gaussian wave packet.solve()
: Method to solve the time-dependent Schrödinger equation.
This file contains functions used to visualize various aspects of the simulation results generated by the Schrodinger
class defined in solver.py
.
Generates an animated plot showing the real and imaginary parts of the wave function as it evolves over time.
Generates an animated plot showing the modulus squared of the wave function as it evolves over time.
Plots the uncertainty (variance) of the wave function's position over time.
Plots the normalization of the wave function over time.
Plots the expected position of the particle over time. If ret=True
, returns the expected position array instead of plotting it.
Plots the time evolution of the wave function as a color map, showing its magnitude at each position and time.
Three example scripts are provided to demonstrate the usage of the Schrodinger
class with different potential types:
infinite_square_well.py
: Example script for simulating a particle trapped in an Infinite Square Well potential.
real_imag_anim_isw.mp4
harmonic.py
: Example script for simulating a particle trapped in a Harmonic Potential.
animation_1sur100.mp4
tunneling.py
: Example script for simulating a particle with tunneling effect.
https://github.com/MaxMnr/SchrodingerCrankNicholson/assets/88986446/b81eae2a-b1bc-4086-8e9a-1d12de723b31
double_part.py
: Example script for simulating a two particles system.
https://github.com/MaxMnr/SchrodingerCrankNicholson/assets/88986446/77517442-d06b-474e-ac33-5c5bfb4f9439