-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdoubleSlit.py
More file actions
53 lines (41 loc) · 1.34 KB
/
doubleSlit.py
File metadata and controls
53 lines (41 loc) · 1.34 KB
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
"""
Simulation of the double slit experiment.
Created on: 28-04-2017.
@author: eduardo
"""
import numpy as np
import simulation as sm
import quantum_plots as qplots
import matplotlib.pyplot as plt
# Define the system parameters and domain
dim = 2
numberPoints = 100
dt = .001
dirichletBC = False
startPoint = [0, 0]
domainLength = 2
def doubleSlit(x, y):
'''A potential wall with two identical apertures'''
sS = .4 # Slit separation
sW = .05 # Slits width
spX = .5 # X coordinate start
spY = 1 # Y coordinate of center of slits
bW = 0.03 # Barrier width
mag = 20000 # Barrier potential
if x > spX and x < spX+bW and (y < spY-sS/2. or y > spY+sS/2.):
return mag
if x > spX and x < spX+bW and (y > spY-sS/2.+sW and y < spY+sS/2.-sW):
return mag
else:
return 0
# Create the simulation for the system
sim = sm.Simulation(dim=dim, potentialFunc=doubleSlit,
dirichletBC=dirichletBC, numberPoints=numberPoints,
startPoint=startPoint, domainLength=domainLength,
dt=dt)
# Create the initial wave function
sim.setPsiPulse(pulse="circular", energy=1000, center=[.1, 1],vel=[2, 0], width=.3)
# System evolution and Animation
ani = qplots.animation2D(sim, psi="norm",
potentialFunc=doubleSlit, save=False)
plt.show()