Dear Kwant developers,
I'm playing with the current maps and there is something I don't understand. I attatch a current plot of a 2 terminal-device of some edge states in a particular model of graphene (the current is the sum of all wavefunctions from the incoming lead which is positioned at the left). I understand thus that the arrows point from left to right, it's the current direction. But then, in one edge I have a stronger color meaning there is more current there, but on the other hand, in the other edge the arrow is thicker, which I assume it also represents more current. Does the arrow thickness and color represent the same thing and therefore both edges have the same current or do they represent different things and so I'm missing something? Could you please clarify this for me?
In addition, when I plot the spin current projected on the Z axis (as in Kwant's documentation), I assume that the direction of the arrow is for example where the spin-up electrons move, while the spin-down electrons move to the other direction. Is this correct?
Thank you in advance for your help.
Bests?,
Marc
------------------------ Marc Vila Tusell La Caixa - Severo Ochoa PhD in the Theoretical and Computational Nanoscience Group Catalan Institute of Nanoscience and Nanotechnology (ICN2) Barcelona Institute of Science and Technology (BIST)
Additional information:
http://icn2.cat/en/theoretical-and-computational-nanoscience-group
https://www.researchgate.net/profile/Marc_Vila_Tusell
https://www.becarioslacaixa.net/marc-vila-tusell-BI00042?nav=true
Hi Marc,
Observe that the arrows at the bottom edge are positioned away from the maximum. Therefore it's likely that there the current density is lower than at the maximum of the top edge.
Best, Anton
On Tue, Oct 16, 2018 at 12:56 PM Marc Vila marc.vila@icn2.cat wrote:
Dear Kwant developers,
I'm playing with the current maps and there is something I don't understand. I attatch a current plot of a 2 terminal-device of some edge states in a particular model of graphene (the current is the sum of all wavefunctions from the incoming lead which is positioned at the left). I understand thus that the arrows point from left to right, it's the current direction. But then, in one edge I have a stronger color meaning there is more current there, but on the other hand, in the other edge the arrow is thicker, which I assume it also represents more current. Does the arrow thickness and color represent the same thing and therefore both edges have the same current or do they represent different things and so I'm missing something? Could you please clarify this for me?
In addition, when I plot the spin current projected on the Z axis (as in Kwant's documentation), I assume that the direction of the arrow is for example where the spin-up electrons move, while the spin-down electrons move to the other direction. Is this correct?
Thank you in advance for your help.
Bests,
Marc
*Marc Vila Tusell *La Caixa - Severo Ochoa PhD in the Theoretical and Computational Nanoscience Group Catalan Institute of Nanoscience and Nanotechnology (ICN2) Barcelona Institute of Science and Technology (BIST)
Additional information:
http://icn2.cat/en/theoretical-and-computational-nanoscience-group
https://www.researchgate.net/profile/Marc_Vila_Tusell
https://www.becarioslacaixa.net/marc-vila-tusell-BI00042?nav=true
Hi Anton,
Thanks for the quick answer. Your and Christoph answer have been useful?.
Thanks again!
Bests,
Marc
------------------------ Marc Vila Tusell La Caixa - Severo Ochoa PhD in the Theoretical and Computational Nanoscience Group Catalan Institute of Nanoscience and Nanotechnology (ICN2) Barcelona Institute of Science and Technology (BIST)
Additional information:
http://icn2.cat/en/theoretical-and-computational-nanoscience-group
https://www.researchgate.net/profile/Marc_Vila_Tusell
https://www.becarioslacaixa.net/marc-vila-tusell-BI00042?nav=true
https://orcid.org/0000-0001-9118-421X
________________________________ From: Anton Akhmerov anton.akhmerov+kd@gmail.com Sent: Tuesday, October 16, 2018 1:29 PM To: Marc Vila Cc: kwant-discuss@kwant-project.org Subject: Re: [Kwant] Understanding current maps
Hi Marc,
Observe that the arrows at the bottom edge are positioned away from the maximum. Therefore it's likely that there the current density is lower than at the maximum of the top edge.
Best, Anton
On Tue, Oct 16, 2018 at 12:56 PM Marc Vila <marc.vila@icn2.catmailto:marc.vila@icn2.cat> wrote:
Dear Kwant developers,
I'm playing with the current maps and there is something I don't understand. I attatch a current plot of a 2 terminal-device of some edge states in a particular model of graphene (the current is the sum of all wavefunctions from the incoming lead which is positioned at the left). I understand thus that the arrows point from left to right, it's the current direction. But then, in one edge I have a stronger color meaning there is more current there, but on the other hand, in the other edge the arrow is thicker, which I assume it also represents more current. Does the arrow thickness and color represent the same thing and therefore both edges have the same current or do they represent different things and so I'm missing something? Could you please clarify this for me?
In addition, when I plot the spin current projected on the Z axis (as in Kwant's documentation), I assume that the direction of the arrow is for example where the spin-up electrons move, while the spin-down electrons move to the other direction. Is this correct?
Thank you in advance for your help.
Bests?,
Marc
------------------------ Marc Vila Tusell La Caixa - Severo Ochoa PhD in the Theoretical and Computational Nanoscience Group Catalan Institute of Nanoscience and Nanotechnology (ICN2) Barcelona Institute of Science and Technology (BIST)
Additional information:
http://icn2.cat/en/theoretical-and-computational-nanoscience-group
https://www.researchgate.net/profile/Marc_Vila_Tusell
https://www.becarioslacaixa.net/marc-vila-tusell-BI00042?nav=true
Marc Vila wrote:
But then, in one edge I have a stronger color meaning there is more current there, but on the other hand, in the other edge the arrow is thicker, which I assume it also represents more current. Does the arrow thickness and color represent the same thing and therefore both edges have the same current or do they represent different things and so I'm missing something? Could you please clarify this for me?
Hi Marc, did you check the documentation of kwant.plotter.streamplot? Do you find it unclear? In which way?
You are right that both the color plot and the flow lines show the same information, or rather slightly different complementary aspects of it:
- The color plot shows more details and is more quantitative, but it does not show the overall direction of the current.
- The flow lines do show the direction, but lack detail.
The algorithm that draws the flowlines (we use matplotlib.streamplot) basically starts drawing streamlines at random points and avoids drawing them too close to each other. That algorithm has no idea of the overall form of the current field, so that it may happen that it draws one line in the middle of an edge state, while for another edge state it draws two lines at the sides (where the density is lower).
Cheers, Christoph
Hi Christoph,
I thought the current was plotted with kwant.plotter.current(), so I just checked that documentation. Now I see that it's a shortcut for the stremplot.
I understand your explanation about how the lines are drawn, but, if the algorithm doesn't know about the form of the current field, how does it know how thick it needs to draw the arrow? In any case, could it be safer to plot the arrows with always the same thickness and just look at the colorplot to see the value?
Thanks for the explanation!
________________________________________ From: Christoph Groth christoph.groth@cea.fr Sent: Tuesday, October 16, 2018 1:58 PM To: Marc Vila Cc: kwant-discuss@kwant-project.org Subject: Re: [Kwant] Understanding current maps
Marc Vila wrote:
But then, in one edge I have a stronger color meaning there is more current there, but on the other hand, in the other edge the arrow is thicker, which I assume it also represents more current. Does the arrow thickness and color represent the same thing and therefore both edges have the same current or do they represent different things and so I'm missing something? Could you please clarify this for me?
Hi Marc, did you check the documentation of kwant.plotter.streamplot? Do you find it unclear? In which way?
You are right that both the color plot and the flow lines show the same information, or rather slightly different complementary aspects of it:
- The color plot shows more details and is more quantitative, but it does not show the overall direction of the current.
- The flow lines do show the direction, but lack detail.
The algorithm that draws the flowlines (we use matplotlib.streamplot) basically starts drawing streamlines at random points and avoids drawing them too close to each other. That algorithm has no idea of the overall form of the current field, so that it may happen that it draws one line in the middle of an edge state, while for another edge state it draws two lines at the sides (where the density is lower).
Cheers, Christoph
Marc Vila wrote:
I thought the current was plotted with kwant.plotter.current(), so I just checked that documentation. Now I see that it's a shortcut for the stremplot.
kwant.plotter.current() calls kwant.plotter.streamplot() to do the plotting which in turns piggybacks on matplotlib.streamplot() to trace the streamlines. The added value of kwant.plotter.streamplot() is that it plots both the streamlines (using matplotlib's streamplot()) and the background color plot (using matplotlib's imshow()).
I understand your explanation about how the lines are drawn, but, if the algorithm doesn't know about the form of the current field, how does it know how thick it needs to draw the arrow?
The current field data is of course available to matplotlib.streamplot(). It's just that the streamline tracing algorithm doesn't use this information (if you normalize the stream speed to 1 everywhere, you'd get the same streamlines). When plotting the streamlines, the density is taken into account.
In any case, could it be safer to plot the arrows with always the same thickness and just look at the colorplot to see the value?
We tried that, but then in a case like yours the whole plot is full of streamlines even where the current density is practically zero. This is ugly and confusing.
One can also imagine a completely different kind of streamplot where all streamlines have the same thickness and it's their density that is proportional to the local flow speed. Such a streamplot would avoid the many problems and would correspond better to what physicists are used to. But it would require implementing something completely independent from matplotlib.streamplot().
Meanwhile, matplotlib.streamplot() works as follows:
The plotting domain is subdivided into a grid of cells (30*30 by default) where each cell can have, at most, one traversing streamline. The streamlines start at points specified by the 'start_points' parameter. The docstring doesn't say what happens if 'start_points' is not given, but looking at the source code unearths the following:
def _gen_starting_points(shape): """Yield starting points for streamlines.
Trying points on the boundary first gives higher quality streamlines. This algorithm starts with a point on the mask corner and spirals inward. This algorithm is inefficient, but fast compared to rest of streamplot. """
I suspect that a better algorithm to generate starting points would have to actually look at the stream field and try to put streamlines at significant places, like the centers of "streams". But such an algorithm would be tricky, because it would also have to respect that streamlines should be equally spaced.
In any way, plotter.streamplot() is just a small part of Kwant, so we don't want to spend too much time on it. (We've already spent a lot of time on doing the current density interpolation right.) If there are people who are motivated to improve current density plots, I'd be happy to assist.
Hi Crhistoph,
Thanks a lot for the detailed information. Now I understand much better how the algorithm works. For me it's good enough as it is now, I just wanted to understand a little bit more how to interpret the maps I get.
Kind regards,
Marc
------------------------ Marc Vila Tusell La Caixa - Severo Ochoa PhD in the Theoretical and Computational Nanoscience Group Catalan Institute of Nanoscience and Nanotechnology (ICN2) Barcelona Institute of Science and Technology (BIST)
Additional information:
http://icn2.cat/en/theoretical-and-computational-nanoscience-group
https://www.researchgate.net/profile/Marc_Vila_Tusell
https://www.becarioslacaixa.net/marc-vila-tusell-BI00042?nav=true
https://orcid.org/0000-0001-9118-421X
________________________________________ From: Christoph Groth christoph.groth@cea.fr Sent: Wednesday, October 17, 2018 11:00 AM To: Marc Vila Cc: kwant-discuss@kwant-project.org Subject: Re: [Kwant] Understanding current maps
Marc Vila wrote:
I thought the current was plotted with kwant.plotter.current(), so I just checked that documentation. Now I see that it's a shortcut for the stremplot.
kwant.plotter.current() calls kwant.plotter.streamplot() to do the plotting which in turns piggybacks on matplotlib.streamplot() to trace the streamlines. The added value of kwant.plotter.streamplot() is that it plots both the streamlines (using matplotlib's streamplot()) and the background color plot (using matplotlib's imshow()).
I understand your explanation about how the lines are drawn, but, if the algorithm doesn't know about the form of the current field, how does it know how thick it needs to draw the arrow?
The current field data is of course available to matplotlib.streamplot(). It's just that the streamline tracing algorithm doesn't use this information (if you normalize the stream speed to 1 everywhere, you'd get the same streamlines). When plotting the streamlines, the density is taken into account.
In any case, could it be safer to plot the arrows with always the same thickness and just look at the colorplot to see the value?
We tried that, but then in a case like yours the whole plot is full of streamlines even where the current density is practically zero. This is ugly and confusing.
One can also imagine a completely different kind of streamplot where all streamlines have the same thickness and it's their density that is proportional to the local flow speed. Such a streamplot would avoid the many problems and would correspond better to what physicists are used to. But it would require implementing something completely independent from matplotlib.streamplot().
Meanwhile, matplotlib.streamplot() works as follows:
The plotting domain is subdivided into a grid of cells (30*30 by default) where each cell can have, at most, one traversing streamline. The streamlines start at points specified by the 'start_points' parameter. The docstring doesn't say what happens if 'start_points' is not given, but looking at the source code unearths the following:
def _gen_starting_points(shape): """Yield starting points for streamlines.
Trying points on the boundary first gives higher quality streamlines. This algorithm starts with a point on the mask corner and spirals inward. This algorithm is inefficient, but fast compared to rest of streamplot. """
I suspect that a better algorithm to generate starting points would have to actually look at the stream field and try to put streamlines at significant places, like the centers of "streams". But such an algorithm would be tricky, because it would also have to respect that streamlines should be equally spaced.
In any way, plotter.streamplot() is just a small part of Kwant, so we don't want to spend too much time on it. (We've already spent a lot of time on doing the current density interpolation right.) If there are people who are motivated to improve current density plots, I'd be happy to assist.