Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bandstructure
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michael Raffetseder
bandstructure
Commits
d9e55ae9
Commit
d9e55ae9
authored
3 months ago
by
Michael Raffetseder
Browse files
Options
Downloads
Patches
Plain Diff
Improve plotting
parent
2902b4a7
Branches
main
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ex2.py
+23
-17
23 additions, 17 deletions
ex2.py
with
23 additions
and
17 deletions
ex2.py
+
23
−
17
View file @
d9e55ae9
...
...
@@ -30,8 +30,8 @@ class bandstructure:
"""
self
.
mat
=
material
max_G
=
np
.
sqrt
(
11
)
*
2
*
np
.
pi
/
s
i
.
a
self
.
lat_vecs
=
s
i
.
gen_lat_vecs
(
max_G
)
max_G
=
np
.
sqrt
(
11
)
*
2
*
np
.
pi
/
s
elf
.
mat
.
a
self
.
lat_vecs
=
s
elf
.
mat
.
gen_lat_vecs
(
max_G
)
self
.
assemble_hamiltonian_wo_diag
()
self
.
E_vals
=
None
...
...
@@ -87,7 +87,7 @@ class bandstructure:
ham
=
self
.
hamiltonian
(
k
)
return
np
.
linalg
.
eigvalsh
(
ham
)
def
compute_bandstructure
(
self
,
num_points
:
int
=
1
0
)
->
None
:
def
compute_bandstructure
(
self
,
num_points
:
int
=
2
0
)
->
None
:
"""
Generates all Energy Eigenvalues along the L-Gamma-X-U-Gamma
path of the irreducible wedge
...
...
@@ -96,7 +96,10 @@ class bandstructure:
num_points (int): the number of k-vectors between two high-symmetry points
"""
E_vals
=
[]
k_vecs
=
[]
self
.
tick_positions
=
[]
self
.
tick_labels
=
[]
i
=
0
k0
=
None
high_symmetry_points
=
[
"
L
"
,
"
Gamma
"
,
"
X
"
,
"
U
"
,
"
Gamma
"
]
...
...
@@ -107,18 +110,22 @@ class bandstructure:
if
k0
is
not
None
:
vecs
=
self
.
mat
.
gen_k_vecs
(
k0
,
k1
,
num_points
)
for
k
in
vecs
:
k_vecs
.
append
(
k
)
E_vals
.
append
(
self
.
get_E
(
k
))
i
+=
1
k_vecs
.
append
(
k1
)
E_vals
.
append
(
self
.
get_E
(
k1
))
# One tick for every high symmetry point
self
.
tick_positions
.
append
(
i
)
if
point
==
"
Gamma
"
:
point
=
r
"
$\Gamma$
"
self
.
tick_labels
.
append
(
point
)
k0
=
np
.
copy
(
k1
)
self
.
E_vals
=
np
.
array
(
E_vals
)
self
.
k_vecs
=
np
.
array
(
k_vecs
)
def
plot_bandstructure
(
self
,
filename
:
Optional
[
str
]
=
None
,
num_bands
:
int
=
3
)
->
None
:
def
plot_bandstructure
(
self
,
filename
:
Optional
[
str
]
=
None
,
num_bands
:
int
=
6
)
->
None
:
"""
Plots the num_bands lowest bands
and saves the plot to filename
...
...
@@ -135,14 +142,12 @@ class bandstructure:
layout
=
"
constrained
"
,
)
tick_positions
=
[
0
,
11
,
22
,
33
,
44
]
tick_labels
=
[
"
L
"
,
"
Gamma
"
,
"
X
"
,
"
U
"
,
"
Gamma
"
]
for
band
in
range
(
num_bands
):
ax
.
plot
(
self
.
E_vals
[:,
band
]
/
c
.
e
)
ax
.
set_xticks
(
tick_positions
)
ax
.
set_xticklabels
(
tick_labels
)
ax
.
set_xticks
(
self
.
tick_positions
)
ax
.
set_xticklabels
(
self
.
tick_labels
)
ax
.
grid
()
ax
.
set_ylabel
(
"
Energy in eV
"
,
fontsize
=
12
)
...
...
@@ -150,10 +155,11 @@ class bandstructure:
if
__name__
==
"
__main__
"
:
si
=
fcc
(
"
Si
"
)
band
=
bandstructure
(
si
)
for
mat_name
in
[
"
Si
"
,
"
Ge
"
,
"
ZnSe
"
]:
mat
=
fcc
(
mat_name
)
band
.
compute_bandstructure
()
band
.
plot_bandstructure
()
band
=
bandstructure
(
mat
)
band
.
compute_bandstructure
()
band
.
plot_bandstructure
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment