SOFT

Parameters

ℏ=1.;
m=1.;
L=200.;
n=2.^10;
dt=0.01;

Grids

dx=L/n;
x=dx Range[-n/2,n/2-1];
dp = 2 Pi/L;
p = dp Range[-n/2,n/2-1];
p = RotateLeft[p,n/2];

“Operators”

Vx= 0.002 x^2;
eV = Exp[-I Vx dt/(2ℏ)];
eP = Exp[-I p^2 dt /(2ℏ m)];

Initial Wave Function

x0=-30.;σ=5.;p0=2.;
ψ0=Exp[-(x-x0)^2/( 4σ^2)]Exp[I p0 x/ℏ];
ψ0=ψ0/(Norm[ψ0 ]Sqrt[dx]);

One Step

oneStep[ψ_]:=Module[{u=ψ},
u=eV u;
u=InverseFourier[eP Fourier[u]];
u=eV u]

Dynamics

dynamics=NestList[oneStep,ψ0,10000];

Frames

frames=Abs[dynamics[[;;;;50]]]^2;

ymax=Max[Flatten[frames]]

ListAnimate[Table[ListPlot[Transpose[{x,frames[[i]]}],PlotRange->{All,{0,ymax}}],{i,1,Length[frames]}]]