idx = coo.data > d_min abs_idx1 = np.flatnonzero(layer1) abs_idx2 = np.flatnonzero(layer2) row, col = abs_idx1[coo.row[idx]], abs_idx2[coo.col[idx]] return row, col # lists of site indices to connect @pb.hopping_energy_modifier def interlayer_hopping_value(energy, x1, y1, z1, x2, y2, z2, hop_id): """Set the value of the newly generated hoppings as a function of distance""" d = np.sqrt((x1 - x2)**2 + (y1 - y2)**2 + (z1 - z2)**2) interlayer = (hop_id == 'interlayer') energy[interlayer] = 0.4 * c0 / d[interlayer] return energy return rotate, interlayer_generator, interlayer_hopping_value model = pb.Model(two_graphene_monolayers(), pb.circle(radius=1.5), twist_layers(theta=21.798)) plt.figure(figsize=(6.5, 6.5)) model.plot(hopping=dict(width=1.6, cmap='auto')) plt.title(r"$\theta$ = 21.798 $\degree$") plt.show() model = pb.Model(two_graphene_monolayers(), pb.circle(radius=1.5), twist_layers(theta=12.95)) plt.figure(figsize=(6.5, 6.5)) model.plot(hopping=dict(width=1.6, cmap='auto')) plt.title(r"$\theta$ = 12.95 $\degree$") plt.show()
def make_model(radius, potential=0.2, magnetic_field=3): return pb.Model(graphene.monolayer().with_min_neighbors(2), pb.circle(radius), circular_pn_junction(potential, radius), graphene.constant_magnetic_field(magnetic_field))
def ring(inner_radius, outer_radius): def contains(x, y, z): r = np.sqrt(x**2 + y**2) return np.logical_and(inner_radius < r, r < outer_radius) return pb.FreeformShape(contains, width=[2 * outer_radius, 2 * outer_radius]) # # shape = ring(inner_radius=1.4, outer_radius=2) # shape.plot() rec = pb.rectangle(x=6, y=1) hexa = pb.regular_polygon(num_sides=6, radius=1.92, angle=np.pi / 6) cir = pb.circle(radius=0.6) shape = rec + hexa - cir model = pb.Model( graphene.monolayer(), # trapezoid(a=3.2, b=1.4, h=1.5) # circle(radius=2.5) shape) model.plot() # model.shape.plot() # model = pb.Model( # graphene.monolayer(), # pb.primitive(a1=6, a2=6) # 在a1 a2方向上扩胞 # ) # model.plot() plt.show() # model = pb.Model(