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")
Tutorials
Jupyter notebooks with tutorials can be found in the links below (part of the Jyvaskyla Summer School 2022 )
FUNCTIONALITIES
Single particle Hamiltonians
- Spinless, spinful and Nambu basis for orbitals
- Full non-collinear electron and Nambu formalism
- Include magnetism, spin-orbit coupling and superconductivity
- Band structures with state-resolved expectation values
- Momentum-resolved spectral functions
- Local and full operator-resolved density of states
- 0d, 1d, 2d and 3d tight binding models
- Electronic structure unfolding in supercells
Interacting mean-field Hamiltonians
- Selfconsistent mean-field calculations with local/non-local interactions
- Both collinear and non-collinear formalism
- Anomalous mean-field for non-collinear superconductors
- Full selfconsistency with all Wick terms for non-collinear superconductors
- Constrained and unconstrained mean-field calculations
- Automatic identification of order parameters for symmetry broken states
- Hermitian and non-Hermitian mean-field calculations
Topological characterization
- Berry phases, Berry curvatures, Chern numbers and Z2 invariants
- Operator-resolved Chern numbers and Berry density
- Frequency resolved topological density
- Spatially resolved topological flux
- Real-space Chern density for amorphous systems
- Wilson loop and Green's function formalism
Spectral functions
- Spectral functions in infinite geometries
- Surface spectral functions for semi-infinite systems
- Interfacial spectral function in semi-infinite junctions
- Single impurities in infinite systems
- Operator-resolved spectral functions
- Green's function renormalization algorithm
Chebyshev kernel polynomial based-algorithms
- Local and full spectral functions
- Non-local correlators and Green's functions
- Locally resolved expectation values
- Operator resolved spectral functions
- Reaching system sizes up to 10000000 atoms on a single-core laptop
Quantum transport
- Metal-metal transport
- Metal-superconductor transport
- Fully non-collinear Nambu basis
- Non-equilibrium Green's function formalism
- Operator-resolved transport
- Differential decay rate
- Tunneling and contact scanning probe spectroscopy
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()
h = g.get_hamiltonian()
(k,e) = h.get_bands()
Valley-resolved band structure of a honeycomb superlattice
from pyqula import geometry
g = geometry.honeycomb_lattice()
g = g.get_supercell(7)
h = g.get_hamiltonian()
(k,e,v) = h.get_bands(operator="valley")
Interaction-driven spin-singlet superconductivity
from pyqula import geometry
import numpy as np
g = geometry.triangular_lattice()
h = g.get_hamiltonian()
h.setup_nambu_spinor()
h = h.get_mean_field_hamiltonian(U=-1.0,filling=0.15,mf="swave")
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()
h = g.get_hamiltonian()
h.add_exchange([0.,0.,1.])
h.setup_nambu_spinor()
h = h.get_mean_field_hamiltonian(V1=-1.0,filling=0.3,mf="random")
d = h.get_dvector_non_unitarity()
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)
h = g.get_hamiltonian()
h = h.get_mean_field_hamiltonian(U=1.0,filling=0.5,mf="ferro")
(k,e,sz) = h.get_bands(operator="sz")
Non-collinear mean-field with local interactions of a square lattice
from pyqula import geometry
g = geometry.square_lattice()
g = g.get_supercell([2,2])
h = g.get_hamiltonian()
h.add_zeeman([0.,0.,0.1])
h = h.get_mean_field_hamiltonian(U=2.0,filling=0.5,mf="random")
(k,e,c) = h.get_bands(operator="sz")
m = h.get_magnetization()
Interaction-induced non-collinear magnetism in a defective square lattice with spin-orbit coupling
from pyqula import geometry
g = geometry.square_lattice()
g = g.get_supercell([7,7])
g = g.remove(i=g.get_central()[0])
h = g.get_hamiltonian()
h.add_rashba(.4)
h = h.get_mean_field_hamiltonian(U=2.0,filling=0.5,mf="random")
(k,e,c) = h.get_bands(operator="sz")
m = h.get_magnetization()
Band structure of twisted bilayer graphene
from pyqula import specialhamiltonian
h = specialhamiltonian.twisted_bilayer_graphene()
(k,e) = h.get_bands()
Band structure of monolayer NbSe2
from pyqula import specialhamiltonian
h = specialhamiltonian.NbSe2(soc=0.5)
(k,e,c) = h.get_bands(operator="sz",kpath=["G","K","M","G"])
Chern number of an artificial Chern insulator
from pyqula import geometry
g = geometry.honeycomb_lattice()
h = g.get_hamiltonian()
h.add_rashba(0.2)
h.add_zeeman([0.,0.,0.6])
from pyqula import topology
(kx,ky,omega) = h.get_berry_curvature()
c = h.get_chern()
Topological phase transition in an artificial topological superconductor
import numpy as np
from pyqula import geometry
g = geometry.chain()
g = g.supercell(100)
g.dimensionality = 0
for J in np.linspace(0.,0.2,50):
h = g.get_hamiltonian()
h.add_onsite(2.0)
h.add_rashba(.3)
h.add_exchange([0.,0.,J])
h.add_swave(.1)
edge = h.get_operator("location",r=g.r[0])
energies = np.linspace(-.2,.2,200)
(e0,d0) = h.get_dos(operator=edge,energies=energies,delta=2e-3)
Spatial distribution of Majorana modes in an artificial topological superconductor
import numpy as np
from pyqula import geometry
g = geometry.chain()
g = g.supercell(100)
g.dimensionality = 0
h = g.get_hamiltonian()
h.add_onsite(2.0)
h.add_rashba(.3)
h.add_exchange([0.,0.,0.15])
h.add_swave(.1)
energies = np.linspace(-.15,.15,200)
for ri in g.r:
edge = h.get_operator("location",r=ri)
(e0,d0) = h.get_dos(operator=edge,energies=energies,delta=2e-3)
Unfolded electronic structure of a supercell with a defect
from pyqula import geometry
import numpy as np
g = geometry.honeycomb_lattice()
n = 3
g = g.get_supercell(n,store_primal=True)
h = g.get_hamiltonian()
fons = lambda r: (np.sum((r - g.r[0])**2)<1e-2)*100
h.add_onsite(fons)
kpath = np.array(g.get_kpath(nk=200))*n
h.get_kdos_bands(operator="unfold",delta=1e-1,kpath=kpath)
Moire band structure of a moire superlattice
from pyqula import geometry
from pyqula import potentials
g = geometry.triangular_lattice()
g = g.get_supercell([7,7])
h = g.get_hamiltonian()
fmoire = potentials.commensurate_potential(g,n=3,minmax=[0,1])
h.add_onsite(fmoire)
h.get_bands(operator=fmoire)
Unfolded electronic structure of a moire superstructure
from pyqula import geometry
from pyqula import potentials
import numpy as np
g0 = geometry.triangular_lattice()
n = 5
g = g0.get_supercell(n,store_primal=True)
h = g.get_hamiltonian()
fmoire = potentials.commensurate_potential(g,n=3,minmax=[0,1])
h.add_onsite(fmoire)
kpath = np.array(g.get_kpath(nk=400))*n
h.get_kdos_bands(operator="unfold",delta=2e-2,kpath=kpath,
energies=np.linspace(-3,-1,300))
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()
g = films.geometry_film(g,nz=60)
h = g.get_hamiltonian()
h.add_strain(lambda r: 1.+abs(r[2])*0.8,mode="directional")
h.add_kane_mele(0.1)
(k,e,c)= h.get_bands(operator="surface")
Surface spectral function of a 2D quantum spin-Hall insulator
from pyqula import geometry
g = geometry.honeycomb_lattice()
h = g.get_hamiltonian()
h.add_soc(0.15)
h.add_rashba(0.1)
h.get_surface_kdos(delta=1e-2)
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)
h = g.get_hamiltonian()
h.get_multildos(projection="atomic")
Interaction-driven magnetism in a honeycomb nanoisland
from pyqula import islands
g = islands.get_geometry(name="honeycomb",n=3,nedges=3)
h = g.get_hamiltonian()
h = h.get_mean_field_hamiltonian(U=1.0,filling=0.5,mf="ferro")
m = h.get_magnetization()
Hofstadter's butterfly of a square lattice
import numpy as np
from pyqula import geometry
g = geometry.square_ribbon(40)
for B in np.linspace(0.,1.0,300):
h = g.get_hamiltonian()
h.add_orbital_magnetic_field(B)
(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)
for B in np.linspace(0.,0.02,100):
h = g.get_hamiltonian()
h.add_orbital_magnetic_field(B)
(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()
h = g.get_hamiltonian()
h.add_haldane(0.05)
kdos.surface(h)
Surface states and Berry curvature of a artificial 2D topological superconductor
from pyqula import geometry
import numpy as np
g = geometry.triangular_lattice()
h = g.get_hamiltonian()
h.add_onsite(2.0)
h.add_rashba(1.0)
h.add_zeeman([0.,0.,0.6])
h.add_swave(.3)
(kx,ky,omega) = h.get_berry_curvature()
h.get_surface_kdos(energies=np.linspace(-.4,.4,300))
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)
h = g.get_hamiltonian()
h.add_onsite(3.0)
h.add_rashba(1.0)
h.add_zeeman([0.,0.,0.6])
h.add_swave(.3)
h.get_ldos()
Antiferromagnet-superconductor interface
from pyqula import geometry
g = geometry.honeycomb_zigzag_ribbon(20)
h = g.get_hamiltonian(has_spin=True)
h.add_antiferromagnetism(lambda r: (r[1]>0)*0.5)
h.add_onsite(lambda r: (r[1]>0)*0.3)
h.add_swave(lambda r: (r[1]<0)*0.3)
(k,e,sz) = h.get_bands(operator="sz")
Fermi surface of a triangular lattice supercell
from pyqula import geometry
import numpy as np
g = geometry.triangular_lattice()
g = g.get_supercell(2)
h = g.get_hamiltonian()
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
g = g0.get_supercell(n,store_primal=True)
h = g.get_hamiltonian()
fons = lambda r: (np.sum((r - g.r[0])**2)<1e-2)*100
h.add_onsite(fons)
kpath = np.array(g.get_kpath(nk=200))*n
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()
h = g.get_hamiltonian()
h1 = h.copy()
h2 = h.copy()
h2.add_swave(.01)
es = np.linspace(-.03,.03,100)
for T in np.linspace(1e-3,1.0,6):
HT = heterostructures.build(h1,h2)
HT.set_coupling(T)
Gs = [HT.didv(energy=e) for e in es]
From tunneling to contact transport of a topological superconductor
from pyqula import geometry
from pyqula import heterostructures
import numpy as np
g = geometry.chain()
h = g.get_hamiltonian()
h1 = h.copy()
h2 = h.copy()
h2.add_onsite(2.0)
h2.add_exchange([0.,0.,.3])
h2.add_rashba(.3)
h2.add_swave(.05)
es = np.linspace(-.1,.1,100)
for T in np.linspace(1e-3,0.5,10):
HT = heterostructures.build(h1,h2)
HT.set_coupling(T)
Gs = [HT.didv(energy=e) for e in es]
Single impurity in an infinite honeycomb lattice
from pyqula import geometry
import numpy as np
from pyqula import embedding
g = geometry.honeycomb_lattice()
h = g.get_hamiltonian()
hv = h.copy()
hv.add_onsite(lambda r: (np.sum((r - g.r[0])**2)<1e-2)*100)
eb = embedding.Embedding(h,m=hv)
(x,y,d) = eb.ldos(nsuper=19,energy=0.,delta=1e-2)
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()
h = g.get_hamiltonian()
h.add_swave(0.1)
h.add_onsite(3.0)
hv = h.copy()
hv.add_exchange(lambda r: [0.,0.,(np.sum((r - g.r[0])**2)<1e-2)*6.])
eb = embedding.Embedding(h,m=hv)
ei = eb.get_energy_ingap_state()
(x,y,d) = eb.ldos(nsuper=19,energy=ei,delta=1e-3)
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()
for J in np.linspace(0.,4.0,100):
h = g.get_hamiltonian()
h.add_onsite(3.0)
h.add_swave(0.2)
hv = h.copy()
hv.add_exchange(lambda r: [0.,0.,(np.sum((r - g.r[0])**2)<1e-2)*J])
eb = embedding.Embedding(h,m=hv)
energies = np.linspace(-0.4,0.4,100)
d = [eb.dos(nsuper=2,delta=1e-2,energy=ei) for ei in energies]