Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
MeanFi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
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
Quantum Tinkerer
MeanFi
Commits
fe73a095
Commit
fe73a095
authored
1 year ago
by
Antonio Manesco
Browse files
Options
Downloads
Patches
Plain Diff
check hermiticity
parent
2f7f5b59
No related branches found
No related tags found
1 merge request
!3
create solvers and interface modules
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
codes/utils.py
+11
-6
11 additions, 6 deletions
codes/utils.py
with
11 additions
and
6 deletions
codes/utils.py
+
11
−
6
View file @
fe73a095
...
@@ -164,17 +164,16 @@ def model2hk(tb_model):
...
@@ -164,17 +164,16 @@ def model2hk(tb_model):
bloch_ham : function
bloch_ham : function
Evaluates the Hamiltonian at a given k-point.
Evaluates the Hamiltonian at a given k-point.
"""
"""
assert
len
(
next
(
iter
(
tb_model
)))
>
0
,
"
Zero-dimensional system. The Hamiltonian is simply tb_model[()].
"
assert
(
len
(
next
(
iter
(
tb_model
)))
>
0
),
"
Zero-dimensional system. The Hamiltonian is simply tb_model[()].
"
def
bloch_ham
(
k
):
def
bloch_ham
(
k
):
ham
=
0
ham
=
0
for
vector
in
tb_model
.
keys
():
for
vector
in
tb_model
.
keys
():
ham
+=
tb_model
[
vector
]
*
np
.
exp
(
ham
+=
tb_model
[
vector
]
*
np
.
exp
(
1j
*
np
.
dot
(
k
,
np
.
array
(
vector
,
dtype
=
float
))
1j
*
np
.
dot
(
k
,
np
.
array
(
vector
,
dtype
=
float
))
)
)
# if np.linalg.norm(np.array(vector)) > 0:
# ham += tb_model[vector].T.conj() * np.exp(
# -1j * np.dot(k, np.array(vector))
# )
return
ham
return
ham
return
bloch_ham
return
bloch_ham
...
@@ -212,6 +211,9 @@ def kgrid_hamiltonian(nk, hk, dim, return_ks=False):
...
@@ -212,6 +211,9 @@ def kgrid_hamiltonian(nk, hk, dim, return_ks=False):
for
k
in
product
(
*
k_pts
):
for
k
in
product
(
*
k_pts
):
ham
.
append
(
hk
(
k
))
ham
.
append
(
hk
(
k
))
ham
=
np
.
array
(
ham
)
ham
=
np
.
array
(
ham
)
assert
np
.
allclose
(
ham
,
np
.
transpose
(
ham
,
(
0
,
2
,
1
)).
conj
()
),
"
Tight-binding provided is non-Hermitian. Not supported yet
"
shape
=
(
*
[
nk
]
*
dim
,
ham
.
shape
[
-
1
],
ham
.
shape
[
-
1
])
shape
=
(
*
[
nk
]
*
dim
,
ham
.
shape
[
-
1
],
ham
.
shape
[
-
1
])
if
return_ks
:
if
return_ks
:
return
ham
.
reshape
(
*
shape
),
ks
return
ham
.
reshape
(
*
shape
),
ks
...
@@ -247,6 +249,7 @@ def build_interacting_syst(builder, lattice, func_onsite, func_hop, max_neighbor
...
@@ -247,6 +249,7 @@ def build_interacting_syst(builder, lattice, func_onsite, func_hop, max_neighbor
int_builder
[
lattice
.
neighbors
(
neighbors
+
1
)]
=
func_hop
int_builder
[
lattice
.
neighbors
(
neighbors
+
1
)]
=
func_hop
return
int_builder
return
int_builder
def
generate_guess
(
vectors
,
ndof
,
scale
=
0.1
):
def
generate_guess
(
vectors
,
ndof
,
scale
=
0.1
):
"""
"""
nk : int
nk : int
...
@@ -271,8 +274,10 @@ def generate_guess(vectors, ndof, scale=0.1):
...
@@ -271,8 +274,10 @@ def generate_guess(vectors, ndof, scale=0.1):
return
guess
return
guess
def
generate_vectors
(
cutoff
,
dim
):
def
generate_vectors
(
cutoff
,
dim
):
return
[
*
product
(
*
([[
*
range
(
-
cutoff
,
cutoff
+
1
)]]
*
dim
))]
return
[
*
product
(
*
([[
*
range
(
-
cutoff
,
cutoff
+
1
)]]
*
dim
))]
def
hk2tb_model
(
hk
,
hopping_vecs
,
ks
=
None
):
def
hk2tb_model
(
hk
,
hopping_vecs
,
ks
=
None
):
"""
"""
...
...
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