tbkit 0.6.0__tar.gz → 0.6.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. {tbkit-0.6.0/tbkit.egg-info → tbkit-0.6.1}/PKG-INFO +2 -2
  2. {tbkit-0.6.0 → tbkit-0.6.1}/README.md +1 -1
  3. {tbkit-0.6.0 → tbkit-0.6.1}/pyproject.toml +1 -1
  4. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/__init__.py +1 -1
  5. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/transport.py +59 -36
  6. {tbkit-0.6.0 → tbkit-0.6.1/tbkit.egg-info}/PKG-INFO +2 -2
  7. {tbkit-0.6.0 → tbkit-0.6.1}/LICENSE +0 -0
  8. {tbkit-0.6.0 → tbkit-0.6.1}/setup.cfg +0 -0
  9. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/bdg.py +0 -0
  10. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/bridges.py +0 -0
  11. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/continuum.py +0 -0
  12. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/dos.py +0 -0
  13. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/error_handling.py +0 -0
  14. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/exceptional.py +0 -0
  15. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/floquet.py +0 -0
  16. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/graphene.py +0 -0
  17. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/higher_order.py +0 -0
  18. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/io.py +0 -0
  19. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/kpm.py +0 -0
  20. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/kspace.py +0 -0
  21. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/lattice.py +0 -0
  22. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/lattices.py +0 -0
  23. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/meanfield.py +0 -0
  24. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/moire.py +0 -0
  25. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/neighbours.py +0 -0
  26. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/occupation.py +0 -0
  27. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/optics.py +0 -0
  28. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/orbital.py +0 -0
  29. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/plot.py +0 -0
  30. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/propagation.py +0 -0
  31. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/py.typed +0 -0
  32. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/save.py +0 -0
  33. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/slater_koster.py +0 -0
  34. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/system.py +0 -0
  35. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/topology.py +0 -0
  36. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/values.py +0 -0
  37. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit/wannier.py +0 -0
  38. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit.egg-info/SOURCES.txt +0 -0
  39. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit.egg-info/dependency_links.txt +0 -0
  40. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit.egg-info/requires.txt +0 -0
  41. {tbkit-0.6.0 → tbkit-0.6.1}/tbkit.egg-info/top_level.txt +0 -0
  42. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_analysis.py +0 -0
  43. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_berry_response.py +0 -0
  44. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_bridges.py +0 -0
  45. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_continuum.py +0 -0
  46. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_correlations.py +0 -0
  47. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_dos.py +0 -0
  48. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_error_handling.py +0 -0
  49. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_error_handling_structures.py +0 -0
  50. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_exceptional.py +0 -0
  51. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_floquet.py +0 -0
  52. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_graphene.py +0 -0
  53. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_green_occupation.py +0 -0
  54. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_hall.py +0 -0
  55. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_higher_order.py +0 -0
  56. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_interactions.py +0 -0
  57. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_invariants.py +0 -0
  58. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_io.py +0 -0
  59. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_kpm.py +0 -0
  60. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_kspace.py +0 -0
  61. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_large_lattices.py +0 -0
  62. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_lattice.py +0 -0
  63. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_lattices.py +0 -0
  64. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_magnetic.py +0 -0
  65. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_moire.py +0 -0
  66. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_neighbours.py +0 -0
  67. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_non_hermitian_bands.py +0 -0
  68. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_optics.py +0 -0
  69. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_orbitals.py +0 -0
  70. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_periodic.py +0 -0
  71. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_plot.py +0 -0
  72. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_propagation.py +0 -0
  73. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_regressions.py +0 -0
  74. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_save.py +0 -0
  75. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_smatrix.py +0 -0
  76. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_surface_spectral.py +0 -0
  77. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_system.py +0 -0
  78. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_three_d.py +0 -0
  79. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_topology.py +0 -0
  80. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_transport.py +0 -0
  81. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_transport_response.py +0 -0
  82. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_values.py +0 -0
  83. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_wannier90.py +0 -0
  84. {tbkit-0.6.0 → tbkit-0.6.1}/tests/test_wannier_functions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tbkit
