Removing a certain hopping in the Kwant.plot

Hello, As I understand that when I use "kwant.plot" to generate a lattice it automatically connects with a line whenever it sees a hopping between two sites. Now in my case, I wanted to connect two edges of a system by hopping to implement periodic boundary conditions. However, now when I plot the lattice I can see the long black lines from one edge to another since they are connected by a hopping. So, when I do a ldos I can still see those lines in my plot. So is there a way to remove the lines corresponding to the hopping between two edges in the plot?

Hi, Sayandip Dhara wrote:
As I understand that when I use "kwant.plot" to generate a lattice it automatically connects with a line whenever it sees a hopping between two sites. Now in my case, I wanted to connect two edges of a system by hopping to implement periodic boundary conditions. However, now when I plot the lattice I can see the long black lines from one edge to another since they are connected by a hopping. So, when I do a ldos I can still see those lines in my plot. So is there a way to remove the lines corresponding to the hopping between two edges in the plot?
I’m not sure to understand what you mean. You would like to make some hoppings invisible in a plot generated by kwant.plot? The following could work: the hop_color argument of kwant.plot can be a Python function. In that case the function will be called for each hopping with the two sites that are connected and is expected to return a matplotlib color description. I guess that matplotlib supports transparency, so that it should be possible to make some hoppings transparent. Alternatively some lines could be given zero width using the hop_lw argument. But actually, when plotting LDOS or something similar, I would rather use kwant.plotter.map or kwant.plotter.density. The image will be nicer, more compact, and no hoppings will be visible. Christoph

Hello Christoph, Thanks for the suggestions. I would exactly like to make some hoppings invisible in a plot generated by kwant.plot. So when I use kwant.plot how do I specify inside that which of the hoppings I want to give zero width. If understand correctly you are suggesting that I have to write a function that I can pass through the "hop_color" argument. Now in that function can I just go through those hoppings which I want to make transparent or do I have to run it through every hopping in the system? Since I want all the hoppings in the bulk of the system to stay in the plot and all the hopping which are required for the periodic boundary condition to disappear, using kwant.plotter.map or kwant.plotter.density would not work.

Dear Sayandip, As Christoph has said you can adjust a function as hop_color to do so. In your case just you have to proceed as follow: *1.select the position of the sites at the edges* *2.* then make a condition in hop_color or hopping low (transparent ) f*or the sites at the top (y1=+L) and at the bottom (y2=0 or -L, depending on your script). * *To to give you a hint see the following commands,* ### --------------------- ---------------------------------------------------- def hopping_low(site_1, site_2): x1, y1 =site_1.pos x2, y2 =site_2.pos ## define the condition for sites that you want to remove hopping if y2 == L and y1 == -L: return 0 else: return 0.2 or def hopping_color(site_1, site_2): x1, y1 =site_1.pos x2, y2 =site_2.pos ## define the condition for sites that you want to remove hopping if y2 == L and y1 == -L: return "white" else: return "k" kwant.plot(syst, hop_lw=hopping_low, hop_color=hopping_color, colorbar=False, ax=ax) I hope this will help. If not it would be better to give a small script to your case. Best Adel Le ven. 3 juin 2022 à 22:10, Sayandip Dhara <sayandip@knights.ucf.edu> a écrit :
Hello Christoph, Thanks for the suggestions. I would exactly like to make some hoppings invisible in a plot generated by kwant.plot. So when I use kwant.plot how do I specify inside that which of the hoppings I want to give zero width. If understand correctly you are suggesting that I have to write a function that I can pass through the "hop_color" argument. Now in that function can I just go through those hoppings which I want to make transparent or do I have to run it through every hopping in the system? Since I want all the hoppings in the bulk of the system to stay in the plot and all the hopping which are required for the periodic boundary condition to disappear, using kwant.plotter.map or kwant.plotter.density would not work.
participants (3)
-
Adel Belayadi
-
Christoph Groth
-
Sayandip Dhara