def get_geometry(name="square", n=5, nedges=None, rot=0., clean=True, geo=None, shift=[0., 0., 0.]): """ Create a 0d island""" lattice_name = name if lattice_name == "honeycomb": geometry_builder = geometry.honeycomb_lattice if nedges == None: nedges = 6 elif lattice_name == "square": geometry_builder = geometry.square_lattice if nedges == None: nedges = 4 elif lattice_name == "kagome": geometry_builder = geometry.kagome_lattice if nedges == None: nedges = 3 elif lattice_name == "lieb": geometry_builder = geometry.lieb_lattice if nedges == None: nedges = 4 elif lattice_name == "triangular": geometry_builder = geometry.triangular_lattice if nedges == None: nedges = 3 else: raise # first create a raw unit cell if geo is not None: print("Geometry generator taken from input") g = geo # builder is input geometry else: g = geometry_builder() # build a 2d unit cell nf = float(n) # get the desired size, in float g = g.supercell(int(7 * n)) # create supercell g.set_finite() # set as finite system g.center() # center the geometry # now scuplt the geometry g = sculpt.rotate(g, rot) # initial rotation # now shift the lattice g.x += shift[0] g.y += shift[1] g.z += shift[2] g.xyz2r() def f(x, y): return x > -nf * (np.cos(np.pi / 3) + 1.) # function to use as cut for i in range(nedges): # loop over rotations, 60 degrees g = sculpt.intersec(g, f) # retain certain atoms g = sculpt.rotate(g, 2. * np.pi / nedges) # rotate 60 degrees if clean: # if it is cleaned g = sculpt.remove_unibonded(g) # remove single bonded atoms g = sculpt.remove_unibonded(g) # remove single bonded atoms g.center() # center the geometry return g
def get_geometry(name="square",n=5,nedges=None,rot=0.,clean=True): """ Create a 0d island""" lattice_name = name if lattice_name=="honeycomb": geometry_builder = geometry.honeycomb_lattice if nedges==None: nedges = 6 elif lattice_name=="square": geometry_builder = geometry.square_lattice if nedges==None: nedges = 4 elif lattice_name=="kagome": geometry_builder = geometry.kagome_lattice if nedges==None: nedges = 3 elif lattice_name=="lieb": geometry_builder = geometry.lieb_lattice if nedges==None: nedges = 4 elif lattice_name=="triangular": geometry_builder = geometry.triangular_lattice if nedges==None: nedges = 3 else: raise # first create a raw unit cell g = geometry_builder() # build a 2d unit cell nf = float(n) # get the desired size, in float g = g.supercell(7*n) # create supercell g.set_finite() # set as finite system g.center() # center the geometry # now scuplt the geometry g = sculpt.rotate(g,rot) # initial rotation def f(x,y): return x>-nf*(np.cos(np.pi/3)+1.) # function to use as cut for i in range(nedges): # loop over rotations, 60 degrees g = sculpt.intersec(g,f) # retain certain atoms g = sculpt.rotate(g,2.*np.pi/nedges) # rotate 60 degrees if clean: # if it is cleaned g = sculpt.remove_unibonded(g) # remove single bonded atoms g.center() # center the geometry return g
def generate_mullen_surface(nx,ny): """Generate a Mullen surface, return bulk hamiltonian and surface cell""" g = geometry.honeycomb_lattice_zigzag_cell() g = g.supercell([2*nx+2+1,1]) # two dimensional gb = g.copy() # copy geometry g.dimensionality = 1 # reduce dimensionality g = sculpt.remove_unibonded(g) gb = sculpt.remove_unibonded(gb) g.center() gb.center() # now add the hexagon dy = max(g.y) + 1.9 dx = 0. xx = np.array([dx,0.,0.]) g.r = [ri+xx for ri in g.r] # displace whole r1 = np.array([-1.,0.+dy,0.]) r2 = np.array([1.,0.+dy,0.]) r3 = np.array([.5,np.sqrt(3.0)/2.+dy,0.]) r4 = np.array([-.5,np.sqrt(3.0)/2.+dy,0.]) r5 = np.array([.5,-np.sqrt(3.0)/2.+dy,0.]) r6 = np.array([-.5,-np.sqrt(3.0)/2.+dy,0.]) g.r = [ri for ri in g.r] + [r1,r2,r3,r4,r5,r6] # upper g.r = np.array(g.r) g.r2xyz() g.write() h = g.get_hamiltonian() # initialize hamiltonian def funh(ri,rj): dr = ri-rj if .1<dr.dot(dr)<1.3: return 1.0 else: return 0.0 h = hamiltonians.generate_parametric_hopping(h,funh) h.remove_spin() # remove spin degree of freedom hb = gb.get_hamiltonian() # bulk hamiltonian hb.remove_spin() # remove spin return (h,hb)
def generate_mullen_surface(nx, ny): """Generate a Mullen surface, return bulk hamiltonian and surface cell""" g = geometry.honeycomb_lattice_zigzag_cell() g = g.supercell([2 * nx + 2 + 1, 1]) # two dimensional gb = g.copy() # copy geometry g.dimensionality = 1 # reduce dimensionality g = sculpt.remove_unibonded(g) gb = sculpt.remove_unibonded(gb) g.center() gb.center() # now add the hexagon dy = max(g.y) + 1.9 dx = 0. xx = np.array([dx, 0., 0.]) g.r = [ri + xx for ri in g.r] # displace whole r1 = np.array([-1., 0. + dy, 0.]) r2 = np.array([1., 0. + dy, 0.]) r3 = np.array([.5, np.sqrt(3.0) / 2. + dy, 0.]) r4 = np.array([-.5, np.sqrt(3.0) / 2. + dy, 0.]) r5 = np.array([.5, -np.sqrt(3.0) / 2. + dy, 0.]) r6 = np.array([-.5, -np.sqrt(3.0) / 2. + dy, 0.]) g.r = [ri for ri in g.r] + [r1, r2, r3, r4, r5, r6] # upper g.r = np.array(g.r) g.r2xyz() g.write() h = g.get_hamiltonian() # initialize hamiltonian def funh(ri, rj): dr = ri - rj if .1 < dr.dot(dr) < 1.3: return 1.0 else: return 0.0 h = hamiltonians.generate_parametric_hopping(h, funh) h.remove_spin() # remove spin degree of freedom hb = gb.get_hamiltonian() # bulk hamiltonian hb.remove_spin() # remove spin return (h, hb)
def generate_pentagon_island(nx,ny,pentagons=[0]): """Generate a Mullen island""" g = geometry.honeycomb_zigzag_ribbon(ny) g = g.supercell(2*nx+1) g.dimensionality = 0 minx = np.min(g.x) def finite(x,y): if x<minx+.1: return False return True g = sculpt.intersec(g,finite) g = sculpt.remove_unibonded(g) g.center() # now add the hexagon dy = max(g.y) + 1.9 ym = max(g.y) # position of zigzag atoms xz = [] # list of zigzag atoms for ir in g.r: # loop over atoms if (ir[1]-ym)<0.1: xz.append(ir[0]) # store upper zigzag atom for ip in pentagons: # loop over pentagons # generate positions r1 = np.array([-1.+dx,0.+dy,0.]) r2 = np.array([1.+dx,0.+dy,0.]) r3 = np.array([.5+dx,np.sqrt(3.0)/2.+dy,0.]) r4 = np.array([-.5+dx,np.sqrt(3.0)/2.+dy,0.]) r5 = np.array([.5+dx,-np.sqrt(3.0)/2.+dy,0.]) r6 = np.array([-.5+dx,-np.sqrt(3.0)/2.+dy,0.]) # add the extra hexagons g.r = [ri for ri in g.r] + [r1,r2,r3,r4,r5,r6] g.r = [ri for ri in g.r] + [-r1,-r2,-r3,-r4,-r5,-r6] #g.r = [r1,r2,r3,r4,r5,r6] g.r = np.array(g.r) g.r2xyz() g.write() h = g.get_hamiltonian() # initialize hamiltonian def funh(ri,rj): dr = ri-rj if .1<dr.dot(dr)<1.3: return 1.0 else: return 0.0 h = hamiltonians.generate_parametric_hopping(h,funh) return h
def generate_pentagon_island(nx, ny, pentagons=[0]): """Generate a Mullen island""" g = geometry.honeycomb_zigzag_ribbon(ny) g = g.supercell(2 * nx + 1) g.dimensionality = 0 minx = np.min(g.x) def finite(x, y): if x < minx + .1: return False return True g = sculpt.intersec(g, finite) g = sculpt.remove_unibonded(g) g.center() # now add the hexagon dy = max(g.y) + 1.9 ym = max(g.y) # position of zigzag atoms xz = [] # list of zigzag atoms for ir in g.r: # loop over atoms if (ir[1] - ym) < 0.1: xz.append(ir[0]) # store upper zigzag atom for ip in pentagons: # loop over pentagons # generate positions r1 = np.array([-1. + dx, 0. + dy, 0.]) r2 = np.array([1. + dx, 0. + dy, 0.]) r3 = np.array([.5 + dx, np.sqrt(3.0) / 2. + dy, 0.]) r4 = np.array([-.5 + dx, np.sqrt(3.0) / 2. + dy, 0.]) r5 = np.array([.5 + dx, -np.sqrt(3.0) / 2. + dy, 0.]) r6 = np.array([-.5 + dx, -np.sqrt(3.0) / 2. + dy, 0.]) # add the extra hexagons g.r = [ri for ri in g.r] + [r1, r2, r3, r4, r5, r6] g.r = [ri for ri in g.r] + [-r1, -r2, -r3, -r4, -r5, -r6] #g.r = [r1,r2,r3,r4,r5,r6] g.r = np.array(g.r) g.r2xyz() g.write() h = g.get_hamiltonian() # initialize hamiltonian def funh(ri, rj): dr = ri - rj if .1 < dr.dot(dr) < 1.3: return 1.0 else: return 0.0 h = hamiltonians.generate_parametric_hopping(h, funh) return h
def generate_mullen_island(nx,ny,pristine=False): """Generate a Mullen island""" g = geometry.honeycomb_zigzag_ribbon(ny) g = g.supercell(2*nx+1+2) g.dimensionality = 0 minx = np.min(g.x) def finite(x,y): if x<minx+.1: return False return True g = sculpt.intersec(g,finite) g = sculpt.remove_unibonded(g) g.center() # now add the hexagon dy = max(g.y) + 1.9 r1 = np.array([-1.,0.+dy,0.]) r2 = np.array([1.,0.+dy,0.]) r3 = np.array([.5,np.sqrt(3.0)/2.+dy,0.]) r4 = np.array([-.5,np.sqrt(3.0)/2.+dy,0.]) r5 = np.array([.5,-np.sqrt(3.0)/2.+dy,0.]) r6 = np.array([-.5,-np.sqrt(3.0)/2.+dy,0.]) if not pristine: g.r = [ri for ri in g.r] + [r1,r2,r3,r4,r5,r6] g.r = [ri for ri in g.r] + [-r1,-r2,-r3,-r4,-r5,-r6] #g.r = [r1,r2,r3,r4,r5,r6] g.r = np.array(g.r) g.r2xyz() g.write() h = g.get_hamiltonian() # initialize hamiltonian def funh(ri,rj): dr = ri-rj if .1<dr.dot(dr)<1.3: return 1.0 else: return 0.0 h = hamiltonians.generate_parametric_hopping(h,funh) return h
def generate_mullen_island(nx, ny, pristine=False): """Generate a Mullen island""" g = geometry.honeycomb_zigzag_ribbon(ny) g = g.supercell(2 * nx + 1 + 2) g.dimensionality = 0 minx = np.min(g.x) def finite(x, y): if x < minx + .1: return False return True g = sculpt.intersec(g, finite) g = sculpt.remove_unibonded(g) g.center() # now add the hexagon dy = max(g.y) + 1.9 r1 = np.array([-1., 0. + dy, 0.]) r2 = np.array([1., 0. + dy, 0.]) r3 = np.array([.5, np.sqrt(3.0) / 2. + dy, 0.]) r4 = np.array([-.5, np.sqrt(3.0) / 2. + dy, 0.]) r5 = np.array([.5, -np.sqrt(3.0) / 2. + dy, 0.]) r6 = np.array([-.5, -np.sqrt(3.0) / 2. + dy, 0.]) if not pristine: g.r = [ri for ri in g.r] + [r1, r2, r3, r4, r5, r6] g.r = [ri for ri in g.r] + [-r1, -r2, -r3, -r4, -r5, -r6] #g.r = [r1,r2,r3,r4,r5,r6] g.r = np.array(g.r) g.r2xyz() g.write() h = g.get_hamiltonian() # initialize hamiltonian def funh(ri, rj): dr = ri - rj if .1 < dr.dot(dr) < 1.3: return 1.0 else: return 0.0 h = hamiltonians.generate_parametric_hopping(h, funh) return h
def clean(self, iterative=False): return sculpt.remove_unibonded(self, iterative=iterative)
#g = geometry.square_lattice() # create a honeycomb lattice #g = geometry.kagome_lattice() # create a honeycomb lattice g = g.supercell(50) # create supercell g.set_finite() # create a hexagonal island def f(x,y): """ Retain a plane""" return x>-3*(np.cos(np.pi/3)+1.) #g = sculpt.rotate(g,np.pi/3.) nedges = 3 for j in range(1): for i in range(nedges): # loop over rotations g = sculpt.intersec(g,f) # retain certain atoms g = sculpt.rotate(g,2.*np.pi/nedges) g.center() g = sculpt.remove_unibonded(g) h = g.get_hamiltonian() hamiltonians.ldos(h,e=0.0) g.write()
def clean(self): return sculpt.remove_unibonded(self)