def bulk2ribbon(h,mag_field=0.0,n=10,sparse=True,check=True): """ Generate the Hamiltonian of a ribbon with magnetic field""" if not h.is_multicell: # dense hamiltonian ho = ribbonizate.hamiltonian_bulk2ribbon(h,n=n,sparse=sparse,check=check) # create hamiltonian else: # sparse hamiltonian ho = multicell.bulk2ribbon(h,n=n,sparse=sparse,nxt=6) # create hamiltonian ho.geometry.center() if np.abs(mag_field)>0.0000001: ho.add_peierls(mag_field) # add peierls phase return ho
def bar_generator(h,n=50,sparse=True): """Return a generator of quantum Hall bars, input is magnetic field""" # create hamiltonian hr = multicell.bulk2ribbon(h,n=n,sparse=sparse,nxt=6) def fun(b): """Return Hamiltonian of the bar""" ho = hr.copy() ho.add_peierls(b) # add magnetic field return ho return fun # return function