# Add the root path of the pygra library import os ; import sys ; sys.path.append(os.environ['PYGRAROOT']) import numpy as np from pygra import geometry from pygra import hamiltonians from pygra import ribbon from pygra import multilayers g = multilayers.get_geometry("AB",armchair=False) # bilayer AB geometry g = ribbon.bulk2ribbon(g,n=20,clean=False) # get the geometry of a ribbon #g = g.supercell(3) #g.write() ; exit() fun = multilayers.multilayer_hopping(ti=0.3) # function for the hopping h = g.get_hamiltonian(has_spin=False,fun=fun) # create Hamiltonian def ff(r): return r[2]*0.2 # interlayer bias h.shift_fermi(ff) # add electric field h.get_bands()
# Add the root path of the pygra library import os import sys sys.path.append(os.environ['PYGRAROOT']) import numpy as np from pygra import geometry from pygra import hamiltonians from pygra import ribbon from pygra import multilayers g = multilayers.get_geometry("AB", armchair=False) # bilayer AB geometry g = ribbon.bulk2ribbon(g, n=20, clean=False) # get the geometry of a ribbon #g = g.supercell(3) #g.write() ; exit() fun = multilayers.multilayer_hopping(ti=0.3) # function for the hopping h = g.get_hamiltonian(has_spin=False, fun=fun) # create Hamiltonian def ff(r): return r[2] * 0.2 # interlayer bias h.shift_fermi(ff) # add electric field h.get_bands()
import os import sys sys.path.append(os.environ["PYGRAROOT"]) from pygra import geometry import numpy as np from pygra import ribbon from pygra import indexing g = geometry.honeycomb_lattice() # get the 2D geometry of a honeycomb lattice g = ribbon.bulk2ribbon(g,n=100) # generate a ribbon h = g.get_hamiltonian(has_spin=False,is_sparse=True) # get the Hamiltonian # Here you could use any 1d Hamiltonian you want # Alternatively, you can generate 1D Hamiltonians from a 2D one using # h = ribbon.hamiltonian_ribbon(h,n=10) # (more expensive though) indb = indexing.bulk1d(h.geometry) # 1 for bulk sites, 0 for edges def frand(): """This function generates states located in the bulk""" return (np.random.random(len(h.geometry.r))-0.5)*indb h0 = h.copy() # make a copy of the Hamiltonian def getdos(b=0.03): """Compute DOS for a certain magnetic field""" h = h0.copy() h.add_peierls(b) # add magnetic field return h.get_dos(use_kpm=True, # use the KPM mode scale=4.0, # scale of the problem frand=frand, # random vector generator for KPM delta=0.04, # smearing of the distribution
# Add the root path of the pygra library import os ; import sys ; sys.path.append(os.environ['PYGRAROOT']) import numpy as np from pygra import geometry from pygra import sculpt from pygra import ribbon g = geometry.kagome_lattice() #g = geometry.honeycomb_lattice() g.has_sublattice = True g.sublattice = [-1,1,0] g = ribbon.bulk2ribbon(g,n=20) h = g.get_hamiltonian() ms = [] # zeeman fields m1 = np.array([1.,0.,0.]) m2 = np.array([-.5,np.sqrt(3.)/2.,0.]) m3 = np.array([-.5,-np.sqrt(3.)/2.,0.]) mm = 3.0 for (r,s) in zip(g.r,g.sublattice): if r[1]<0.0: if s==-1: ms.append(m1*mm) if s==1: ms.append(m2*mm) if s==0: ms.append(m3*mm) else: ms.append([0.,0.,0.]) # swave def fs(r): if r[1]>0.0: return 0.3 else: return 0.0 h.add_magnetism(ms) h.add_swave(fs) h.shift_fermi(fs)