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
Merge requests
!6
Documentation
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Documentation
documentation
into
main
Overview
16
Commits
28
Pipelines
19
Changes
5
Merged
Kostas Vilkelis
requested to merge
documentation
into
main
10 months ago
Overview
16
Commits
28
Pipelines
19
Changes
5
Expand
Construct the documentation for the release of the package.
0
0
Merge request reports
Viewing commit
1194fdf1
Prev
Next
Show latest version
5 files
+
27
−
7
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
1194fdf1
add kgrid_to_tb fun; bump down the default nk values
· 1194fdf1
Kostas Vilkelis
authored
10 months ago
pymf/tb/utils.py
+
46
−
26
Options
from
itertools
import
product
import
numpy
as
np
from
pymf.mf
import
fermi_on_grid
from
pymf.tb.transforms
import
tb_to_khamvector
from
pymf.tb.tb
import
_tb_type
from
pymf.mf
import
fermi_on_kgrid
from
pymf.tb.transforms
import
tb_to_kgrid
def
generate_guess
(
vectors
,
ndof
,
scale
=
1
):
"""
Generate guess for a tight-binding model.
def
generate_guess
(
tb_keys
:
list
[
tuple
[
None
]
|
tuple
[
int
,
...]],
ndof
:
int
,
scale
:
float
=
1
)
->
_tb_type
:
"""
Generate hermitian guess tight-binding dictionary.
Parameters
----------
vectors : list
List of hopping vectors.
ndof : int
Number internal degrees of freedom (orbitals),
scale : float
The scale of the guess. Maximum absolute value of each element of the guess.
tb_keys :
List of hopping vectors (tight-binding dictionary keys) the guess contains.
ndof :
Number internal degrees of freedom within the unit cell.
scale :
Scale of the random guess.
Returns
-------
guess : tb dictionary
Guess in the form of a
tight-binding
model
.
:
Hermitian guess
tight-binding
dictionary
.
"""
guess
=
{}
for
vector
in
vector
s
:
for
vector
in
tb_key
s
:
if
vector
not
in
guess
.
keys
():
amplitude
=
scale
*
np
.
random
.
rand
(
ndof
,
ndof
)
phase
=
2
*
np
.
pi
*
np
.
random
.
rand
(
ndof
,
ndof
)
@@ -40,25 +41,44 @@ def generate_guess(vectors, ndof, scale=1):
return
guess
def
generate_
vector
s
(
cutoff
,
dim
)
:
"""
Generate
hopping vector
s up to a cutoff.
def
generate_
tb_key
s
(
cutoff
:
int
,
dim
:
int
)
->
list
[
tuple
[
None
]
|
tuple
[
int
,
...]]
:
"""
Generate
tight-binding dictionary key
s up to a cutoff.
Parameters
----------
cutoff :
int
Maximum distance along each di
rection
.
dim :
int
Dimension of the
vectors
.
cutoff :
Maximum distance along each di
mension to generate tight-bindign dictionary keys for
.
dim :
Dimension of the
tight-binding dictionary
.
Returns
-------
List of hopping vectors.
:
List of generated tight-binding dictionary keys up to a cutoff.
"""
return
[
*
product
(
*
([[
*
range
(
-
cutoff
,
cutoff
+
1
)]]
*
dim
))]
def
calculate_fermi_energy
(
tb
,
filling
,
nk
=
100
):
"""
Calculate the Fermi energy for a given filling.
"""
kham
=
tb_to_khamvector
(
tb
,
nk
,
ks
=
None
)
def
calculate_fermi_energy
(
tb
:
_tb_type
,
filling
:
float
,
nk
:
int
=
100
):
"""
Calculate the Fermi energy of a given tight-binding dictionary.
Parameters
----------
tb :
Tight-binding dictionary.
filling :
Number of particles in a unit cell.
Used to determine the Fermi level.
nk :
Number of k-points in a grid to sample the Brillouin zone along each dimension.
If the system is 0-dimensional (finite), this parameter is ignored.
Returns
-------
:
Fermi energy.
"""
kham
=
tb_to_kgrid
(
tb
,
nk
)
vals
=
np
.
linalg
.
eigvalsh
(
kham
)
return
fermi_on_grid
(
vals
,
filling
)
return
fermi_on_
k
grid
(
vals
,
filling
)
Loading