Hi Felix, Adel, Abbout Adel wrote:
The shape of "Field" is not very clear to me. I do not understand exactly how it depends on the parameter n (the default value is n=9) in the documentation. So, it is not good to put x_cut as a first index since the shape of "field" changes with n. The last parameter should not refer to Jx or any other component. It seems that it depends on the dimension of the system. (You can check this function with a spinless model, in 2D and 3D) Probably @Christoph Groth (or another person) can better explain this since the documentation is poor about this function.
I would be happy to improve the documentation of kwant.plotter.interpolate_current, but I am not sure that I understand what exactly is not clear to you. The function interpolate_current interpolates the current field of a n-dimensional Kwant system in real space and than samples this continuous field over a n-dimensional hyper-square lattice (i.e. cubic in 3d). This is what the docstring means when it says: “This routine samples the smoothed field on a regular (square or cubic) grid.” So, the points of the returned field do not in general correspond to Kwant sites. After all, the Kwant system does not have to live on a square lattice (or any regular lattice). Moreover, there are, depending on the ‘n’ parameter, typically more field points than system sites. Thanks to this, running the routine with the default n=9 yields a smooth field that looks nicely. The default of n=9 was chosen such that a “bump” is resolved reasonably well. Sampling the continuous interpolated current density field with a coarser grid is of course possible, but the plot will not look smooth, and while it is certainly possible to smooth it out while plotting, this smoothing will not be physically correct. Therefore it is best to display interpolated current density fields without further smoothing. I hope that now it is clear to you what interpolate_current does. Please do not hesitate to suggest clarification of the docstring. ---------------- Regarding the original problem, I expect that if there are indeed hoppings that are perpendicular to the plane, and all the other hoppings are in-plane, it should be possible to use a Kwant current operator and specify the piercing hoppings as “where”. Then, plotting of the resulting *scalar* field could be done with Kwant’s “interpolate_density”. In the general case of an arbitrary cutting plane and an arbitrary system, if “interpolate_current” is too slow for the whole system, a generalization of Adel’s suggestion should work. One creates a copy of the original system that retains only the sites and hoppings that have an influence on the cutting plane. (The influence of each hopping is restricted to “Capsule” [1] along the hopping with radius “r” that is computed as using the “relwidth” and “abswidth” parameters.) Please do let me know if anything remains unclear. Christoph [1] https://en.wikipedia.org/wiki/Capsule_(geometry)