def get_hamiltonian(self, fun=None, has_spin=True, is_sparse=False, spinful_generator=False, is_multicell=False, mgenerator=None): """ Create the hamiltonian for this geometry""" if self.dimensionality == 3: is_multicell = True from hamiltonians import hamiltonian h = hamiltonian(self) # create the object h.is_sparse = is_sparse h.has_spin = has_spin h.is_multicell = is_multicell if is_multicell: # workaround for multicell hamiltonians from multicell import parametric_hopping_hamiltonian if mgenerator is not None: raise # not implemented h = parametric_hopping_hamiltonian(h, fc=fun) # add hopping return h if fun is None and mgenerator is None: # no function given h.first_neighbors() # create first neighbor hopping else: # function or mgenerator given if h.dimensionality < 3: from hamiltonians import generate_parametric_hopping h = generate_parametric_hopping( h, f=fun, spinful_generator=spinful_generator, mgenerator=mgenerator) # add hopping elif h.dimensionality == 3: if mgenerator is not None: raise # not implemented from multicell import parametric_hopping_hamiltonian h = parametric_hopping_hamiltonian(h, fc=fun) # add hopping if not is_sparse: h.turn_dense() # dense Hamiltonian return h # return the object
def __init__(self, tracklist=None): """ Takes tracklist as a parameter in constructor Tracklist Format: [[[ """ self.measurements = tracklist self.hamiltonians = hamiltonians.hamiltonian()
def graphene_armchair_ribbon(ntetramers=1,lambda_soc=0.0): """ Creates teh hamiltonian for a graphene armchair ribbon""" g = geometry.honeycomb_armchair_ribbon(ntetramers) # create the geometry h = hamiltonians.hamiltonian(g) # create the hamiltonian # get the intracell and intercell terms (intra,inter) = hamiltonians.kane_mele(g.x,g.y, celldis=g.celldis,lambda_soc=lambda_soc) h.intra = intra # assign intracell h.inter = inter # assign intercell return h # return hamiltonian
def generator_super_squid_square(width=1, inner_radius=4, arm_length=8, arm_width=2, delta=0.0, mag_field=0.0, fill=False): """ Creates a function that returns a superconducting squid made of square lattice, central part is a normal system""" g = geometry.squid_square(width=width, inner_radius=inner_radius, arm_length=arm_length, arm_width=arm_width, fill=fill) # create the geometry g.dimensionality = 0 # set 0 dimensional g.celldis = None # no distance to neighboring cell h = hamiltonians.hamiltonian(g) # create hamiltonian nt = width + inner_radius + 1. # half side of the big square def mag_field_f(x1, y1, x2, y2): """ Return magnetic field only in the center, using atan x gauga """ # return mag_field*(x1-x2)*(y1+y2)/2.0 # if (x1 or x2) < -float(nt): return 0.0 # if (x1 or x2) > float(nt): return 0.0 # else: return mag_field*(x1-x2)*(y1+y2)/2.0 bb = (np.arctan(x1 / nt) + np.arctan(x2 / nt)) / 2.0 # mean x value bb = bb * (y2 - y1) * mag_field return bb h.get_simple_tb(mag_field=mag_field_f) # create simple tight binding def delta_f(x, y): """ Defines left and right arms arm """ if x < -float(nt): return delta if x > float(nt): return delta else: return 0.0 def h_generator(phi): """ Creates the function to return""" def phi_f(x, y): """ Defines left and right arms arm """ if x < -float(nt): return phi if x > float(nt): return -phi else: return 0.0 # add superconducting parameter h.remove_spin() # remove spin degree of freedom h.add_swave_electron_hole_pairing(delta=delta_f, phi=phi_f) h.set_finite_system() # transform to finite system return h # return hamiltonian return h_generator
def kane_mele_ribbon(g,lambda_soc=0.0,mag_field=0.0): """ Creates teh hamiltonian for a kane_mele ribbon, input is geometry""" h = hamiltonians.hamiltonian(g) # create the hamiltonian # get the intracell and intercell terms (intra,inter) = hamiltonians.kane_mele(g.x,g.y, celldis=g.celldis,lambda_soc=lambda_soc, mag_field = mag_field) h.intra = intra # assign intracell h.inter = inter # assign intercell h.num_orbitals = len(g.x) # assign number of orbitals return h # return hamiltonian
def graphene_armchair_ribbon(ntetramers=1, lambda_soc=0.0): """ Creates teh hamiltonian for a graphene armchair ribbon""" g = geometry.honeycomb_armchair_ribbon(ntetramers) # create the geometry h = hamiltonians.hamiltonian(g) # create the hamiltonian # get the intracell and intercell terms (intra, inter) = hamiltonians.kane_mele(g.x, g.y, celldis=g.celldis, lambda_soc=lambda_soc) h.intra = intra # assign intracell h.inter = inter # assign intercell return h # return hamiltonian
def get_hamiltonian(self,fun=None,has_spin=True): """ Create the hamiltonian for this geometry""" from hamiltonians import hamiltonian h = hamiltonian(self) # create the object if fun is None: # no function given h.first_neighbors() # create first neighbor hopping if not has_spin: h.remove_spin() else: # function given from hamiltonians import generate_parametric_hopping h = generate_parametric_hopping(h,fun) # add hopping if has_spin: h.turn_spinful() # add spin degree return h # return the object
def kane_mele_ribbon(g, lambda_soc=0.0, mag_field=0.0): """ Creates teh hamiltonian for a kane_mele ribbon, input is geometry""" h = hamiltonians.hamiltonian(g) # create the hamiltonian # get the intracell and intercell terms (intra, inter) = hamiltonians.kane_mele(g.x, g.y, celldis=g.celldis, lambda_soc=lambda_soc, mag_field=mag_field) h.intra = intra # assign intracell h.inter = inter # assign intercell h.num_orbitals = len(g.x) # assign number of orbitals return h # return hamiltonian
def generator_super_squid_square(width=1,inner_radius=4,arm_length=8, arm_width=2,delta=0.0,mag_field=0.0,fill=False): """ Creates a function that returns a superconducting squid made of square lattice, central part is a normal system""" g = geometry.squid_square(width=width,inner_radius=inner_radius, arm_length=arm_length, arm_width = arm_width,fill=fill) # create the geometry g.dimensionality = 0 # set 0 dimensional g.celldis = None # no distance to neighboring cell h = hamiltonians.hamiltonian(g) # create hamiltonian nt = width + inner_radius+1. # half side of the big square def mag_field_f(x1,y1,x2,y2): """ Return magnetic field only in the center, using atan x gauga """ # return mag_field*(x1-x2)*(y1+y2)/2.0 # if (x1 or x2) < -float(nt): return 0.0 # if (x1 or x2) > float(nt): return 0.0 # else: return mag_field*(x1-x2)*(y1+y2)/2.0 bb = (np.arctan(x1/nt)+np.arctan(x2/nt))/2.0 # mean x value bb = bb*(y2-y1)*mag_field return bb h.get_simple_tb(mag_field=mag_field_f) # create simple tight binding def delta_f(x,y): """ Defines left and right arms arm """ if x < -float(nt): return delta if x > float(nt): return delta else: return 0.0 def h_generator(phi): """ Creates the function to return""" def phi_f(x,y): """ Defines left and right arms arm """ if x < -float(nt): return phi if x > float(nt): return -phi else: return 0.0 # add superconducting parameter h.remove_spin() # remove spin degree of freedom h.add_swave_electron_hole_pairing(delta=delta_f,phi=phi_f) h.set_finite_system() # transform to finite system return h # return hamiltonian return h_generator
import geometry # library to create crystal geometries import hamiltonians # library to work with hamiltonians import input_tb90 as in90 import heterostructures import multilayers import os import numpy as np g = geometry.honeycomb_zigzag_ribbon(ntetramers=4) #g = geometry.square_ribbon(1) #g.supercell(2) h = hamiltonians.hamiltonian(g) #h.get_simple_tb() h.get_simple_tb(mag_field=0.1) h.add_zeeman([0.02, 0.0, 0.]) #h.add_kane_mele(0.1) if False: h.write(output_file="hamiltonian_0.in") os.system("cp tb90.in-scf tb90.in") os.system("tb90.x") #in90.tb90in().write() if False: h.read("hamiltonian.in") mag = in90.read_magnetization() # ground state magnetism h.align_magnetism(mag) h.write() os.system("cp tb90.in-bands tb90.in") os.system("tb90.x")
import geometry # library to create crystal geometries import hamiltonians # library to work with hamiltonians import input_tb90 as in90 import heterostructures import multilayers import os g = geometry.honeycomb_zigzag_ribbon(ntetramers=1) h = hamiltonians.hamiltonian(g) h.get_simple_tb() h.add_zeeman([0.1,0.0,0.0]) #h.add_kane_mele(0.1) if False: h.write(output_file = "hamiltonian_0.in") os.system("cp tb90.in-scf tb90.in") os.system("tb90.x") #in90.tb90in().write() if False: h.read("hamiltonian.in") mag = in90.read_magnetization() # ground state magnetism h.align_magnetism(mag) h.write() os.system("cp tb90.in-bands tb90.in") os.system("tb90.x") if False:
def get_hamiltonian(self): """ Create the hamiltonian for this geometry""" from hamiltonians import hamiltonian h = hamiltonian(self) # create the object h.first_neighbors() # create first neighbor hopping return h # return the object
def super_normal_super(g,f_sc,f_n,replicas = [1,1,1],phi=0.0,delta=0.1): """Creates a junction superconductor-normal-superconductor, - g is the geometry of the unit cell of the system - f_sc is the function which generates the superconductor which takes three arguments, geometry, SC order and phase - f_n generates the hamiltonian of the central part, result has to have electron-hole dimension - replicas are the replicas of the SC-normal_SC of the cell - phi is the infinitesimal phase difference - delta is the superconducting parameter """ h_left = f_sc(g,delta=delta,phi=phi) # create hamiltonian of the left part h_right = f_sc(g,delta=delta,phi=-phi) # create hamiltonian of the right part h_central = f_n(g) # central part from scipy.sparse import coo_matrix as coo from scipy.sparse import bmat from hamiltonians import hamiltonian hj = hamiltonian(g) # create hamiltonian of the junction tc = replicas[0] + replicas[1] + replicas[2] # total number of cells intra = [[None for i in range(tc)] for j in range(tc)] # create intracell # transfor to coo matrix h_left.intra = coo(h_left.intra) h_left.inter = coo(h_left.inter) h_central.intra = coo(h_central.intra) h_central.inter = coo(h_central.inter) h_right.intra = coo(h_right.intra) h_right.inter = coo(h_right.inter) # intracell contributions for i in range(replicas[0]): intra[i][i] = h_left.intra # intracell of the left lead init = replicas[0] # inital index for i in range(replicas[1]): intra[init+i][init+i] = h_central.intra # intracell of the left lead init = replicas[0]+replicas[1] # inital index for i in range(replicas[2]): intra[init+i][init+i] = h_right.intra # intracell of the left lead # intercell contributions for i in range(replicas[0]-1): intra[i][i+1] = h_left.inter # intercell of the left lead intra[i+1][i] = h_left.inter.H # intercell of the left lead init = replicas[0] # inital index for i in range(replicas[1]-1): intra[init+i][init+i+1] = h_central.inter # intercell of the central lead intra[init+i+1][init+i] = h_central.inter.H # intercell of the central lead init = replicas[0]+replicas[1] # inital index for i in range(replicas[2]-1): intra[init+i][init+i+1] = h_right.inter # intercell of the right lead intra[init+i+1][init+i] = h_right.inter.H # intercell of the right lead # coupling between SC and central part, take couapling of the central il = replicas[0] intra[il-1][il] = h_central.inter # intracell of the left lead intra[il][il-1] = h_central.inter.H # intracell of the left lead il = replicas[0]+replicas[1] intra[il-1][il] = h_central.inter # intracell of the left lead intra[il][il-1] = h_central.inter.H # intracell of the left lead # create matrix intra = bmat(intra).todense() hj.intra = intra # add to hamiltonian junction hj = hj.finite_system() # convert in finite system return hj
os.remove(file_eigen) with open(file_eigen, "a") as myfile: myfile.write("# Swave Real Imag") neig = 2 # number of eigenvalues fig_mu = py.figure() fig_mu.set_facecolor("white") sfig_mu = fig_mu.add_subplot(111) svalues = np.arange(0.0, 0.5, 0.02) for sval in svalues: # g = geometry.honeycomb_armchair_ribbon(ntetramers=15) g = geometry.honeycomb_armchair_ribbon(ntetramers=25) # create hamiltonians heterojunction h_right = hamiltonians.hamiltonian(g) h_left = hamiltonians.hamiltonian(g) # central is QSH h_right.get_simple_tb() h_left.get_simple_tb() h_left.read(input_file="hamiltonian_canted_25.in") # shift fermi energy mu = 0.04 h_right.shift_fermi(0.4) h_left.shift_fermi(mu) # electron hole sector # h_right.add_swave_electron_hole_pairing(delta=sval,phi=0.0)
import geometry # library to create crystal geometries import hamiltonians # library to work with hamiltonians import input_tb90 as in90 import heterostructures import sys import sculpt # to modify the geometry import numpy as np import klist import pylab as py import green g = geometry.square_ribbon(4) h = hamiltonians.hamiltonian(g) # create hamiltonian h.first_neighbors() # create first neighbor hopping #h.set_finite() #h.add_zeeman([0.,0.,-1]) h.remove_spin() dx = -6.0 dy = 6j ne = 100 e1 = np.linspace(dx,dx+dy,ne) e2 = np.linspace(dx+dy,dy,ne) e3 = np.linspace(dy,0.0,ne) e4 = np.linspace(0.0,dx,ne) de1 = dy/ne de2 = -dx/ne de3 = -de1
import geometry # library to create crystal geometries import hamiltonians # library to work with hamiltonians import input_tb90 as in90 import heterostructures import sys import sculpt # to modify the geometry import numpy as np import klist import pylab as py import green g = geometry.square_ribbon(4) h = hamiltonians.hamiltonian(g) # create hamiltonian h.first_neighbors() # create first neighbor hopping #h.set_finite() #h.add_zeeman([0.,0.,-1]) h.remove_spin() dx = -6.0 dy = 6j ne = 100 e1 = np.linspace(dx, dx + dy, ne) e2 = np.linspace(dx + dy, dy, ne) e3 = np.linspace(dy, 0.0, ne) e4 = np.linspace(0.0, dx, ne) de1 = dy / ne de2 = -dx / ne de3 = -de1