SUMMARY
This is a Python library to compute quantum-lattice tight-binding models in different dimensionalities.
INSTALLATION
With pip (release version)
pip install --upgrade pyqula
Manual installation (most recent version)
Clone the Github repository with
git clone https://github.com/joselado/pyqula
and add the "pyqula/src" path to your Python script with
import sys
sys.path.append(PATH_TO_PYQULA+"/src")
Optional dependencies
A few features depend on heavier, optional backends that are not installed by default. Install them with the relevant extra:
pip install pyqula[mpi] # MPI-parallel routines (mpi4py)
pip install pyqula[dataframe] # pandas-based data export
pip install pyqula[images] # Pillow-based image export
pip install pyqula[all] # all of the above
Recommended library versions
These are the minimum/recommended versions of several required libraries
(also enforced in pyproject.toml)
- numpy >= 2.1
- scipy >= 1.13.1
- matplotlib >= 3.10.0
- numba >= 0.60.0
- multiprocess >= 0.70.19
- dill >= 0.4.1
- threadpoolctl >= 3.5.0
- jax >= 0.8.1
Documentation
The user guide is the main reference: a chapter
per topic (Hamiltonians, observables, operators, superconductivity, mean field,
topology, response functions, transport, Wannierization, KPM, classical spin and
lattice-gas models), each with the physics and runnable snippets, followed by a
reference of every Geometry/Hamiltonian method and its arguments. A PDF
build is at documentation/user_guide.pdf.
examples/ holds several hundred runnable scripts organized by dimensionality
(0d/ 1d/ 2d/ 3d/, plus transport/, embedding/, wannier/,
classicalspin/, latticegas/).
Tutorials
Jupyter notebooks with tutorials can be found in the links below
In this repository:
jupyter-notebooks/-- eleven step-by-step notebooks building up from lattice structure and band structure through self-consistency, Chern insulators, Jackiw-Rebbi solitons and quantum-dot modesjupyter-notebooks/functionalities/-- 53 executed notebooks, matching the FUNCTIONALITIES list below -- 53 of its 74 bullets carry a link to theirs; the rest have no notebook yet
From the "Advanced Quantum Materials course at Aalto University 2025"
- Electronic structure theory
- Topological band structure theory
- The Quantum Hall state
- Superconductivity and Majorana physics
- Interactions and magnetism
- Excitations and defects in quantum materials
From the Jyvaskyla Summer School 2022
FUNCTIONALITIES
Single particle Hamiltonians
- Spinless, spinful and Nambu basis for orbitals [notebook]
- Full non-collinear electron and Nambu formalism [notebook]
- Include magnetism, spin-orbit coupling and superconductivity [notebook]
- Band structures with state-resolved expectation values [notebook]
- Momentum-resolved spectral functions [notebook]
- Local and full operator-resolved density of states [notebook]
- 0d, 1d, 2d and 3d tight binding models [notebook]
- Electronic structure unfolding in supercells [notebook]
- Twisted bilayer graphene structural relaxation (GSFE + elastic energy minimization, AA-region shrinkage and AB/BA domain formation below a few degrees of twist)
- Energy-resolved spin splitting of collinear magnets and altermagnets, either as a broadened density or as the maximum over the whole Brillouin zone
- Nonlinear Drude spin conductivity at arbitrary order in the electric field, whose lowest nonvanishing order identifies the X-wave index (p, d, f, g, i) of an altermagnet without any spin-orbit coupling, together with the X-wave tight-binding models themselves
Interacting mean-field Hamiltonians
- Selfconsistent mean-field calculations with local/non-local interactions [notebook]
- Both collinear and non-collinear formalism [notebook]
- Direct spin-spin (Heisenberg-like) exchange mean field, SzSz/SxSx/SySy and combined anisotropic exchange, simultaneously with density-density interactions [notebook]
- Anomalous mean-field for non-collinear superconductors [notebook]
- Full selfconsistency with all Wick terms for non-collinear superconductors [notebook]
- Constrained and unconstrained mean-field calculations [notebook]
- Automatic identification of order parameters for symmetry broken states [notebook]
- Hermitian and non-Hermitian mean-field calculations [notebook]
- Random phase approximation many-body response functions, for interactions beyond onsite (spin and density/charge channels) [notebook]
- RPA collective modes (magnon bands, plasmon/charge-order bands) and Stoner/RPA instability detection [notebook]
- KPM (Chebyshev)-based mean-field SCF for large/sparse systems, avoiding diagonalization of the Bloch Hamiltonian [notebook]
- JAX-derivative-based mean-field SCF solvers (Newton, matrix-free Newton-Krylov, matrix-free Levenberg-Marquardt residual minimization), differentiating through the self-consistency loop instead of plain mixing [notebook]
- Abrikosov-pseudofermion (RVB spinon) mean-field theory for spin-1/2 Heisenberg models, with the local one-fermion-per-site constraint enforced at every site individually [notebook]
- Abrikosov-pseudofermion (Read-Newns) mean-field theory for the Kondo lattice / periodic Anderson model (heavy fermions), with self-consistent hybridization and a per-site local-moment constraint [notebook]
- Superfluid weight of BdG Hamiltonians, split into conventional and quantum-geometric contributions (flat-band superconductivity), with the BKT temperature from the Nelson-Kosterlitz criterion
- Spin-triplet d-vector of a BdG Hamiltonian and its non-unitarity vector $q = i(d \times d^*)$, the spin moment of the Cooper pairs, per site or as a real-space map
- Excitons from the Bethe-Salpeter equation on top of mean field (full non-Tamm-Dancoff, at any exciton momentum), with binding energies, electron-hole amplitudes and exciton band structures
- Magnons from time-dependent Hartree-Fock, i.e. the spin-flip channel of the same Bethe-Salpeter equation, for neighbor-shell as well as onsite density-density interactions, with an exact Goldstone mode as the built-in check
- GPU dispatch of the RPA response kernel (
chi_cpugpu="GPU"), shared by the spin/charge susceptibilities, IETS maps and RPA magnon bands - Magnons from a pair-basis ladder, keeping the interaction's pair index so that a neighbor-shell density-density interaction enters the transverse spin response properly, frequency-resolved and without needing a gapped reference
- Matrix-free and quantics-tensor-train Bethe-Salpeter solvers, which never build the dense BSE matrix: an exactly factorized kernel with an iterative eigensolver, and a quantics MPO solved by DMRG whose cost grows logarithmically with the k-mesh
- Static RPA screened interaction computed from the mean-field bands, with the dielectric matrix built in the charge channel as in GW (spin-rotation invariant), usable as the direct-term kernel of the Bethe-Salpeter equation (GW-BSE style, with cRPA as an option) or on its own
Topological characterization
- Berry phases, Berry curvatures, Chern numbers and Z2 invariants [notebook]
- Operator-resolved Chern numbers and Berry density [notebook]
- Frequency resolved topological density [notebook]
- Spatially resolved topological flux [notebook]
- Real-space Chern density for amorphous systems [notebook]
- Multiorbital/multiband (non-Abelian) quantum geometric tensor and quantum metric [notebook]
- Wilson loop and Green's function formalism [notebook]
- Free-fermion entanglement entropy and Li-Haldane entanglement spectrum from the correlation matrix, with the chiral spectral flow of a Chern insulator obtained from the bulk alone
Response functions
- Optical (frequency-dependent) conductivity tensor from the Kubo-Greenwood formula, giving optical absorption, the magneto-optical Kerr/Faraday response, and a DC Hall response quantized to the Chern number
- Drude weight and the optical f-sum rule
- Charge-charge (density-density) response function, and its RPA form for an onsite/neighbor-shell interaction
- Generic operator-operator response function, for an arbitrary pair of operators
- RKKY interaction between magnetic impurities, resolved in real space
Spectral functions
- Spectral functions in infinite geometries [notebook]
- Surface spectral functions for semi-infinite systems [notebook]
- Interfacial spectral function in semi-infinite junctions [notebook]
- Single impurities in infinite systems [notebook]
- Real-space quasiparticle interference (QPI) maps from explicit impurities in a supercell
- Green's function renormalization algorithm [notebook]
- Operator and momentum resolved spectral functions [notebook]
Chebyshev kernel polynomial based-algorithms
- Local and full spectral functions [notebook]
- Non-local correlators and Green's functions [notebook]
- Locally resolved expectation values [notebook]
- Operator resolved spectral functions [notebook]
- Reaching system sizes up to 10000000 atoms on a single-core laptop [notebook]
- GPU-accelerated (JAX) batched Chebyshev moment evaluation via
kpm_cpugpu="GPU"
Wannierization
- Maximally-localized Wannier functions for a selected range of bands [notebook]
- Exact reproduction of the selected band subspace on the wannierization mesh [notebook]
- Point-group symmetry-enforced Wannierization, with rejection of band selections that slice through a symmetry-related degeneracy [notebook]
- Works for 0d, 1d, 2d and 3d periodic Hamiltonians, including Nambu/BdG [notebook]
Quantum transport
- Metal-metal transport [notebook]
- Metal-superconductor transport [notebook]
- Transport through an arbitrary finite (0d) central region contacted by two 1D leads [notebook]
- Fully non-collinear Nambu basis [notebook]
- Non-equilibrium Green's function formalism [notebook]
- Operator-resolved transport [notebook]
- Differential decay rate [notebook]
- Tunneling and contact scanning probe spectroscopy [notebook]
- Multiple Andreev reflection and AC-Josephson current between two superconductors (Floquet-Keldysh formalism), including a superconducting local (STM-like) probe [notebook]
Classical spin models and lattice-gas Monte Carlo
- Classical Heisenberg spin models with arbitrary exchange couplings
- Local energy minimization and spatially resolved magnetization textures
- Lattice-gas Monte Carlo with configurable site-site interactions, simulated annealing, and grand-canonical (fluctuating filling) sampling
- Ising model Monte Carlo (single-spin-flip Metropolis and magnetization-conserving Kawasaki dynamics), with simulated annealing and multistart optimization
- Density-density/spin-spin correlators and structure factor, and thermodynamic quantities (specific heat, susceptibility) from equilibrium sampling
EXAMPLES
A variety of examples can be found in pyqula/examples. Short examples are shown below
Band structure of a Kagome lattice
from pyqula import geometry
g = geometry.kagome_lattice() # get the geometry object
h = g.get_hamiltonian() # get the Hamiltonian object
(k,e) = h.get_bands() # compute the band structure
Valley-resolved band structure of a honeycomb superlattice
from pyqula import geometry
g = geometry.honeycomb_lattice() # get the geometry object
g = g.get_supercell(7) # create a supercell
h = g.get_hamiltonian() # get the Hamiltonian object
(k,e,v) = h.get_bands(operator="valley") # compute the band structure
Interaction-driven spin-singlet superconductivity
from pyqula import geometry
import numpy as np
g = geometry.triangular_lattice() # geometry of a triangular lattice
h = g.get_hamiltonian() # get the Hamiltonian
h.setup_nambu_spinor() # setup the Nambu form of the Hamiltonian
h = h.get_mean_field_hamiltonian(U=-1.0,filling=0.15,mf="swave") # perform SCF
# electron spectral-function
h.get_kdos_bands(operator="electron",nk=400,energies=np.linspace(-1.0,1.0,100))
Interaction driven non-unitary spin-triplet superconductor
import numpy as np
from pyqula import geometry
g = geometry.triangular_lattice() # generate the geometry
h = g.get_hamiltonian() # create Hamiltonian of the system
h.add_exchange([0.,0.,1.]) # add exchange field
h.setup_nambu_spinor() # initialize the Nambu basis
# perform a superconducting non-collinear mean-field calculation
h = h.get_mean_field_hamiltonian(V1=-1.0,filling=0.3,mf="random")
# compute the non-unitarity of the spin-triplet superconducting d-vector
d = h.get_dvector_non_unitarity() # non-unitarity of spin-triplet
# electron spectral-function
h.get_kdos_bands(operator="electron",nk=400,energies=np.linspace(-2.0,2.0,400))
Mean-field with local interactions of a zigzag honeycomb ribbon
from pyqula import geometry
g = geometry.honeycomb_zigzag_ribbon(10) # create geometry of a zigzag ribbon
h = g.get_hamiltonian() # create hamiltonian of the system
h = h.get_mean_field_hamiltonian(U=1.0,filling=0.5,mf="ferro")
(k,e,sz) = h.get_bands(operator="sz") # calculate band structure
Non-collinear mean-field with local interactions of a square lattice
from pyqula import geometry
g = geometry.square_lattice() # geometry of a square lattice
g = g.get_supercell([2,2]) # generate a 2x2 supercell
h = g.get_hamiltonian() # create hamiltonian of the system
h.add_zeeman([0.,0.,0.1]) # add out-of-plane Zeeman field
h = h.get_mean_field_hamiltonian(U=2.0,filling=0.5,mf="random") # perform SCF
(k,e,c) = h.get_bands(operator="sz") # calculate band structure
m = h.get_magnetization() # get the magnetization
Interaction-induced non-collinear magnetism in a defective square lattice with spin-orbit coupling
from pyqula import geometry
g = geometry.square_lattice() # geometry of a square lattice
g = g.get_supercell([7,7]) # generate a 7x7 supercell
g = g.remove(i=g.get_central()[0]) # remove the central site
h = g.get_hamiltonian() # create hamiltonian of the system
h.add_rashba(.4) # add Rashba spin-orbit coupling
h = h.get_mean_field_hamiltonian(U=2.0,filling=0.5,mf="random") # perform SCF
(k,e,c) = h.get_bands(operator="sz") # calculate band structure
m = h.get_magnetization() # get the magnetization
RPA many-body response function in an antiferromagnet
from pyqula import geometry
import numpy as np
g = geometry.bisquare_ribbon(2) # square bipartite ribbon
h = g.get_hamiltonian() # generate Hamiltonian
h = h.get_mean_field_hamiltonian(U=3.,nk=10,mf="antiferro",filling=0.5) # SCF
energies=np.linspace(.0,1.6,400) # energies
# RPA many-body spin spectral function
(qs,es,chis) = h.get_qdos_iets(energies = energies,nq=100,nk=10,
delta=1e-2,qpath=["G","X"])
RPA many-body response function in a ferromagnet
from pyqula import geometry ; import numpy as np
g = geometry.lieb_ribbon(2) # Lieb lattice ribbon
h = g.get_hamiltonian() # generate Hamiltonian
h = h.get_mean_field_hamiltonian(U=3.,mf="antiferro",filling=0.5) # perform SCF
energies=np.linspace(.0,1.,400) # energies
# RPA many-body spin spectral function
(qs,es,chis) = h.get_qdos_iets(energies = energies,nq=100,nk=10,
delta=1e-2,qpath=["G","X"])
Band structure of twisted bilayer graphene
from pyqula import specialhamiltonian # special Hamiltonians library
h = specialhamiltonian.twisted_bilayer_graphene() # TBG Hamiltonian
(k,e) = h.get_bands() # compute band structure
Band structure of monolayer NbSe2
from pyqula import specialhamiltonian # special Hamiltonians library
h = specialhamiltonian.NbSe2(soc=0.5) # NbSe2 Hamiltonian
(k,e,c) = h.get_bands(operator="sz",kpath=["G","K","M","G"]) # compute bands
Chern number of an artificial Chern insulator
from pyqula import geometry
g = geometry.honeycomb_lattice()
h = g.get_hamiltonian()
h.add_rashba(0.2) # Rashba spin-orbit coupling
h.add_zeeman([0.,0.,0.6]) # Zeeman field
from pyqula import topology
(kx,ky,omega) = h.get_berry_curvature() # compute Berry curvature
c = h.get_chern() # compute the Chern number
Topological phase transition in an artificial topological superconductor
import numpy as np
from pyqula import geometry
g = geometry.chain() # create a chain
g = g.supercell(100) # create a large supercell
g.dimensionality = 0 # make it finite
for J in np.linspace(0.,0.2,50): # loop over exchange couplings
h = g.get_hamiltonian() # create a new hamiltonian
h.add_onsite(2.0) # shift the chemical potential
h.add_rashba(.3) # add rashba spin-orbit coupling
h.add_exchange([0.,0.,J]) # add exchange coupling
h.add_swave(.1) # add s-wave superconductivity
edge = h.get_operator("location",r=g.r[0]) # projector on the edge
energies = np.linspace(-.2,.2,200) # set of energies
(e0,d0) = h.get_dos(operator=edge,energies=energies,delta=2e-3) # edge DOS
Spatial distribution of Majorana modes in an artificial topological superconductor
import numpy as np
from pyqula import geometry
g = geometry.chain() # create a chain
g = g.supercell(100) # create a large supercell
g.dimensionality = 0 # make it finite
h = g.get_hamiltonian() # create a new hamiltonian
h.add_onsite(2.0) # shift the chemical potential
h.add_rashba(.3) # add rashba spin-orbit coupling
h.add_exchange([0.,0.,0.15]) # add exchange coupling
h.add_swave(.1) # add s-wave superconductivity
energies = np.linspace(-.15,.15,200) # set of energies
for ri in g.r: # loop over sites
edge = h.get_operator("location",r=ri) # projector on that site
(e0,d0) = h.get_dos(operator=edge,energies=energies,delta=2e-3) # local DOS
Unfolded electronic structure of a supercell with a defect
from pyqula import geometry
import numpy as np
g = geometry.honeycomb_lattice() # create a honeycomb lattice
n = 3 # size of the supercell
g = g.get_supercell(n,store_primal=True) # create a supercell
h = g.get_hamiltonian() # get the Hamiltonian
fons = lambda r: (np.sum((r - g.r[0])**2)<1e-2)*100 # onsite in the impurity
h.add_onsite(fons) # add onsite energy
kpath = np.array(g.get_kpath(nk=200))*n # enlarged k-path
h.get_kdos_bands(operator="unfold",delta=1e-1,kpath=kpath) # unfolded bands
Moire band structure of a moire superlattice
from pyqula import geometry
from pyqula import potentials
g = geometry.triangular_lattice() # create geometry
g = g.get_supercell([7,7]) # create a supercell
h = g.get_hamiltonian() # get the Hamiltonian
fmoire = potentials.commensurate_potential(g,n=3,minmax=[0,1]) # moire potential
h.add_onsite(fmoire) # add onsite energy following the moire
h.get_bands(operator=fmoire) # project on the moire
Unfolded electronic structure of a moire superstructure
from pyqula import geometry
from pyqula import potentials
import numpy as np
g0 = geometry.triangular_lattice() # create geometry
n = 5 # supercell
g = g0.get_supercell(n,store_primal=True) # create a supercell
h = g.get_hamiltonian() # get the Hamiltonian
fmoire = potentials.commensurate_potential(g,n=3,minmax=[0,1]) # moire potential
h.add_onsite(fmoire) # add onsite energy following the moire
kpath = np.array(g.get_kpath(nk=400))*n # enlarged k-path
h.get_kdos_bands(operator="unfold",delta=2e-2,kpath=kpath,
energies=np.linspace(-3,-1,300)) # unfolded bands
Band structure of a nodal line semimetal slab
from pyqula import geometry
from pyqula import films
g = geometry.diamond_lattice()
g = films.geometry_film(g,nz=20)
h = g.get_hamiltonian()
(k,e) = h.get_bands()
Band structure of a three dimensional topological insulator slab
from pyqula import geometry
from pyqula import films
import numpy as np
g = geometry.diamond_lattice() # create a diamond lattice
g = films.geometry_film(g,nz=60) # create a thin film
h = g.get_hamiltonian() # generate Hamiltonian
h.add_strain(lambda r: 1.+abs(r[2])*0.8,mode="directional") # add axial strain
h.add_kane_mele(0.1) # add intrinsic spin-orbit coupling
(k,e,c)= h.get_bands(operator="surface") # compute band structure
Surface spectral function of a 2D quantum spin-Hall insulator
from pyqula import geometry
g = geometry.honeycomb_lattice() # create a honeycomb lattice
h = g.get_hamiltonian() # generate Hamiltonian
h.add_soc(0.15) # add intrinsic spin-orbit coupling
h.add_rashba(0.1) # add Rashba spin-orbit coupling
(es,ks,ds,db) = h.get_surface_kdos(delta=1e-2) # compute surface spectral function
Local density of states with atomic orbitals of a honeycomb nanoisland
from pyqula import islands
g = islands.get_geometry(name="honeycomb",n=3,nedges=3) # get an island
h = g.get_hamiltonian() # get the Hamiltonian
h.get_multildos(projection="atomic") # get the LDOS
Interaction-driven magnetism in a honeycomb nanoisland
from pyqula import islands
g = islands.get_geometry(name="honeycomb",n=3,nedges=3) # get an island
h = g.get_hamiltonian() # get the Hamiltonian
h = h.get_mean_field_hamiltonian(U=1.0,filling=0.5,mf="ferro") # perform SCF
m = h.get_magnetization() # get the magnetization in each site
Hofstadter's butterfly of a square lattice
import numpy as np
from pyqula import geometry
g = geometry.square_ribbon(40) # create square ribbon geometry
for B in np.linspace(0.,1.0,300): # loop over magnetic field
h = g.get_hamiltonian() # create a new hamiltonian
h.add_orbital_magnetic_field(B) # add an orbital magnetic field
# calculate DOS projected on the bulk
(e,d) = h.get_dos(operator="bulk",energies=np.linspace(-4.5,4.5,200))
Landau levels of a Dirac semimetal
import numpy as np
from pyqula import geometry
g = geometry.honeycomb_ribbon(30) # create a honeycomb ribbon
for B in np.linspace(0.,0.02,100): # loop over magnetic field
h = g.get_hamiltonian() # create a new hamiltonian
h.add_orbital_magnetic_field(B) # add an orbital magnetic field
# calculate DOS projected on the bulk
(e,d) = h.get_dos(operator="bulk",energies=np.linspace(-1.0,1.0,200),
delta=1e-2)
Surface spectral function of a Chern insulator
from pyqula import geometry
from pyqula import kdos
g = geometry.honeycomb_lattice() # create honeycomb lattice
h = g.get_hamiltonian() # create hamiltonian of the system
h.add_haldane(0.05) # Add Haldane coupling
kdos.surface(h) # surface spectral function
Surface states and Berry curvature of a artificial 2D topological superconductor
from pyqula import geometry
import numpy as np
g = geometry.triangular_lattice() # get the geometry
h = g.get_hamiltonian() # get the Hamiltonian
h.add_onsite(2.0) # shift chemical potential
h.add_rashba(1.0) # Rashba spin-orbit coupling
h.add_zeeman([0.,0.,0.6]) # Zeeman field
h.add_swave(.3) # add superconductivity
(kx,ky,omega) = h.get_berry_curvature() # compute Berry curvature
(es,ks,ds,db) = h.get_surface_kdos(energies=np.linspace(-.4,.4,300)) # surface spectral function
Surface states in a topological superconductor nanoisland
from pyqula import islands
g = islands.get_geometry(name="triangular",shape="flower",
r=14.2,dr=2.0,nedges=6) # get a flower-shaped island
h = g.get_hamiltonian() # get the Hamiltonian
h.add_onsite(3.0) # shift chemical potential
h.add_rashba(1.0) # Rashba spin-orbit coupling
h.add_zeeman([0.,0.,0.6]) # Zeeman field
h.add_swave(.3) # add superconductivity
h.get_ldos() # Spatially resolved DOS
Antiferromagnet-superconductor interface
from pyqula import geometry
g = geometry.honeycomb_zigzag_ribbon(20) # create geometry of a zigzag ribbon
h = g.get_hamiltonian(has_spin=True) # create hamiltonian of the system
h.add_antiferromagnetism(lambda r: (r[1]>0)*0.5) # add antiferromagnetism
h.add_onsite(lambda r: (r[1]>0)*0.3) # add chemical potential
h.add_swave(lambda r: (r[1]<0)*0.3) # add superconductivity
(k,e,sz) = h.get_bands(operator="sz") # calculate band structure
Fermi surface of a triangular lattice supercell
from pyqula import geometry
import numpy as np
g = geometry.triangular_lattice() # create geometry of the system
g = g.get_supercell(2) # create a supercell
h = g.get_hamiltonian() # create hamiltonian of the system
h.get_multi_fermi_surface(energies=np.linspace(-4,4,100),delta=1e-1)
Unfolded Fermi surface of a supercell with a defect
from pyqula import geometry
import numpy as np
g0 = geometry.triangular_lattice()
n = 3 # size of the supercell
g = g0.get_supercell(n,store_primal=True) # create a supercell
h = g.get_hamiltonian() # get the Hamiltonian
fons = lambda r: (np.sum((r - g.r[0])**2)<1e-2)*100 # onsite in the impurity
h.add_onsite(fons) # add onsite energy
kpath = np.array(g.get_kpath(nk=200))*n # enlarged k-path
h.get_multi_fermi_surface(nk=50,energies=np.linspace(-4,4,100),
delta=0.1,nsuper=n,operator="unfold")
Tunneling and Andreev reflection in a metal-superconductor junction
from pyqula import geometry
from pyqula import heterostructures
import numpy as np
g = geometry.chain() # create the geometry
h = g.get_hamiltonian() # create the Hamiltonian
h1 = h.copy() # first lead
h2 = h.copy() # second lead
h2.add_swave(.01) # the second lead is superconducting
es = np.linspace(-.03,.03,100) # set of energies for dIdV
for T in np.linspace(1e-3,1.0,6): # loop over transparencies
HT = heterostructures.build(h1,h2) # create the junction
HT.set_coupling(T) # set the coupling between the leads
Gs = [HT.didv(energy=e) for e in es] # calculate conductance
From tunneling to contact transport of a topological superconductor
from pyqula import geometry
from pyqula import heterostructures
import numpy as np
g = geometry.chain() # create the geometry
h = g.get_hamiltonian() # create teh Hamiltonian
h1 = h.copy() # first lead
h2 = h.copy() # second lead
h2.add_onsite(2.0) # shift chemical potential in the second lead
h2.add_exchange([0.,0.,.3]) # add exchange in the second lead
h2.add_rashba(.3) # add Rashba SOC in the second lead
h2.add_swave(.05) # add s-wave SC in the second lead
es = np.linspace(-.1,.1,100) # grid of energies
for T in np.linspace(1e-3,0.5,10): # loop over transparencies
HT = heterostructures.build(h1,h2) # create the junction
HT.set_coupling(T) # set the coupling between the leads
Gs = [HT.didv(energy=e) for e in es] # calculate transmission
Single impurity in an infinite honeycomb lattice
from pyqula import geometry
import numpy as np
from pyqula import embedding
g = geometry.honeycomb_lattice() # create geometry
h = g.get_hamiltonian() # get the Hamiltonian
hv = h.copy() # copy Hamiltonian to create a defective one
hv.add_onsite(lambda r: (np.sum((r - g.r[0])**2)<1e-2)*100) # add a defect
eb = embedding.Embedding(h,m=hv) # create an embedding object
(x,y,d) = eb.ldos(nsuper=19,energy=0.,delta=1e-2) # compute LDOS
Bound state of a single magnetic impurity in an infinite superconductor
from pyqula import geometry
import numpy as np
from pyqula import embedding
g = geometry.square_lattice() # create geometry
h = g.get_hamiltonian() # get the Hamiltonian
h.add_swave(0.1) # add s-wave superconductivity
h.add_onsite(3.0) # shift chemical potential
hv = h.copy() # copy Hamiltonian to create a defective one
hv.add_exchange(lambda r: [0.,0.,(np.sum((r - g.r[0])**2)<1e-2)*6.]) # add magnetic site
eb = embedding.Embedding(h,m=hv) # create an embedding object
ei = eb.get_energy_ingap_state() # get energy of the impurity state
(x,y,d) = eb.ldos(nsuper=19,energy=ei,delta=1e-3) # compute LDOS
Parity switching of a magnetic impurity in an infinite superconductor
from pyqula import geometry
from pyqula import embedding
import numpy as np
g = geometry.square_lattice() # create geometry
for J in np.linspace(0.,4.0,100): # loop over exchange
h = g.get_hamiltonian() # get the Hamiltonian,spinless
h.add_onsite(3.0) # shift chemical potential
h.add_swave(0.2) # add s-wave superconductivity
hv = h.copy() # copy Hamiltonian to create a defective one
# add magnetic site
hv.add_exchange(lambda r: [0.,0.,(np.sum((r - g.r[0])**2)<1e-2)*J])
eb = embedding.Embedding(h,m=hv) # create an embedding object
energies = np.linspace(-0.4,0.4,100) # energies
d = [eb.dos(nsuper=2,delta=1e-2,energy=ei) for ei in energies] # compute DOS
Metadata
Release files for pyqula 0.0.95
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyqula-0.0.95.tar.gz | 889.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyqula-0.0.95-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.9 MB
Release files / pyqula-0.0.95.tar.gz
| Download URL | pyqula-0.0.95.tar.gz |
|---|---|
| Size | 889.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
15fa1f3f86560b84d6df88486fd3b61c1a6a4cb6dfe9263521275ea1944a9b68
|
|
BLAKE2b-256 checksum How to use checksums |
546ffe852601ee0be10b01975b26d5d641477ad528613022877285557f711c43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.7
|
Release files / pyqula-0.0.95-py3-none-any.whl
| Download URL | pyqula-0.0.95-py3-none-any.whl |
|---|---|
| Size | 1.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
53706a4c252e434bdf4fbca8f0d85e0e56c83b8efe4f39814c3bc03f5fcb3371
|
|
BLAKE2b-256 checksum How to use checksums |
34487e881199dbbcab1cb4b014e5478c7ad59aa114e9441dc7b36be0968f1bde
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.7
|