Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
kwantspectrum
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kwant
kwantspectrum
Commits
8edf45e7
Commit
8edf45e7
authored
Sep 23, 2020
by
Kloss
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change numeric tol causing problems on 32 bit
parent
8bbf6e76
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
15 deletions
+16
-15
kwantspectrum/kwant_spectrum.py
kwantspectrum/kwant_spectrum.py
+15
-14
kwantspectrum/tests/test_kwant_spectrum.py
kwantspectrum/tests/test_kwant_spectrum.py
+1
-1
No files found.
kwantspectrum/kwant_spectrum.py
View file @
8edf45e7
...
...
@@ -433,7 +433,7 @@ def _save_ordering(func):
return
wrapper
def
_match_functions
(
func
,
xmin
=-
1
,
xmax
=
1
,
tol
=
1E-
8
,
min_iter
=
10
,
def
_match_functions
(
func
,
xmin
=-
1
,
xmax
=
1
,
tol
=
1E-
10
,
min_iter
=
10
,
max_iter
=
100000
,
interval_converged
=
None
,
evaluated
=
None
):
"""Match the elements of a vector valued function, such that
each vector element describes a continous function.
...
...
@@ -555,7 +555,7 @@ def _match_functions(func, xmin=-1, xmax=1, tol=1E-8, min_iter=10,
def
spectrum
(
syst
,
args
=
(),
*
,
params
=
None
,
kmin
=-
np
.
pi
,
kmax
=
np
.
pi
,
orderpoint
=
0
,
tol
=
1E-
8
,
match
=
_match_functions
):
orderpoint
=
0
,
tol
=
1E-
10
,
match
=
_match_functions
):
r
"""Interpolate the dispersion function and provide methods to
simplify curve sketching and analyzation the periodic spectrum.
...
...
@@ -689,7 +689,7 @@ class BandSketching:
Finite accuracy of the data and possible unphysical results are taking into
account by rounding value :math:`tol`.
"""
def
__init__
(
self
,
x
,
y
,
dy
,
mode_function
,
tol
=
1E-
8
,
def
__init__
(
self
,
x
,
y
,
dy
,
mode_function
,
tol
=
1E-
10
,
interpolation
=
_cubic_interpolation
):
# type and input checks
...
...
@@ -865,19 +865,19 @@ class BandSketching:
def
intersect
(
self
,
f
,
band
,
derivative_order
=
0
,
kmin
=
None
,
kmax
=
None
,
tol
=
None
,
ytol
=
None
):
r
"""Returns all momentum (
k) points, that solves
the equation:
:math:`\partial_k^{
n} E
(k) = f(k),\, k_{min} \leq k \leq k_{max}`.
r
"""Returns all momentum (
:math:`k`) points which solve
the equation:
:math:`\partial_k^{
m} E_n
(k) = f(k),\, k_{min} \leq k \leq k_{max}`.
Parameters
----------
f : scalar numerical value or callable
Equation to solve :math:`\partial_k^{
n} E
(k) = f`.
Equation to solve :math:`\partial_k^{
m} E_n
(k) = f`.
If `f` is callable, solve equation:
:math:`\partial_k^{
n} E
(k) = f(k)`.
:math:`\partial_k^{
m} E_n
(k) = f(k)`.
band : int
band index, requirement: `0 <= band < nbands`.
band index
`n`
, requirement: `0 <= band < nbands`.
derivative_order : int, optional
Derivative order
(n)
of the band dispersion. Default is zero.
Derivative order
`m`
of the band dispersion. Default is zero.
kmin : scalar numeric value, optional
Lowest `k` point value. Default is `kmin` from initialization.
kmax : scalar numeric value, optional
...
...
@@ -887,10 +887,10 @@ class BandSketching:
point. Default is the `tol` from initialization.
ytol : float, optional
Numerical tolerance to remove noise if the
spectrum :math:`\partial_k^{
n} E
(k)` is almost flat.
Values for the spectrum are set to th
ie
r mean value
spectrum :math:`\partial_k^{
m} E_n
(k)` is almost flat.
Values for the spectrum are set to th
ei
r mean value
(averaged over all momentum points where the band is sampled), if
they flucutate
more
than `ytol`.
they flucutate
less
than `ytol`.
Default is the `tol` from initialization.
Returns
...
...
@@ -911,7 +911,7 @@ class BandSketching:
if
tol
is
None
:
tol
=
self
.
tol
if
ytol
is
None
:
ytol
=
self
.
tol
ytol
=
self
.
tol
*
100
# lower interpolant accuracy
# type and input checks
assert
_is_type
(
band
,
'integer'
)
...
...
@@ -946,8 +946,9 @@ class BandSketching:
y_mean
=
np
.
mean
(
y
)
if
_is_zero
(
y_mean
,
ytol
):
y_mean
=
0
y
[
np
.
abs
(
y
-
y_mean
)
<
ytol
]
=
y_mean
dy
[
np
.
abs
(
dy
)
<
ytol
]
=
0
dy
[
np
.
abs
(
dy
)
<
100
*
ytol
]
=
0
# derivative dy less acurate than y
roots
=
self
.
interpolation
(
self
.
x
,
y
-
f
,
dy
).
roots
()
roots
=
remove_nan
(
roots
)
...
...
kwantspectrum/tests/test_kwant_spectrum.py
View file @
8edf45e7
...
...
@@ -286,7 +286,7 @@ def test_spectrum_with_flat_band():
assert
spectrum
.
intersect
(
f
=
0
,
band
=
1
,
derivative_order
=
1
).
size
==
0
assert_array_almost_equal
([
0
],
spectrum
.
intersect
(
f
=
0
,
band
=
2
,
derivative_order
=
1
))
# the spectrum has also no
wendepunk
t
# the spectrum has also no
inflection poin
t
assert
spectrum
.
intersect
(
f
=
0
,
band
=
0
,
derivative_order
=
2
).
size
==
0
assert
spectrum
.
intersect
(
f
=
0
,
band
=
1
,
derivative_order
=
2
).
size
==
0
assert
spectrum
.
intersect
(
f
=
0
,
band
=
2
,
derivative_order
=
2
).
size
==
0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment