aboutsummaryrefslogtreecommitdiff
path: root/hw8/tightbinding.jl
diff options
context:
space:
mode:
authorsotech117 <michael_foiani@brown.edu>2024-04-27 04:25:23 -0400
committersotech117 <michael_foiani@brown.edu>2024-04-27 04:25:23 -0400
commite650ed1e1e908e51c78c1b047bec0da7c4fea366 (patch)
tree1fe238de7ca199b7fdee9bc29395080b3c4790e7 /hw8/tightbinding.jl
parent02756d17bca6f2b3bafa3f7b9fb6e5af438e94a0 (diff)
testing
Diffstat (limited to 'hw8/tightbinding.jl')
-rw-r--r--hw8/tightbinding.jl24
1 files changed, 24 insertions, 0 deletions
diff --git a/hw8/tightbinding.jl b/hw8/tightbinding.jl
new file mode 100644
index 0000000..0d1cc8c
--- /dev/null
+++ b/hw8/tightbinding.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)
+
+