forked from quantum-visualizations/qmsolve
-
Notifications
You must be signed in to change notification settings - Fork 0
/
1D_interactive_fermions.py
34 lines (21 loc) · 767 Bytes
/
1D_interactive_fermions.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
import numpy as np
from qmsolve import Hamiltonian, TwoFermions, init_visualization
def harmonic_interaction(fermions):
k = 50 # measured in eV / (Å**2)
l0 = 5 # measured in Å
V = 0.5*k*(fermions.x1 - fermions.x2 - l0) **2
return V
def coulomb_interaction(fermions):
k = 500. # measured in eV * Å
r = np.abs(fermions.x1 - fermions.x2)
r = np.where(r < 0.0001, 0.0001, r)
V = k/ r
return V
H = Hamiltonian(particles = TwoFermions(),
potential = coulomb_interaction, # change this to harmonic_interaction to check what happens!
spatial_ndim = 1, N = 200, extent = 10)
eigenstates = H.solve(max_states = 90)
print(eigenstates.energies)
visualization = init_visualization(eigenstates)
#visualization.slider_plot()
visualization.animate()