Skip to main content

Classes and utils for tight-binding models

Project description

ristikko

A library for tight-binding simulations, with a particular focus on realistic systems, disorder and impurities.

Some examples are found in the examples/ directory.

For quantum transport, consider using kwant or pyqula.

Features

  • Single-particle Hamiltonians, 0d, 1d, 2d (3d possible but not yet implemented).
  • Spinless/spinful/multiorbital basis
  • Arbitrarily complicated superlattice/sublattice structure
  • Arbitrarily distant hoppings
  • Arbitrary number of impurities
  • Disorder, can be applied to onsite potentials or hoppings
  • Superconductivity, magnetism, spin-orbit coupling
  • Electronic structure
  • Local density of states, resolved over the full basis
  • Chern numbers, winding numbers, Z2 invariants
  • Build from DFT models

Brief examples

Create a square lattice and plot

params = Params(dict(
    N1 = 16,
    N2 = 16,
    mu = 0,
    t = 1,
    pbc = False,
))

lattice = models.Square()
sys = System(Space.RealSpace, lattice, params)
sys.plot()

Calculate the local density of states

omega = np.linspace(-1, 1, 1001)
ldos = sys.calc_ldos(omega)

Calculate the spectra

points = np.array([
    [0, 0],
    [0.5, 0],
    [0.5, 0.5],
    [0, 0.5],
    [0, 0]
]) * 2 * np.pi
Ks = np.array(k_path(101, points))

sys = System(Space.KSpace, lattice, params)
Ek = sys.diagonalise(k=Ks)

Phase diagram for a toy model for a topological superconductor

@vectorize_parallel
def calc(mu, J):
    params = dict(
            t = 1,
            mu = mu.tolist(),
            Jz = J.tolist(),
            alpha = 0.5,
            Delta = 1,
            direction = "a2",
    )
    params = Params(params)

    lattice = models.Square()
    sys = System(Space.KSpace, lattice, params)
    M = sys.calc_majorana()
    return M

Mus = np.linspace(-4, 4, 301)
Js = np.linspace(-4, 4, 303)

M = calc(Mus[None, :], Js[:, None], mem=mem, progress=True)

fig, axis = plt.subplots(figsize=(4, 4))
cmap = colours.BlackWhite()
im = axis.pcolormesh(Mus, Js, M, cmap=cmap)
add_colourbar(fig, axis, im)

Shiba chain on a substrate

params = dict(
    N1 = 11,
    N2 = 6,
    t = 1,
    mu = -2,
    alpha = 0.5,
    Delta = 1,
    impurities = dict(
        t = 1,
        mu = 0.5,
        J = 2.5,
    ),
    pbc = False,
)
params = Params(params)

t = Symbol("impurities.t")
mu = Symbol("impurities.mu")
J = Symbol("impurities.J")
lattice = models.Square()
realspace = System(Space.RealSpace, lattice, params)
idxs = np.arange(params.N1*params.N2).reshape(params.N1, params.N2)
y = 3
for x in range(params.N1-1):
    idx = realspace.add_impurity(coord=(x+0.5, y-0.5))
    imp = realspace.impurities[idx]
    idxs[x, y] = idx

    imp.add_hopping(imp, 0, 0, mu + J)
    imp.add_hopping(imp, 1, 1, mu + (-1 * J))

    for i in range(2):
        if x > 0:
            imp1 = realspace.impurities[idxs[x-1, y]]
            imp.add_hopping(imp1, i, i, t)

        imp.add_hopping(Site(x, y, 0, 0), i, i, t)

        imp.add_hopping(Site((x+1)%params.N1, y, 0, 0), i, i, t)
        imp.add_hopping(Site(x, y-1, 0, 0), i, i, t)

        imp.add_hopping(Site((x+1)%params.N1, (y-1)%params.N1, 0, 0), i, i, t)

realspace.plot(aspect=6/11, axis_scale=5)

Disordered lattice

params = Params(dict(
    N1 = 16,
    N2 = 16,
    mu = 0,
    t = 1,
    pbc = False,
    seed = 0,
    scale = 1,
))

lattice = models.Square()
sys = System(Space.RealSpace, lattice, params)

def potential_disorder(params, ts, ij):
    rng = numpy.random.default_rng(params.seed)
    mu = rng.normal(size=(params.N1, params.N2), scale=params.scale)
    for n in range(ts.size):
        x0, y0, x1, y1, i, j = ij[n]
        if i == j and x0 == x1 and y0 == y0:
            ts[n] = mu[x0, y0]
    return ts, ij


H = sys.hamiltonian(postprocess_hoppings=potential_disorder)

Homepage

https://git.sr.ht/~dcrawford/ristikko

Licence

GPLv3+

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ristikko-0.1.0.tar.gz (1.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ristikko-0.1.0-py3-none-any.whl (37.7 kB view details)

Uploaded Python 3

File details

Details for the file ristikko-0.1.0.tar.gz.

File metadata

  • Download URL: ristikko-0.1.0.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for ristikko-0.1.0.tar.gz
Algorithm Hash digest
SHA256 532ce0c1f0a2359a9892cd2971e2979a67c9a9e19c39153dcfecde6f70523ff8
MD5 008048b61772ce41dd385071d6ecbffe
BLAKE2b-256 d06ef1f997a355608b02ccd1f55d6ba957faf55853bc0b8de0c3455a031d39ae

See more details on using hashes here.

File details

Details for the file ristikko-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ristikko-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 37.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for ristikko-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f546e869ff41ffc9b7f07fb91d978ff24d167313a51426bfcb1e77de3cb2a85f
MD5 bcf639c767a7ade8d278f10be6ac146a
BLAKE2b-256 978c672a01a44fdb28e7ed346eeb8a1521a101b50dca31037d938111d6735f30

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page