Skip to content
Snippets Groups Projects
Commit eec49146 authored by Johanna Zijderveld's avatar Johanna Zijderveld
Browse files

Allow user k-array as input to tb_to_khamvector function

parent f4a17849
No related branches found
No related tags found
1 merge request!4Interface refactoring
...@@ -3,7 +3,7 @@ from scipy.fftpack import ifftn ...@@ -3,7 +3,7 @@ from scipy.fftpack import ifftn
import itertools as it import itertools as it
def tb_to_khamvector(tb, nk, ndim): def tb_to_khamvector(tb, nk, ndim, ks=None):
""" """
Real-space tight-binding model to hamiltonian on k-space grid. Real-space tight-binding model to hamiltonian on k-space grid.
...@@ -22,9 +22,9 @@ def tb_to_khamvector(tb, nk, ndim): ...@@ -22,9 +22,9 @@ def tb_to_khamvector(tb, nk, ndim):
Hamiltonian evaluated on a k-point grid. Hamiltonian evaluated on a k-point grid.
""" """
if ks is None:
ks = np.linspace(-np.pi, np.pi, nk, endpoint=False) ks = np.linspace(-np.pi, np.pi, nk, endpoint=False)
ks = np.concatenate((ks[nk // 2 :], ks[: nk // 2]), axis=0) # shift for ifft ks = np.concatenate((ks[nk // 2 :], ks[: nk // 2]), axis=0) # shift for ifft
kgrid = np.meshgrid(*([ks] * ndim), indexing="ij") kgrid = np.meshgrid(*([ks] * ndim), indexing="ij")
num_keys = len(list(tb.keys())) num_keys = len(list(tb.keys()))
...@@ -53,6 +53,10 @@ def tb_to_kfunc(tb): ...@@ -53,6 +53,10 @@ def tb_to_kfunc(tb):
------- -------
function function
A function that takes a k-space vector and returns a complex np.array. A function that takes a k-space vector and returns a complex np.array.
Notes
-----
Function doesn't work for all dimensions
""" """
def kfunc(k): def kfunc(k):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment