Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • kwant kwant
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 144
    • Issues 144
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 20
    • Merge requests 20
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • kwantkwant
  • kwantkwant
  • Issues
  • #406
Closed
Open
Issue created Jun 04, 2021 by Viacheslav Ostroukh@slavoutich🚲Maintainer

Builder silently fails to conjugate hoppings, if they are not true arrays

This issue is mostly visible, if user constructs system with different lattice orbitals. For example, we construct a system with a hopping between two lattices with different number of orbitals:

import kwant

lat1 = kwant.lattice.chain(norbs=1)
lat2 = kwant.lattice.chain(norbs=2)
syst = kwant.Builder()

syst[lat1(0)] = 0
syst[lat1(2)] = 0
syst[lat2(1)] = np.array([[0, 0], [0, 0]])
syst[lat2(1), lat1(0)] = np.array([[0.5], [0.5]])
syst[lat1(2), lat2(1)] = np.array([[0.5, 0.5]])

syst.finalized().hamiltonian_submatrix()

The snippet above works. However, if we replace Numpy arrays with array-like list of lists:

...
syst[lat2(1)] = [[0, 0], [0, 0]]
syst[lat2(1), lat1(0)] = [[0.5], [0.5]]
syst[lat1(2), lat2(1)] = [[0.5, 0.5]]
...

we get an exception:

ValueError: Hopping from site 1 to site 2 does not match the dimensions of onsite Hamiltonians of these sites.

because hopping from lat2 to lat1 is erroneously not conjugated.

This is an issue with high severity, because it can lead to silent generation of wrong Hamiltonian, if lat1 and lat2 have the same norbs and hoppings are not Hermitian matrices, which is the case in general.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking