Hi Anton,
Sorry again for the reply, I've had a look at the documentation and it seems that relwidth and abswidth control the size of the arrays. What I'm stuck on though is that my system has L = 80, W = 450 and H =52, I was expecting field to return something of the form (80,450,52,3), I must apologise again, I'm pretty new to all things python so my knowledge in the more complex areas is lacking. Thank You again, Mitchell Greenberg ________________________________ From: anton.akhme...@gmail.com <anton.akhme...@gmail.com> on behalf of Anton Akhmerov <anton.akhmerov...@gmail.com> Sent: Sunday, August 27, 2017 7:39:45 PM To: Mitchell Greenberg Cc: kwant-discuss@kwant-project.org Subject: Re: [Kwant] 2D Current Density Streamplot of 3D System > Yep okay that makes sense now, sorry that didn't click. One final question I > would have then is that the field vector array has a z index of 28, whereas > my system has a height of 52 with 10 layers in it, is this due to the > prefactor that I might need to redefine? No, the resolution is controlled by other arguments of interpolate current, please consult the documentation. Best, Anton > Thank You, > > Mitchell Greenberg > > ________________________________ > From: anton.akhme...@gmail.com <anton.akhme...@gmail.com> on behalf of Anton > Akhmerov <anton.akhmerov...@gmail.com> > Sent: Sunday, August 27, 2017 7:30:44 PM > > To: Mitchell Greenberg > Cc: kwant-discuss@kwant-project.org > Subject: Re: [Kwant] 2D Current Density Streamplot of 3D System > > Hi MItchel, > >> Sorry this stuff is all a bit beyond me. If I apply current[:, :, 12, :2]. >> am I essentially taking a slice at z = 0? If so how would I modify that >> expression to look at a layer where z = 20? > > That would be z = 12 (so you'd need to change the third index). If you > want to understand numpy slicing better, take a look here: > https://arxiv.org/abs/1102.1523 > > Best, > Anton > >> Sorry for the trouble, >> >> Mitchell Greenberg >> >> ________________________________ >> From: anton.akhme...@gmail.com <anton.akhme...@gmail.com> on behalf of >> Anton >> Akhmerov <anton.akhmerov...@gmail.com> >> Sent: Sunday, August 27, 2017 6:34:58 PM >> >> To: Mitchell Greenberg >> Cc: kwant-discuss@kwant-project.org >> Subject: Re: [Kwant] 2D Current Density Streamplot of 3D System >> >> Hi Mitchell, >> >>> The shape of the field array that gets returned is: >>> >>> (38, 28, 28, 3) >>> >>> From looking at the source code the 3 on the end seems to just be for >>> whatever dimension your system is, so I assume it's not a simple fix as >>> it >>> seems kwants 'streamplot' wants a 3d array and not a 4d array. >> >> Since current is a vector and not a scalar, you get a vector field >> evaluated over a homogeneous grid. And of course now it is a >> 3D-vector, and not a 2D vector. So for example you could get rid of >> the z-component entirely by selecting current[:, :, 12, :2]. >> >> Another interesting possibility that I suggest to explore is to >> somehow use ipyvolume (see ipyvolume.readthedocs.io) for rendering the >> 3D current distribution. >> >> Cheers, >> Anton >> >>> >>> >>> Any advice would be greatly appreciated. >>> >>> >>> Thank You, >>> >>> Mitchell Greenberg >>> >>> ________________________________ >>> From: anton.akhme...@gmail.com <anton.akhme...@gmail.com> on behalf of >>> Anton >>> Akhmerov <anton.akhmerov...@gmail.com> >>> Sent: Saturday, August 26, 2017 8:49:08 PM >>> >>> To: Mitchell Greenberg >>> Cc: kwant-discuss@kwant-project.org >>> Subject: Re: [Kwant] 2D Current Density Streamplot of 3D System >>> >>> Hi Mitchell, >>> >>> The only problem that occurs if you remove the check is the >>> normalization of the current density; in 3D you'd need to redo the >>> integration of the smoothing function to get the right prefactor. If >>> that doesn't bother you, just remove the check (or you could compute >>> the correct prefactor). >>> >>> Best, >>> Anton >>> >>> On Sat, Aug 26, 2017 at 3:30 AM, Mitchell Greenberg >>> <mitchell.greenb...@my.jcu.edu.au> wrote: >>>> Hi Anton, >>>> >>>> >>>> Thanks for the quick reply, when I try to call >>>> kwant.plotter.interpolate_current(syst,current) for my 3D system, I >>>> encounter the following error: >>>> >>>> >>>> 'interpolate_current' only works for 2D systems. >>>> >>>> >>>> The error triggers at the line: >>>> >>>> >>>> # TODO: Generalize 'factor' prefactor to arbitrary dimensions and >>>> remove >>>> # this check. This check is done here to keep changes local >>>> if dim != 2: >>>> raise ValueError("'interpolate_current' only works for 2D >>>> systems.") >>>> >>>> >>>> I went and had a look at the source code and it seems that this check is >>>> here 'to keep changes local' and that a 'TODO' is to generalize the >>>> prefactor to arbitrary dimensions, can I just remove this check or >>>> will >>>> that cause issues? >>>> >>>> >>>> If this cannot be done I was looking at current density calculations on >>>> the >>>> forums last night and I saw there was code for a manual calculation of >>>> current density, I also saw on the forums that we can get the 'slice' of >>>> the >>>> wavefunctions through: >>>> >>>> >>>> wavefunction = wf(0) >>>> >>>> def in_sheet(site): >>>> return site.pos[1] == 0 # site in x-z plane, y position == 0 >>>> >>>> >>>> For my code I'd switch to site.pos[2] == 0 since we want z axis slices >>>> >>>> >>>> sheet = [idx for idx, site in enumerate(sysf.sites) if >>>> in_sheet(site)] >>>> >>>> >>>> wavefunction_in_plane = wavefunction[0][sheet] >>>> >>>> >>>> Is there a way I can use the manual calculation: >>>> >>>> >>>> I_ij = 2 𝕀m[ Ψ⁺_i H_ij Ψ_j ] >>>> >>>> >>>> By only evaluating the 2D section of the wavefunction and hamiltonian >>>> that >>>> we want? >>>> >>>> >>>> Many Thanks, >>>> >>>> Mitchell Greenberg >>>> >>>> ________________________________ >>>> From: anton.akhme...@gmail.com <anton.akhme...@gmail.com> on behalf of >>>> Anton >>>> Akhmerov <anton.akhmerov...@gmail.com> >>>> Sent: Saturday, August 26, 2017 2:35:56 AM >>>> To: Mitchell Greenberg >>>> Cc: kwant-discuss@kwant-project.org >>>> Subject: Re: [Kwant] 2D Current Density Streamplot of 3D System >>>> >>>> Hi Mitchell, >>>> >>>> You can use the low level function that calculates the current >>>> interpolation: >>>> >>>> >>>> >>>> https://kwant-project.org/doc/1/reference/generated/kwant.plotter.interpolate_current#kwant.plotter.interpolate_current >>>> >>>> I believe this function will work in 3D as well. Then you can slice >>>> the result to get the 2D distribution that you need. >>>> >>>> Internally we do that and then essentially pass the output to the >>>> matplotlib streamplot (or rather kwant.plotter.streamplot). >>>> >>>> Best, >>>> Anton >>>> >>>> On Fri, Aug 25, 2017 at 12:15 PM, Mitchell Greenberg >>>> <mitchell.greenb...@my.jcu.edu.au> wrote: >>>>> Hello, >>>>> >>>>> >>>>> >>>>> I am currently completing my thesis using Kwant, per discussions with >>>>> my >>>>> supervisor we would like to plot the current density as a streamplot of >>>>> our >>>>> 3d system for different z-axis 'slices' of the system (our system has >>>>> an >>>>> exponentially decaying potential in the z direction, so we'd expect >>>>> current >>>>> to flow differently through each layer). >>>>> >>>>> >>>>> >>>>> I have tried tinkering with the new current functions implemented in >>>>> 1.3 >>>>> but >>>>> the plotting function can only plot 2d systems. Is there a way to >>>>> obtain >>>>> the >>>>> current density streamplot for a 2d 'slice' of our 3d system. >>>>> >>>>> >>>>> >>>>> Thank You, >>>>> >>>>> Mitchell Greenberg >>>>> >>>>>