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

Installation

pip install ristikko, or clone this repo, cd into and pip install . to run the master version.

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.2.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.2-py3-none-any.whl (38.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ristikko-0.1.2.tar.gz
Algorithm Hash digest
SHA256 29049bd6edbb251bb04bfca80f2ad0545dc7c299e053004cc9fb8165d8ecfecf
MD5 ae74923f4a58b5d1b1f7dd01f04dbb82
BLAKE2b-256 5f16c2483904002463a0ab4ae787a967484d1bdf5536e71ca2850b83612f9bcc

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ristikko-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3a916c5ee4c684db7117aa2033fc743d3dcd0868133c0fe5796cd67110d9f6f3
MD5 7e39d4ae4c216ac487d9e3253c2ea345
BLAKE2b-256 c516823a17dd393476a8ed3649d79d3e6b0b4ef4470e7c1bc2a3081a38369362

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