Package: pyqula
SUMMARYThis is aPython library to computequantum-lattice
tight-binding models in different dimensionalities.INSTALLATIONWith pip (release version)pipinstall--upgradepyqulaManual installation (most recent version)Clone the Github repository withgitclonehttps://github.com/joselado/pyqulaand add the "pyqula/src" path to your Python script withimportsyssys.path.append(PATH_TO_PYQULA+"/src")TutorialsJupyter notebooks with tutorials can be found in the links below (part of theJyvaskyla Summer School 2022)Electronic structureSuperconductivityMagnetismMoire physicsTopological matterFUNCTIONALITIESSingle particle HamiltoniansSpinless, spinful and Nambu basis for orbitalsFull non-collinear electron and Nambu formalismInclude magnetism, spin-orbit coupling and superconductivityBand structures with state-resolved expectation valuesMomentum-resolved spectral functionsLocal and full operator-resolved density of states0d, 1d, 2d and 3d tight binding modelsElectronic structure unfolding in supercellsInteracting mean-field HamiltoniansSelfconsistent mean-field calculations with local/non-local interactionsBoth collinear and non-collinear formalismAnomalous mean-field for non-collinear superconductorsFull selfconsistency with all Wick terms for non-collinear superconductorsConstrained and unconstrained mean-field calculationsAutomatic identification of order parameters for symmetry broken statesHermitian and non-Hermitian mean-field calculationsTopological characterizationBerry phases, Berry curvatures, Chern numbers and Z2 invariantsOperator-resolved Chern numbers and Berry densityFrequency resolved topological densitySpatially resolved topological fluxReal-space Chern density for amorphous systemsWilson loop and Green's function formalismSpectral functionsSpectral functions in infinite geometriesSurface spectral functions for semi-infinite systemsInterfacial spectral function in semi-infinite junctionsSingle impurities in infinite systemsOperator-resolved spectral functionsGreen's function renormalization algorithmChebyshev kernel polynomial based-algorithmsLocal and full spectral functionsNon-local correlators and Green's functionsLocally resolved expectation valuesOperator resolved spectral functionsReaching system sizes up to 10000000 atoms on a single-core laptopQuantum transportMetal-metal transportMetal-superconductor transportFully non-collinear Nambu basisNon-equilibrium Green's function formalismOperator-resolved transportDifferential decay rateTunneling and contact scanning probe spectroscopyEXAMPLESA variety of examples can be found in pyqula/examples. Short examples are shown belowBand structure of a Kagome latticefrompyqulaimportgeometryg=geometry.kagome_lattice()# get the geometry objecth=g.get_hamiltonian()# get the Hamiltonian object(k,e)=h.get_bands()# compute the band structureValley-resolved band structure of a honeycomb superlatticefrompyqulaimportgeometryg=geometry.honeycomb_lattice()# get the geometry objectg=g.get_supercell(7)# create a supercellh=g.get_hamiltonian()# get the Hamiltonian object(k,e,v)=h.get_bands(operator="valley")# compute the band structureInteraction-driven spin-singlet superconductivityfrompyqulaimportgeometryimportnumpyasnpg=geometry.triangular_lattice()# geometry of a triangular latticeh=g.get_hamiltonian()# get the Hamiltonianh.setup_nambu_spinor()# setup the Nambu form of the Hamiltonianh=h.get_mean_field_hamiltonian(U=-1.0,filling=0.15,mf="swave")# perform SCF# electron spectral-functionh.get_kdos_bands(operator="electron",nk=400,energies=np.linspace(-1.0,1.0,100))Interaction driven non-unitary spin-triplet superconductorimportnumpyasnpfrompyqulaimportgeometryg=geometry.triangular_lattice()# generate the geometryh=g.get_hamiltonian()# create Hamiltonian of the systemh.add_exchange([0.,0.,1.])# add exchange fieldh.setup_nambu_spinor()# initialize the Nambu basis# perform a superconducting non-collinear mean-field calculationh=h.get_mean_field_hamiltonian(V1=-1.0,filling=0.3,mf="random")# compute the non-unitarity of the spin-triplet superconducting d-vectord=h.get_dvector_non_unitarity()# non-unitarity of spin-triplet# electron spectral-functionh.get_kdos_bands(operator="electron",nk=400,energies=np.linspace(-2.0,2.0,400))Mean-field with local interactions of a zigzag honeycomb ribbonfrompyqulaimportgeometryg=geometry.honeycomb_zigzag_ribbon(10)# create geometry of a zigzag ribbonh=g.get_hamiltonian()# create hamiltonian of the systemh=h.get_mean_field_hamiltonian(U=1.0,filling=0.5,mf="ferro")(k,e,sz)=h.get_bands(operator="sz")# calculate band structureNon-collinear mean-field with local interactions of a square latticefrompyqulaimportgeometryg=geometry.square_lattice()# geometry of a square latticeg=g.get_supercell([2,2])# generate a 2x2 supercellh=g.get_hamiltonian()# create hamiltonian of the systemh.add_zeeman([0.,0.,0.1])# add out-of-plane Zeeman fieldh=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 structurem=h.get_magnetization()# get the magnetizationInteraction-induced non-collinear magnetism in a defective square lattice with spin-orbit couplingfrompyqulaimportgeometryg=geometry.square_lattice()# geometry of a square latticeg=g.get_supercell([7,7])# generate a 7x7 supercellg=g.remove(i=g.get_central()[0])# remove the central siteh=g.get_hamiltonian()# create hamiltonian of the systemh.add_rashba(.4)# add Rashba spin-orbit couplingh=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 structurem=h.get_magnetization()# get the magnetizationBand structure of twisted bilayer graphenefrompyqulaimportspecialhamiltonian# special Hamiltonians libraryh=specialhamiltonian.twisted_bilayer_graphene()# TBG Hamiltonian(k,e)=h.get_bands()# compute band structureBand structure of monolayer NbSe2frompyqulaimportspecialhamiltonian# special Hamiltonians libraryh=specialhamiltonian.NbSe2(soc=0.5)# NbSe2 Hamiltonian(k,e,c)=h.get_bands(operator="sz",kpath=["G","K","M","G"])# compute bandsChern number of an artificial Chern insulatorfrompyqulaimportgeometryg=geometry.honeycomb_lattice()h=g.get_hamiltonian()h.add_rashba(0.2)# Rashba spin-orbit couplingh.add_zeeman([0.,0.,0.6])# Zeeman fieldfrompyqulaimporttopology(kx,ky,omega)=h.get_berry_curvature()# compute Berry curvaturec=h.get_chern()# compute the Chern numberTopological phase transition in an artificial topological superconductorimportnumpyasnpfrompyqulaimportgeometryg=geometry.chain()# create a chaing=g.supercell(100)# create a large supercellg.dimensionality=0# make it finiteforJinnp.linspace(0.,0.2,50):# loop over exchange couplingsh=g.get_hamiltonian()# create a new hamiltonianh.add_onsite(2.0)# shift the chemical potentialh.add_rashba(.3)# add rashba spin-orbit couplingh.add_exchange([0.,0.,J])# add exchange couplingh.add_swave(.1)# add s-wave superconductivityedge=h.get_operator("location",r=g.r[0])# projector on the edgeenergies=np.linspace(-.2,.2,200)# set of energies(e0,d0)=h.get_dos(operator=edge,energies=energies,delta=2e-3)# edge DOSSpatial distribution of Majorana modes in an artificial topological superconductorimportnumpyasnpfrompyqulaimportgeometryg=geometry.chain()# create a chaing=g.supercell(100)# create a large supercellg.dimensionality=0# make it finiteh=g.get_hamiltonian()# create a new hamiltonianh.add_onsite(2.0)# shift the chemical potentialh.add_rashba(.3)# add rashba spin-orbit couplingh.add_exchange([0.,0.,0.15])# add exchange couplingh.add_swave(.1)# add s-wave superconductivityenergies=np.linspace(-.15,.15,200)# set of energiesforriing.r:# loop over sitesedge=h.get_operator("location",r=ri)# projector on that site(e0,d0)=h.get_dos(operator=edge,energies=energies,delta=2e-3)# local DOSUnfolded electronic structure of a supercell with a defectfrompyqulaimportgeometryimportnumpyasnpg=geometry.honeycomb_lattice()# create a honeycomb latticen=3# size of the supercellg=g.get_supercell(n,store_primal=True)# create a supercellh=g.get_hamiltonian()# get the Hamiltonianfons=lambdar:(np.sum((r-g.r[0])**2)<1e-2)*100# onsite in the impurityh.add_onsite(fons)# add onsite energykpath=np.array(g.get_kpath(nk=200))*n# enlarged k-pathh.get_kdos_bands(operator="unfold",delta=1e-1,kpath=kpath)# unfolded bandsMoire band structure of a moire superlatticefrompyqulaimportgeometryfrompyqulaimportpotentialsg=geometry.triangular_lattice()# create geometryg=g.get_supercell([7,7])# create a supercellh=g.get_hamiltonian()# get the Hamiltonianfmoire=potentials.commensurate_potential(g,n=3,minmax=[0,1])# moire potentialh.add_onsite(fmoire)# add onsite energy following the moireh.get_bands(operator=fmoire)# project on the moireUnfolded electronic structure of a moire superstructurefrompyqulaimportgeometryfrompyqulaimportpotentialsimportnumpyasnpg0=geometry.triangular_lattice()# create geometryn=5# supercellg=g0.get_supercell(n,store_primal=True)# create a supercellh=g.get_hamiltonian()# get the Hamiltonianfmoire=potentials.commensurate_potential(g,n=3,minmax=[0,1])# moire potentialh.add_onsite(fmoire)# add onsite energy following the moirekpath=np.array(g.get_kpath(nk=400))*n# enlarged k-pathh.get_kdos_bands(operator="unfold",delta=2e-2,kpath=kpath,energies=np.linspace(-3,-1,300))# unfolded bandsBand structure of a nodal line semimetal slabfrompyqulaimportgeometryfrompyqulaimportfilmsg=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 slabfrompyqulaimportgeometryfrompyqulaimportfilmsimportnumpyasnpg=geometry.diamond_lattice()# create a diamond latticeg=films.geometry_film(g,nz=60)# create a thin filmh=g.get_hamiltonian()# generate Hamiltonianh.add_strain(lambdar:1.+abs(r[2])*0.8,mode="directional")# add axial strainh.add_kane_mele(0.1)# add intrinsic spin-orbit coupling(k,e,c)=h.get_bands(operator="surface")# compute band structureSurface spectral function of a 2D quantum spin-Hall insulatorfrompyqulaimportgeometryg=geometry.honeycomb_lattice()# create a honeycomb latticeh=g.get_hamiltonian()# generate Hamiltonianh.add_soc(0.15)# add intrinsic spin-orbit couplingh.add_rashba(0.1)# add Rashba spin-orbit couplingh.get_surface_kdos(delta=1e-2)# compute surface spectral functionLocal density of states with atomic orbitals of a honeycomb nanoislandfrompyqulaimportislandsg=islands.get_geometry(name="honeycomb",n=3,nedges=3)# get an islandh=g.get_hamiltonian()# get the Hamiltonianh.get_multildos(projection="atomic")# get the LDOSInteraction-driven magnetism in a honeycomb nanoislandfrompyqulaimportislandsg=islands.get_geometry(name="honeycomb",n=3,nedges=3)# get an islandh=g.get_hamiltonian()# get the Hamiltonianh=h.get_mean_field_hamiltonian(U=1.0,filling=0.5,mf="ferro")# perform SCFm=h.get_magnetization()# get the magnetization in each siteHofstadter's butterfly of a square latticeimportnumpyasnpfrompyqulaimportgeometryg=geometry.square_ribbon(40)# create square ribbon geometryforBinnp.linspace(0.,1.0,300):# loop over magnetic fieldh=g.get_hamiltonian()# create a new hamiltonianh.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 semimetalimportnumpyasnpfrompyqulaimportgeometryg=geometry.honeycomb_ribbon(30)# create a honeycomb ribbonforBinnp.linspace(0.,0.02,100):# loop over magnetic fieldh=g.get_hamiltonian()# create a new hamiltonianh.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 insulatorfrompyqulaimportgeometryfrompyqulaimportkdosg=geometry.honeycomb_lattice()# create honeycomb latticeh=g.get_hamiltonian()# create hamiltonian of the systemh.add_haldane(0.05)# Add Haldane couplingkdos.surface(h)# surface spectral functionSurface states and Berry curvature of a artificial 2D topological superconductorfrompyqulaimportgeometryimportnumpyasnpg=geometry.triangular_lattice()# get the geometryh=g.get_hamiltonian()# get the Hamiltonianh.add_onsite(2.0)# shift chemical potentialh.add_rashba(1.0)# Rashba spin-orbit couplingh.add_zeeman([0.,0.,0.6])# Zeeman fieldh.add_swave(.3)# add superconductivity(kx,ky,omega)=h.get_berry_curvature()# compute Berry curvatureh.get_surface_kdos(energies=np.linspace(-.4,.4,300))# surface spectral functionSurface states in a topological superconductor nanoislandfrompyqulaimportislandsg=islands.get_geometry(name="triangular",shape="flower",r=14.2,dr=2.0,nedges=6)# get a flower-shaped islandh=g.get_hamiltonian()# get the Hamiltonianh.add_onsite(3.0)# shift chemical potentialh.add_rashba(1.0)# Rashba spin-orbit couplingh.add_zeeman([0.,0.,0.6])# Zeeman fieldh.add_swave(.3)# add superconductivityh.get_ldos()# Spatially resolved DOSAntiferromagnet-superconductor interfacefrompyqulaimportgeometryg=geometry.honeycomb_zigzag_ribbon(20)# create geometry of a zigzag ribbonh=g.get_hamiltonian(has_spin=True)# create hamiltonian of the systemh.add_antiferromagnetism(lambdar:(r[1]>0)*0.5)# add antiferromagnetismh.add_onsite(lambdar:(r[1]>0)*0.3)# add chemical potentialh.add_swave(lambdar:(r[1]<0)*0.3)# add superconductivity(k,e,sz)=h.get_bands(operator="sz")# calculate band structureFermi surface of a triangular lattice supercellfrompyqulaimportgeometryimportnumpyasnpg=geometry.triangular_lattice()# create geometry of the systemg=g.get_supercell(2)# create a supercellh=g.get_hamiltonian()# create hamiltonian of the systemh.get_multi_fermi_surface(energies=np.linspace(-4,4,100),delta=1e-1)Unfolded Fermi surface of a supercell with a defectfrompyqulaimportgeometryimportnumpyasnpg0=geometry.triangular_lattice()n=3# size of the supercellg=g0.get_supercell(n,store_primal=True)# create a supercellh=g.get_hamiltonian()# get the Hamiltonianfons=lambdar:(np.sum((r-g.r[0])**2)<1e-2)*100# onsite in the impurityh.add_onsite(fons)# add onsite energykpath=np.array(g.get_kpath(nk=200))*n# enlarged k-pathh.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 junctionfrompyqulaimportgeometryfrompyqulaimportheterostructuresimportnumpyasnpg=geometry.chain()# create the geometryh=g.get_hamiltonian()# create the Hamiltonianh1=h.copy()# first leadh2=h.copy()# second leadh2.add_swave(.01)# the second lead is superconductinges=np.linspace(-.03,.03,100)# set of energies for dIdVforTinnp.linspace(1e-3,1.0,6):# loop over transparenciesHT=heterostructures.build(h1,h2)# create the junctionHT.set_coupling(T)# set the coupling between the leadsGs=[HT.didv(energy=e)foreines]# calculate conductanceFrom tunneling to contact transport of a topological superconductorfrompyqulaimportgeometryfrompyqulaimportheterostructuresimportnumpyasnpg=geometry.chain()# create the geometryh=g.get_hamiltonian()# create teh Hamiltonianh1=h.copy()# first leadh2=h.copy()# second leadh2.add_onsite(2.0)# shift chemical potential in the second leadh2.add_exchange([0.,0.,.3])# add exchange in the second leadh2.add_rashba(.3)# add Rashba SOC in the second leadh2.add_swave(.05)# add s-wave SC in the second leades=np.linspace(-.1,.1,100)# grid of energiesforTinnp.linspace(1e-3,0.5,10):# loop over transparenciesHT=heterostructures.build(h1,h2)# create the junctionHT.set_coupling(T)# set the coupling between the leadsGs=[HT.didv(energy=e)foreines]# calculate transmissionSingle impurity in an infinite honeycomb latticefrompyqulaimportgeometryimportnumpyasnpfrompyqulaimportembeddingg=geometry.honeycomb_lattice()# create geometryh=g.get_hamiltonian()# get the Hamiltonianhv=h.copy()# copy Hamiltonian to create a defective onehv.add_onsite(lambdar:(np.sum((r-g.r[0])**2)<1e-2)*100)# add a defecteb=embedding.Embedding(h,m=hv)# create an embedding object(x,y,d)=eb.ldos(nsuper=19,energy=0.,delta=1e-2)# compute LDOSBound state of a single magnetic impurity in an infinite superconductorfrompyqulaimportgeometryimportnumpyasnpfrompyqulaimportembeddingg=geometry.square_lattice()# create geometryh=g.get_hamiltonian()# get the Hamiltonianh.add_swave(0.1)# add s-wave superconductivityh.add_onsite(3.0)# shift chemical potentialhv=h.copy()# copy Hamiltonian to create a defective onehv.add_exchange(lambdar:[0.,0.,(np.sum((r-g.r[0])**2)<1e-2)*6.])# add magnetic siteeb=embedding.Embedding(h,m=hv)# create an embedding objectei=eb.get_energy_ingap_state()# get energy of the impurity state(x,y,d)=eb.ldos(nsuper=19,energy=ei,delta=1e-3)# compute LDOSParity switching of a magnetic impurity in an infinite superconductorfrompyqulaimportgeometryfrompyqulaimportembeddingimportnumpyasnpg=geometry.square_lattice()# create geometryforJinnp.linspace(0.,4.0,100):# loop over exchangeh=g.get_hamiltonian()# get the Hamiltonian,spinlessh.add_onsite(3.0)# shift chemical potentialh.add_swave(0.2)# add s-wave superconductivityhv=h.copy()# copy Hamiltonian to create a defective one# add magnetic sitehv.add_exchange(lambdar:[0.,0.,(np.sum((r-g.r[0])**2)<1e-2)*J])eb=embedding.Embedding(h,m=hv)# create an embedding objectenergies=np.linspace(-0.4,0.4,100)# energiesd=[eb.dos(nsuper=2,delta=1e-2,energy=ei)foreiinenergies]# compute DOS