3
- Version: 0.6.0
3
+ Version: 0.6.1
4
4
  Summary: A Python package to build and solve Tight-Binding models.
5
5
  Author-email: Charles Poli <cpoli374@gmail.com>
6
6
  Maintainer-email: Charles Poli <cpoli374@gmail.com>
@@ -44,7 +44,7 @@ Dynamic: license-file
44
44
 
45
45
  | | |
46
46
  |:--|:-:|
47
- | Package | [![PyPI version](https://badgen.net/pypi/v/tbkit)](https://pypi.org/project/tbkit/) [![conda-forge](https://img.shields.io/conda/vn/conda-forge/tbkit)](https://anaconda.org/conda-forge/tbkit) [![Python versions](https://badgen.net/pypi/python/tbkit)](https://pypi.org/project/tbkit/) [![DOI](https://zenodo.org/badge/1381398706.svg)](https://zenodo.org/badge/latestdoi/1381398706) |
47
+ | Package | [![PyPI version](https://badgen.net/pypi/v/tbkit)](https://pypi.org/project/tbkit/) [![conda-forge](https://img.shields.io/conda/vn/conda-forge/tbkit)](https://anaconda.org/conda-forge/tbkit) [![Python versions](https://badgen.net/pypi/python/tbkit)](https://pypi.org/project/tbkit/) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.23333832.svg)](https://doi.org/10.5281/zenodo.23333832) |
48
48
  | Quality | [![License](https://badgen.net/github/license/cpoli/tbkit)](https://github.com/cpoli/tbkit/blob/master/LICENSE) [![CI](https://github.com/cpoli/tbkit/actions/workflows/ci.yml/badge.svg)](https://github.com/cpoli/tbkit/actions/workflows/ci.yml) [![Coverage](https://codecov.io/gh/cpoli/tbkit/branch/master/graph/badge.svg)](https://codecov.io/gh/cpoli/tbkit) |
49
49
  | Documentation | [![Docs](https://badgen.net/badge/docs/cpoli.github.io%2Ftbkit/blue)](https://cpoli.github.io/tbkit/) |
50
50
  | Downloads | [![Downloads](https://static.pepy.tech/badge/tbkit)](https://pepy.tech/project/tbkit) [![Downloads/Month](https://static.pepy.tech/badge/tbkit/month)](https://pepy.tech/project/tbkit) |
@@ -2,7 +2,7 @@
2
2
 
3
3
  | | |
4
4
  |:--|:-:|
5
- | Package | [![PyPI version](https://badgen.net/pypi/v/tbkit)](https://pypi.org/project/tbkit/) [![conda-forge](https://img.shields.io/conda/vn/conda-forge/tbkit)](https://anaconda.org/conda-forge/tbkit) [![Python versions](https://badgen.net/pypi/python/tbkit)](https://pypi.org/project/tbkit/) [![DOI](https://zenodo.org/badge/1381398706.svg)](https://zenodo.org/badge/latestdoi/1381398706) |
5
+ | Package | [![PyPI version](https://badgen.net/pypi/v/tbkit)](https://pypi.org/project/tbkit/) [![conda-forge](https://img.shields.io/conda/vn/conda-forge/tbkit)](https://anaconda.org/conda-forge/tbkit) [![Python versions](https://badgen.net/pypi/python/tbkit)](https://pypi.org/project/tbkit/) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.23333832.svg)](https://doi.org/10.5281/zenodo.23333832) |
6
6
  | Quality | [![License](https://badgen.net/github/license/cpoli/tbkit)](https://github.com/cpoli/tbkit/blob/master/LICENSE) [![CI](https://github.com/cpoli/tbkit/actions/workflows/ci.yml/badge.svg)](https://github.com/cpoli/tbkit/actions/workflows/ci.yml) [![Coverage](https://codecov.io/gh/cpoli/tbkit/branch/master/graph/badge.svg)](https://codecov.io/gh/cpoli/tbkit) |
7
7
  | Documentation | [![Docs](https://badgen.net/badge/docs/cpoli.github.io%2Ftbkit/blue)](https://cpoli.github.io/tbkit/) |
8
8
  | Downloads | [![Downloads](https://static.pepy.tech/badge/tbkit)](https://pepy.tech/project/tbkit) [![Downloads/Month](https://static.pepy.tech/badge/tbkit/month)](https://pepy.tech/project/tbkit) |
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "tbkit"
7
- version = "0.6.0"
7
+ version = "0.6.1"
8
8
  description = "A Python package to build and solve Tight-Binding models."
9
9
  readme = "README.md"
10
10
  license = "BSD-3-Clause"
@@ -6,7 +6,7 @@
6
6
 
7
7
  """tbkit: build and solve Tight-Binding models."""
8
8
 
9
- __version__ = "0.6.0"
9
+ __version__ = "0.6.1"
10
10
 
11
11
  __all__ = [
12
12
  "Lattice", "System", "Plot", "Propagation", "Save", "KSpace",
@@ -251,7 +251,9 @@ def lead_modes(
251
251
  \begin{pmatrix} 1 & 0\\ 0 & v\end{pmatrix}
252
252
  \begin{pmatrix}\phi\\ \lambda\phi\end{pmatrix}\, ,
253
253
 
254
- solved by the QZ algorithm, so that a singular :math:`v` is allowed. The
254
+ solved as an ordinary eigenproblem when :math:`v` is well conditioned,
255
+ and by the QZ algorithm otherwise, so that a singular :math:`v` is
256
+ allowed (in real arithmetic for a real lead). The
255
257
  modes with :math:`|\lambda| = 1` propagate with the velocity
256
258
  :math:`dE/dk = -2\,\mathrm{Im}(\lambda\phi^\dagger v\phi)` (diagonalized
257
259
  within degenerate modes). There is no broadening :math:`\eta`, so the
@@ -335,15 +337,28 @@ def _lead_modes(
335
337
  return modes, sum(len(b) for b in block), np.hstack(out0 + ev0), np.hstack(out1 + ev1)
336
338
  error_handling.hermitian_operator(h0)
337
339
  m = len(h0)
340
+ # real arithmetic for a real lead: about twice as fast
341
+ real = not (np.any(h0.imag) or np.any(v.imag))
342
+ hr, vr = (h0.real, v.real) if real else (h0, v)
343
+ output = 'real' if real else 'complex'
338
344
  eye, zero = np.eye(m), np.zeros((m, m))
339
- a = np.block([[zero, eye], [-v.conj().T, energy * eye - h0]])
340
- b = np.block([[eye, zero], [zero, v]])
345
+ a = np.block([[zero, eye], [-vr.conj().T, energy * eye - hr]])
341
346
  # decaying (|lambda| < 1, including lambda = 0) first; beta = 0 is lambda = infinity
342
- _, _, alpha, beta, _, z = LA.ordqz(a, b, sort=lambda al, be: np.abs(al) < (1 - tol) * np.abs(be),
343
- output='complex')
344
- decay = np.abs(alpha) < (1 - tol) * np.abs(beta)
345
- unit = ~decay & (np.abs(np.abs(alpha) - np.abs(beta)) <= tol * np.abs(beta)) & (beta != 0)
346
- lams = alpha[unit] / beta[unit]
347
+ if np.linalg.cond(v) < 1e4:
348
+ # invertible v: the ordinary eigenproblem of B^-1 A, an order of magnitude faster than QZ
349
+ a[m:] = LA.solve(vr, a[m:])
350
+ sort = (lambda x, y: np.hypot(x, y) < 1 - tol) if real else (lambda x: np.abs(x) < 1 - tol)
351
+ _, z, n_dec = LA.schur(a, output=output, sort=sort)
352
+ alpha, vecs = LA.eig(a)
353
+ beta = np.ones(2 * m)
354
+ else:
355
+ b = np.block([[eye, zero], [zero, vr]])
356
+ _, _, alpha, beta, _, z = LA.ordqz(a, b, sort=lambda al, be: np.abs(al) < (1 - tol) * np.abs(be),
357
+ output=output)
358
+ n_dec = int(np.sum(np.abs(alpha) < (1 - tol) * np.abs(beta)))
359
+ (alpha, beta), vecs = LA.eig(a, b, homogeneous_eigvals=True)
360
+ unit = (np.abs(np.abs(alpha) - np.abs(beta)) <= tol * np.abs(beta)) & (beta != 0)
361
+ lams, vecs = alpha[unit] / beta[unit], vecs[:m, unit]
347
362
  phi_cols: list = []
348
363
  k_list: list = []
349
364
  vel_list: list = []
@@ -355,8 +370,12 @@ def _lead_modes(
355
370
  left = [i for i in left if i not in group]
356
371
  lam = np.mean(lams[group])
357
372
  lam /= abs(lam)
358
- w, u = np.linalg.eigh(energy * eye - h0 - lam * v - np.conj(lam) * v.conj().T)
359
- phi = u[:, np.argsort(np.abs(w))[:len(group)]]
373
+ if len(group) == 1:
374
+ phi = vecs[:, group] / np.linalg.norm(vecs[:, group])
375
+ else:
376
+ # an orthonormal basis of the kernel, which eig does not guarantee
377
+ w, u = np.linalg.eigh(energy * eye - h0 - lam * v - np.conj(lam) * v.conj().T)
378
+ phi = u[:, np.argsort(np.abs(w))[:len(group)]]
360
379
  vel, rot = np.linalg.eigh(1j * (lam * phi.conj().T @ v @ phi
361
380
  - np.conj(lam) * phi.conj().T @ v.conj().T @ phi))
362
381
  error_handling.lead_band_edge(np.min(np.abs(vel)) > tol, energy)
@@ -367,7 +386,7 @@ def _lead_modes(
367
386
  ks, vels = np.array(k_list), np.concatenate(vel_list) if vel_list else np.zeros(0)
368
387
  order = np.lexsort((ks, vels > 0)) # incoming (v < 0) first, then by momentum
369
388
  phis, ks, vels = phis[:, order], ks[order], vels[order]
370
- n_in, n_dec = int(np.sum(vels < 0)), int(np.sum(decay))
389
+ n_in = int(np.sum(vels < 0))
371
390
  error_handling.lead_band_edge(2 * n_in == len(vels) and n_in + n_dec == m, energy)
372
391
  out = phis[:, n_in:]
373
392
  u0 = np.hstack([out, z[:m, :n_dec]])
@@ -753,8 +772,8 @@ class Transport():
753
772
  if eta is None and hermitian and lead_in != lead_out:
754
773
  out = np.zeros(len(energies))
755
774
  for n, e in enumerate(energies):
756
- modes, sol = self._scattering(float(e), [lead_in])
757
- a = self._ham.shape[0] + sum(len(h0) for h0, _, _, _ in self.leads[:lead_out])
775
+ modes, sol = self._scattering(float(e), [lead_in], slice(self._ham.shape[0], None))
776
+ a = sum(len(h0) for h0, _, _, _ in self.leads[:lead_out])
758
777
  n_out = int(np.sum(modes[lead_out].velocities > 0))
759
778
  out[n] = np.sum(np.abs(sol[a:a + n_out]) ** 2)
760
779
  return out
@@ -773,7 +792,7 @@ class Transport():
773
792
  # Scattering matrix and scattering states
774
793
  # ------------------------------------------------------------------
775
794
 
776
- def _scattering(self, energy: float, inject: list[int]) -> tuple:
795
+ def _scattering(self, energy: float, inject: list[int], keep: slice = slice(None)) -> tuple:
777
796
  r'''
778
797
  Private method. Solve the scattering problem for every incoming mode
779
798
  of the leads *inject* (Groth et al. 2014). In lead :math:`l`, the
@@ -790,28 +809,30 @@ class Transport():
790
809
  -\tau_l^\dagger\psi + [(E - h_0)U_0 - vU_1]b_l = -(E - h_0 - \lambda_{in}v)\phi^{in}_l\, ,
791
810
 
792
811
  one sparse system of size n_sites + sum_l m_l, factorized once
793
- (*scipy.sparse.linalg.splu*) for every right-hand side.
812
+ (*scipy.sparse.linalg.splu*) for every right-hand side. Only the rows
813
+ *keep* of the solution are stored (e.g. the lead amplitudes for the
814
+ scattering matrix).
794
815
 
795
816
  :returns:
796
817
  * **modes** -- List of **LeadModes**, one per lead.
797
- * **sol** -- Complex ndarray, shape (n_sites + sum_l m_l, n_in): one
798
- column per incoming mode of the leads *inject*, in order.
818
+ * **sol** -- Complex ndarray, shape (n_sites + sum_l m_l, n_in) before
819
+ *keep*: one column per incoming mode of the leads *inject*, in order.
799
820
  '''
800
821
  error_handling.real_number(energy, 'energy')
801
822
  n = self._ham.shape[0]
802
823
  found = [_lead_modes(h0, v, energy, law) for (h0, v, _, _), law in zip(self.leads, self._laws)]
803
824
  size = n + sum(len(h0) for h0, _, _, _ in self.leads)
804
825
  device = (energy * sp.eye(n, dtype='c16') - self._ham).tocoo()
805
- rows, cols, vals = [device.row], [device.col], [device.data]
826
+ coo = ([device.row], [device.col], [device.data])
827
+ rhs_coo: tuple = ([], [], [])
806
828
 
807
- def block(r, c, values):
829
+ def block(r, c, values, out=coo):
808
830
  rr, cc = np.meshgrid(r, c, indexing='ij')
809
- rows.append(rr.ravel())
810
- cols.append(cc.ravel())
811
- vals.append(values.ravel())
831
+ out[0].append(rr.ravel())
832
+ out[1].append(cc.ravel())
833
+ out[2].append(values.ravel())
812
834
 
813
- rhs_cols: list = []
814
- a = n
835
+ n_rhs, a = 0, n
815
836
  for l, ((h0, v, tau, sites), (modes, n_in, u0, u1)) in enumerate(zip(self.leads, found)):
816
837
  m = len(h0)
817
838
  lead = np.arange(a, a + m)
@@ -821,17 +842,19 @@ class Transport():
821
842
  block(lead, lead, e_h0 @ u0 - v @ u1)
822
843
  if l in inject:
823
844
  phi = modes.wave_functions[:, :n_in]
824
- col = np.zeros((size, n_in), 'c16')
825
- col[sites] = tau @ phi
826
- col[a:a + m] = -(e_h0 @ phi - v @ phi * np.exp(1j * modes.momenta[:n_in]))
827
- rhs_cols.append(col)
845
+ cols = np.arange(n_rhs, n_rhs + n_in)
846
+ block(sites, cols, tau @ phi, rhs_coo)
847
+ block(lead, cols, -(e_h0 @ phi - v @ phi * np.exp(1j * modes.momenta[:n_in])), rhs_coo)
848
+ n_rhs += n_in
828
849
  a += m
829
- rhs = np.hstack(rhs_cols) if rhs_cols else np.zeros((size, 0), 'c16')
830
- if rhs.shape[1] == 0:
831
- return [f[0] for f in found], rhs
832
- mat = sp.csc_matrix((np.concatenate(vals), (np.concatenate(rows), np.concatenate(cols))),
833
- shape=(size, size))
834
- sol = spla.splu(mat).solve(rhs)
850
+ if n_rhs == 0:
851
+ return [f[0] for f in found], np.zeros((size, 0), 'c16')[keep]
852
+ mat, rhs = (sp.csc_matrix((np.concatenate(x), (np.concatenate(r), np.concatenate(c))), shape=(size, s))
853
+ for (r, c, x), s in ((coo, size), (rhs_coo, n_rhs)))
854
+ lu = spla.splu(mat)
855
+ # the right-hand sides are dense in blocks of at most 64 MB
856
+ chunk = max(1, 2**22 // size)
857
+ sol = np.hstack([lu.solve(rhs[:, c:c + chunk].toarray())[keep] for c in range(0, n_rhs, chunk)])
835
858
  return [f[0] for f in found], sol
836
859
 
837
860
  def smatrix(self, energy: float) -> SMatrix:
@@ -855,8 +878,8 @@ class Transport():
855
878
  t = s.submatrix(1, 0) # transmission amplitudes, lead 0 to lead 1
856
879
  T = s.transmission(1, 0) # = tr.transmission(0.3, 0, 1)
857
880
  '''
858
- modes, sol = self._scattering(energy, list(range(len(self.leads))))
859
- rows, a = [], self._ham.shape[0]
881
+ modes, sol = self._scattering(energy, list(range(len(self.leads))), slice(self._ham.shape[0], None))
882
+ rows, a = [], 0
860
883
  for (h0, _, _, _), mode in zip(self.leads, modes):
861
884
  rows.append(sol[a:a + int(np.sum(mode.velocities > 0))])
862
885
  a += len(h0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tbkit
3
- Version: 0.6.0
3
+ Version: 0.6.1
4
4
  Summary: A Python package to build and solve Tight-Binding models.
5
5
  Author-email: Charles Poli <cpoli374@gmail.com>
6
6
  Maintainer-email: Charles Poli <cpoli374@gmail.com>
@@ -44,7 +44,7 @@ Dynamic: license-file
44
44
 
45
45
  | | |
46
46
  |:--|:-:|
47
- | Package | [![PyPI version](https://badgen.net/pypi/v/tbkit)](https://pypi.org/project/tbkit/) [![conda-forge](https://img.shields.io/conda/vn/conda-forge/tbkit)](https://anaconda.org/conda-forge/tbkit) [![Python versions](https://badgen.net/pypi/python/tbkit)](https://pypi.org/project/tbkit/) [![DOI](https://zenodo.org/badge/1381398706.svg)](https://zenodo.org/badge/latestdoi/1381398706) |
47
+ | Package | [![PyPI version](https://badgen.net/pypi/v/tbkit)](https://pypi.org/project/tbkit/) [![conda-forge](https://img.shields.io/conda/vn/conda-forge/tbkit)](https://anaconda.org/conda-forge/tbkit) [![Python versions](https://badgen.net/pypi/python/tbkit)](https://pypi.org/project/tbkit/) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.23333832.svg)](https://doi.org/10.5281/zenodo.23333832) |
48
48
  | Quality | [![License](https://badgen.net/github/license/cpoli/tbkit)](https://github.com/cpoli/tbkit/blob/master/LICENSE) [![CI](https://github.com/cpoli/tbkit/actions/workflows/ci.yml/badge.svg)](https://github.com/cpoli/tbkit/actions/workflows/ci.yml) [![Coverage](https://codecov.io/gh/cpoli/tbkit/branch/master/graph/badge.svg)](https://codecov.io/gh/cpoli/tbkit) |
49
49
  | Documentation | [![Docs](https://badgen.net/badge/docs/cpoli.github.io%2Ftbkit/blue)](https://cpoli.github.io/tbkit/) |
50
50
  | Downloads | [![Downloads](https://static.pepy.tech/badge/tbkit)](https://pepy.tech/project/tbkit) [![Downloads/Month](https://static.pepy.tech/badge/tbkit/month)](https://pepy.tech/project/tbkit) |
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes