aboutsummaryrefslogtreecommitdiff
path: root/hw7/tightbinding (1).jl
diff options
context:
space:
mode:
Diffstat (limited to 'hw7/tightbinding (1).jl')
-rw-r--r--hw7/tightbinding (1).jl24
1 files changed, 24 insertions, 0 deletions
diff --git a/hw7/tightbinding (1).jl b/hw7/tightbinding (1).jl
new file mode 100644
index 0000000..0d1cc8c
--- /dev/null
+++ b/hw7/tightbinding (1).jl
@@ -0,0 +1,24 @@
+using LinearAlgebra
+
+# Define the tight binding Hamiltonian
+function tight_binding_hamiltonian(n_sites::Int64, t::Float64)
+ H = zeros(n_sites, n_sites)
+ for i in 1:(n_sites-1)
+ H[i, i+1] = t
+ H[i+1, i] = t
+ end
+ H
+end
+
+# Find the eigenenergies of the Hamiltonian
+function eigenenergies(H::Array{Float64, 2})
+ eigvals(H)
+end
+
+n_sites = 10 # number of sites in the chain
+t = 1.0 # hopping parameter
+H = tight_binding_hamiltonian(n_sites, t)
+energies = eigenenergies(H)
+println(energies)
+
+