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
>>
>>

Reply via email to