Bodge

Bodge: Python package for efficient tight-binding modeling of superconducting nanostructures - Published in JOSS (2024)

https://github.com/jabirali/bodge

Science Score: 100.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 10 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org
  • Committers with academic emails
    1 of 6 committers (16.7%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

bdg hamiltonian numerical-methods python python3 sparse-matrix superconductivity tight-binding
Last synced: 4 months ago · JSON representation ·

Repository

Numerical library for working with clean superconductors in Python using the Bogoliubov-de Gennes formalism

Basic Info
  • Host: GitHub
  • Owner: jabirali
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 10.5 MB
Statistics
  • Stars: 8
  • Watchers: 2
  • Forks: 1
  • Open Issues: 0
  • Releases: 2
Topics
bdg hamiltonian numerical-methods python python3 sparse-matrix superconductivity tight-binding
Created about 4 years ago · Last pushed about 1 year ago
Metadata Files
Readme Contributing License Citation

README.md

Bodge

JOSS PyPI Docs Tests

Bodge is a Python package for constructing large real-space tight-binding models. Although quite general tight-binding models can be constructed, we focus on the Bogoliubov-DeGennes ("BoDGe") Hamiltonian, which is used to model superconductivity in clean materials. In other words: If you want a lattice model for superconducting nanostructures, and want something that is computationally efficient yet easy to use, you've come to the right place.

An introduction to the Bodge software package has been published in the Journal of Open Source Software (JOSS). If you find this software useful for your research, please consider citing that article: bib @article{ouassou2024, author = {Ouassou, Jabir Ali}, doi = {10.21105/joss.07134}, journal = {Journal of Open Source Software}, number = {102}, pages = {7134}, title = {{Bodge: Python package for efficient tight-binding modeling of superconducting nanostructures}}, volume = {9}, year = {2024} } Research papers where this code has been used include:

Bodge can be used on anything from a normal laptop to an HPC cluster, as long as it runs an operating system where the SciPy stack is available (e.g. Linux, MacOS, or Windows). It is mainly meant for CPU-based or GPU-based calculations on one computer (so there is no support for e.g. MPI).

Internally, Bodge uses a sparse matrix (scipy.sparse) to represent the Hamiltonian, which allows you to efficiently construct tight-binding models with millions of lattice sites if needed. However, you can also easily convert the result to a dense matrix (numpy.array) if that's more convenient. The package follows modern software development practices: full test coverage (pytest), fast runtime type checking (beartype), and mostly PEP-8 compliant (black).

In addition to the JOSS paper you can find a Bodge tutorial here.

Quickstart

This package is published on PyPi, and is easily installed via pip:

pip install bodge

Or if you have an NVIDIA GPU and want to use that for computations (note that this requires you to install CUDA support on your system first):

pip install bodge[cuda]

Some functions in this package then accept an argument cuda=True to enable GPU acceleration of the numerical calculations.

Bodge should be quite easy to use if all you want is a real-space lattice Hamiltonian with superconductivity. For instance, consider a $100a\times100a$ s-wave superconductor with a chemical potential $μ = -3t$, superconducting gap $Δ_s = 0.1t$, magnetic spin splitting along the $z$ axis $m = 0.05t$, and nearest-neighbor hopping $t = 1$. Using Bodge, you can just write:

```python from bodge import *

lattice = CubicLattice((100, 100, 1)) system = Hamiltonian(lattice)

t = 1 μ = -3 * t m = 0.05 * t Δs = 0.10 * t

with system as (H, Δ): for i in lattice.sites(): H[i, i] = -μ * σ0 -m * σ3 Δ[i, i] = -Δs * jσ2 for i, j in lattice.bonds(): H[i, j] = -t * σ0 ```

If you are familiar with tight-binding models, you might notice that this is intentionally very close to how one might write the corresponding equations with pen and paper. It is similarly easy to model more complex systems: you can e.g. easily add p-wave or d-wave superconductivity, magnetism, altermagnetism, antiferromagnetism, spin-orbit coupling, etc. The lattice site indices are implemented as tuples i = (x_i, y_i, z_i), so that you can easily use the lattice coordinates to design inhomogeneous materials via e.g. if-tests.

The syntax used to construct the Hamiltonian is designed to look like array operations, but this is just a friendly interface; under the hood, some "magic" is required to efficiently translate what you see above into sparse matrix operations, while enforcing particle-hole and Hermitian symmetries. Once you're done with the construction, you can call system.matrix() to extract the Hamiltonian matrix itself (in dense or sparse form), or use methods such as system.diagonalize() and system.free_energy() to get derived properties.

Formally, the Hamiltonian operator that corresponds to the constructed matrix is

$$\mathcal{H} = E0 + \frac{1}{2} \sum{ij} \hat{c}^\daggeri \hat{H}{ij} \hat{c}_j,$$

where $\hat{c}_i = (c{i\uparrow}, c{i\downarrow}, c{i\uparrow}^\dagger, c{i\downarrow}^\dagger)$ is a vector of all spin-dependent electron operators on lattice site $i$ and $E0$ is a constant. The $4\times4$ matrix $\hat{H}{ij}$ in Nambu⊗Spin space is generally further decomposed into $2\times2$ blocks in spin space:

$$\hat{H}_{ij} = \begin{pmatrix} H{ij} & \Delta{ij} \\ \Delta^\dagger{ij} & -H^*{ij} \end{pmatrix}$$

It is precisely these $2\times2$ blocks $H{ij}$ and $\Delta{ij}$ that are specified when you provide Bodge with values for H[i, j] and ∆[i, j]. After the matrix construction completes, you obtain a $4N\times4N$ matrix in Lattice⊗Nambu⊗Spin space, where $N$ is the number of lattice sites. You don't need to specify the bottom row of $\hat{H}_{ij}$ as these follow from symmetry, and Bodge will warn you if the Hamiltonian is non-Hermitian.

For more information on usage, please see the full documentation.

Development

After cloning the Git repository on a Unix-like system, you can run:

make install

This will create a virtual environment in a subfolder called venv, and then install Bodge into that virtual environment. If you prefer to use a newer Python version (recommended), first install this via your package manager of choice.

For example:

brew install python@3.11          # MacOS with HomeBrew
sudo apt install python3.11-full  # Ubuntu GNU/Linux

Afterwards, mention what Python version to use when installing Bodge:

make install PYTHON=python3.11

After running make install, you can run the unit tests as follows:

make test

This is generally useful both right after installation (to ensure that everything works), as well as after modifying the code (to check that everything still works as expected). Run make without command-line arguments to see how to see how proceed further after that; this should provide information on how to e.g. run scripts that use the Bodge package, or run the autoformatter after updating the code.

PRs are welcome! See the contribution guidelines for more information.

Acknowledgements

I wrote most of this code as a PostDoc in the research group of Prof. Jacob Linder at the Center for Quantum Spintronics, NTNU, Norway. I would like to thank Jacob for introducing me to the BdG formalism that is implemented in this package – and before that, to the theory superconductivity in general.

Owner

  • Name: Jabir Ali Ouassou
  • Login: jabirali
  • Kind: user
  • Location: Haugesund, Norway
  • Company: Western Norway University of Applied Sciences (HVL)

Associate Professor of Physics. I teach math and physics, do research on superconductivity, and have a passion for computers and programming.

JOSS Publication

Bodge: Python package for efficient tight-binding modeling of superconducting nanostructures
Published
October 09, 2024
Volume 9, Issue 102, Page 7134
Authors
Jabir Ali Ouassou ORCID
Department of Computer Science, Electrical Engineering and Mathematical Sciences, Western Norway University of Applied Sciences, NO-5528 Haugesund, Norway, Center for Quantum Spintronics, Department of Physics, Norwegian University of Science and Technology, NO-7491 Trondheim, Norway
Editor
Sophie Beck ORCID
Tags
python numerical physics condensed matter physics tight-binding models superconductivity sparse matrices bdg equations

Citation (CITATION.cff)

cff-version: "1.2.0"
authors:
- email: jabir.ali.ouassou@hvl.no
  family-names: Ouassou
  given-names: Jabir Ali
  orcid: "https://orcid.org/0000-0002-3725-0885"
doi: 10.5281/zenodo.13839641
message: If you use this software, please cite our article in the
  Journal of Open Source Software.
preferred-citation:
  authors:
  - email: jabir.ali.ouassou@hvl.no
    family-names: Ouassou
    given-names: Jabir Ali
    orcid: "https://orcid.org/0000-0002-3725-0885"
  date-published: 2024-10-09
  doi: 10.21105/joss.07134
  issn: 2475-9066
  issue: 102
  journal: Journal of Open Source Software
  publisher:
    name: Open Journals
  start: 7134
  title: "Bodge: Python package for efficient tight-binding modeling of
    superconducting nanostructures"
  type: article
  url: "https://joss.theoj.org/papers/10.21105/joss.07134"
  volume: 9
title: "Bodge: Python package for efficient tight-binding modeling of
  superconducting nanostructures"

GitHub Events

Total
  • Watch event: 5
  • Push event: 2
  • Fork event: 2
Last Year
  • Watch event: 5
  • Push event: 2
  • Fork event: 2

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 532
  • Total Committers: 6
  • Avg Commits per committer: 88.667
  • Development Distribution Score (DDS): 0.011
Past Year
  • Commits: 32
  • Committers: 1
  • Avg Commits per committer: 32.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Jabir Ali Ouassou j****u@n****o 526
Jabir Ouassou j****i@l****o 2
Jabir Ouassou j****i@l****o 1
Jabir Ouassou j****i@l****a 1
Jabir Ouassou j****i@l****o 1
Jabir Ali Ouassou j****i@h****e 1

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 4
  • Total pull requests: 1
  • Average time to close issues: 6 days
  • Average time to close pull requests: about 18 hours
  • Total issue authors: 2
  • Total pull request authors: 1
  • Average comments per issue: 3.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 4
  • Pull requests: 1
  • Average time to close issues: 6 days
  • Average time to close pull requests: about 18 hours
  • Issue authors: 2
  • Pull request authors: 1
  • Average comments per issue: 3.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • mdavezac (3)
  • yw-fang (1)
Pull Request Authors
  • kyleniemeyer (2)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 81 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 10
  • Total maintainers: 1
pypi.org: bodge

Bodge: Python package for efficient tight-binding modeling of superconductors.

  • Versions: 10
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 81 Last month
Rankings
Dependent packages count: 10.7%
Average: 35.4%
Dependent repos count: 60.1%
Maintainers (1)
Last synced: 4 months ago

Dependencies

.github/workflows/unit-tests.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
pyproject.toml pypi
  • beartype *
  • numpy *
  • scipy *