-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscattering.py
More file actions
58 lines (45 loc) · 1.34 KB
/
scattering.py
File metadata and controls
58 lines (45 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
54
55
56
57
58
"""
Simulation of Rutherford scattering.
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
sign = -1
if dirichletBC:
sign = 1
allPoints = numberPoints + sign
def scattering(x, y):
'''1/r^2 Dispersive force around a defined center '''
center = [0.5, 1.]
alpha = 10
r = np.linalg.norm([x - center[0], y - center[1]])
return alpha/r
def scatteringVis(x, y):
'''An exaggereted potential function to make it more visisble'''
center = [0.5, 1.]
r = np.linalg.norm([x - center[0], y - center[1]])
if r < .05:
return 1
else:
return 0
# Create the simulation for the system
sim = sm.Simulation(dim=dim, potentialFunc=scattering,
dirichletBC=dirichletBC, numberPoints=numberPoints,
startPoint=startPoint, domainLength=domainLength,
dt=dt)
# Create the initial wave function
sim.setPsiPulse(pulse="circular", energy=1000, vel=[1, 0], center=[.1, 1], width=.1)
# System evolution and Animation
ani = qplots.animation2D(sim, psi="norm",
potentialFunc=scatteringVis, save=False)
plt.show()