-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdouble_part.py
54 lines (43 loc) · 2.08 KB
/
double_part.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import solver
import utils
import matplotlib.pyplot as plt
import matplotlib.animation as animation
plt.rcParams.update({
"text.usetex": True,
"font.family": "Computer Modern"
})
if __name__ == "__main__":
#========== Defining the relevant parameters ==============
L = 100
Nx, Nt = (4*L, 10000)
x0 = -L/3
x1 = L/3
kappa, sigma = (500/L, L/20)
tmax = 40
#==========================================================
# Here the initial wave packet is seen as a superposition of two gaussian packet
schrodinger = solver.Schrodinger(Nx, Nt, kappa, sigma, L, x0, potential="ISW", tmax=tmax)
schrodinger.psi0 += schrodinger.gaussianPacket(schrodinger.x, x1, -schrodinger.kappa, schrodinger.sigma*0.8, norm=True)
# Solve the equation using Crank-Nicholson Scheme
schrodinger.solve()
#================ Animate the evolution of the packet (Re and Im)=====
#anim = utils.animRealImag(schrodinger)
#=====================================================================
#================ Animate the evolution of the packet (Modulus)=========
anim = utils.animModulus(schrodinger)
#=======================================================================
#==================== plot the Expected Position ====================
utils.plotExpectedPosition(schrodinger)
#plt.savefig("images/double_part/expected_plot_double_hr.png", dpi=1080, transparent=True)
#=======================================================================
#==================== plot Some ====================
utils.plotSome(schrodinger)
#plt.savefig("images/double_part/some_plot_double_hr.png", dpi=1080, transparent=True)
#=======================================================================
#==================== plot time evolution ====================
utils.plotTimeEvolution(schrodinger)
#plt.savefig("images/double_part/time_evol_double_hr.png", dpi=1080, transparent=True)
#=======================================================================
plt.figure()
utils.plotUncertainty(schrodinger)
plt.show()