Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kwant
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Joseph Weston
kwant
Commits
a3bce5d8
Commit
a3bce5d8
authored
11 years ago
by
Christoph Groth
Browse files
Options
Downloads
Patches
Plain Diff
bugfix: make args and kwargs work for bandstructure calculations
parent
2c2715eb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
kwant/physics/dispersion.py
+7
-3
7 additions, 3 deletions
kwant/physics/dispersion.py
kwant/plotter.py
+7
-2
7 additions, 2 deletions
kwant/plotter.py
with
14 additions
and
5 deletions
kwant/physics/dispersion.py
+
7
−
3
View file @
a3bce5d8
...
@@ -20,6 +20,10 @@ class Bands(object):
...
@@ -20,6 +20,10 @@ class Bands(object):
sys : `kwant.system.InfiniteSystem`
sys : `kwant.system.InfiniteSystem`
The low level infinite system for which the energies are to be
The low level infinite system for which the energies are to be
calculated.
calculated.
args : tuple, defaults to empty
Positional arguments to pass to the ``hamiltonian`` method.
kwargs : dictionary, defaults to empty
Keyword arguments to pass to the ``hamiltonian`` method.
Notes
Notes
-----
-----
...
@@ -37,11 +41,11 @@ class Bands(object):
...
@@ -37,11 +41,11 @@ class Bands(object):
>>>
pyplot
.
show
()
>>>
pyplot
.
show
()
"""
"""
def
__init__
(
self
,
sys
):
def
__init__
(
self
,
sys
,
args
=
(),
kwargs
=
{}
):
self
.
ham
=
sys
.
slice_hamiltonian
()
self
.
ham
=
sys
.
slice_hamiltonian
(
args
=
args
,
kwargs
=
kwargs
)
if
not
np
.
allclose
(
self
.
ham
,
self
.
ham
.
T
.
conj
()):
if
not
np
.
allclose
(
self
.
ham
,
self
.
ham
.
T
.
conj
()):
raise
ValueError
(
'
The slice Hamiltonian is not Hermitian.
'
)
raise
ValueError
(
'
The slice Hamiltonian is not Hermitian.
'
)
hop
=
sys
.
inter_slice_hopping
()
hop
=
sys
.
inter_slice_hopping
(
args
=
args
,
kwargs
=
kwargs
)
self
.
hop
=
np
.
empty
(
self
.
ham
.
shape
,
dtype
=
complex
)
self
.
hop
=
np
.
empty
(
self
.
ham
.
shape
,
dtype
=
complex
)
self
.
hop
[:,
:
hop
.
shape
[
1
]]
=
hop
self
.
hop
[:,
:
hop
.
shape
[
1
]]
=
hop
self
.
hop
[:,
hop
.
shape
[
1
]:]
=
0
self
.
hop
[:,
hop
.
shape
[
1
]:]
=
0
...
...
This diff is collapsed.
Click to expand it.
kwant/plotter.py
+
7
−
2
View file @
a3bce5d8
...
@@ -850,13 +850,18 @@ def map(sys, value, colorbar=True, cmap=None,
...
@@ -850,13 +850,18 @@ def map(sys, value, colorbar=True, cmap=None,
return
output_fig
(
fig
,
file
=
file
,
show
=
show
)
return
output_fig
(
fig
,
file
=
file
,
show
=
show
)
def
bands
(
sys
,
momenta
=
65
,
file
=
None
,
show
=
True
,
dpi
=
None
,
fig_size
=
None
):
def
bands
(
sys
,
momenta
=
65
,
args
=
(),
kwargs
=
{},
file
=
None
,
show
=
True
,
dpi
=
None
,
fig_size
=
None
):
"""
Plot band structure of a translationally invariant 1D system.
"""
Plot band structure of a translationally invariant 1D system.
Parameters
Parameters
----------
----------
sys : kwant.system.InfiniteSystem
sys : kwant.system.InfiniteSystem
A system bands of which are to be plotted.
A system bands of which are to be plotted.
args : tuple, defaults to empty
Positional arguments to pass to the ``hamiltonian`` method.
kwargs : dictionary, defaults to empty
Keyword arguments to pass to the ``hamiltonian`` method.
momenta : int or 1D array-like
momenta : int or 1D array-like
Either a number of sampling points on the interval [-pi, pi], or an
Either a number of sampling points on the interval [-pi, pi], or an
array of points at which the band structure has to be evaluated.
array of points at which the band structure has to be evaluated.
...
@@ -885,7 +890,7 @@ def bands(sys, momenta=65, file=None, show=True, dpi=None, fig_size=None):
...
@@ -885,7 +890,7 @@ def bands(sys, momenta=65, file=None, show=True, dpi=None, fig_size=None):
if
momenta
.
ndim
!=
1
:
if
momenta
.
ndim
!=
1
:
momenta
=
np
.
linspace
(
-
np
.
pi
,
np
.
pi
,
momenta
)
momenta
=
np
.
linspace
(
-
np
.
pi
,
np
.
pi
,
momenta
)
bands
=
physics
.
Bands
(
sys
)
bands
=
physics
.
Bands
(
sys
,
args
=
args
,
kwargs
=
kwargs
)
energies
=
[
bands
(
k
)
for
k
in
momenta
]
energies
=
[
bands
(
k
)
for
k
in
momenta
]
fig
=
Figure
()
fig
=
Figure
()
...
...
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