Hi Anton,

Thanks for that. While my lattice is polyatomic I just switched site.pos to 
site.tag in the code I posted last message to get the tags for my lattice. 
Doing that I see the tags for the z axis range from 0 to 9 (makes sense as I 
have 10 layers), which explains why 5.3 worked when I used it but not 10. My 
function runs now an accurately deletes the sites without any problems.

Thank You,
Mitchell Greenberg


Sent from Samsung Mobile

<div>-------- Original message --------</div><div>From: Anton Akhmerov 
<[email protected]> </div><div>Date:17/09/2017  5:11 AM  (GMT+10:00) 
</div><div>To: Mitchell Greenberg <[email protected]> 
</div><div>Cc: Joseph Weston 
<[email protected]>,[email protected] </div><div>Subject: 
Re: [Kwant] 2D Current Density Streamplot of 3D System </div><div>
</div>Hi Mitchel,

Deleting and adding sites is done by their lattice coordinates
(site.tag), not their real space position (site.pos); if you want to
access a site close to a certain position, you can use the method
Monatomic.closest (see
https://kwant-project.org/doc/1/reference/generated/kwant.lattice.Monatomic#kwant.lattice.Monatomic.closest).

Best,
Anton

On Sat, Sep 16, 2017 at 2:34 PM, Mitchell Greenberg
<[email protected]> wrote:
> Hi Joseph and Anton,
>
>
> Thank you for the advice with getting the 2d graph up and running, its now
> producing results that look good. Sorry that I haven't replied in over 2
> weeks, uni has gotten into full swing.
>
>
> I wasn't sure if I needed to start a new topic for this (if I need to let me
> know) but I am now trying to remove lattice points randomly from my sample.
> I have created a function that can remove random lattice points (it is
> rather messy) however I have noticed that when I try to delete sites for
> layers other than at z=0 and z=5.3 I get the following error.:
>
>
> KeyError: Site(kwant.lattice.Monatomic([[4.3763, 0.0, 0.0], [0.0, 3.3136,
> 0.0], [0.0, 0.0, 5.3]], [0.0, 0.0, 0.0], '0', 1), array([50, 50, 10]))
>
>
> This error seems to pop up when I try to delete a site that doesn't exist at
> the specified coordinates however when I use:
>
> Positions=[syst.sites[i].pos for i in range(len(syst.sites))]
>
>
> I see that sites definitely exist for z=10 (should be 10.6 but the error
> output seems to round). I was therefore wondering if there is something I am
> missing when it comes to deleting sites and if there is an easy way to
> delete random sites from a 3d sample.
>
>
> Thank You,
>
> Mitchell Greenberg
>
>
> ________________________________
> From: Joseph Weston <[email protected]>
> Sent: Wednesday, August 30, 2017 8:33:01 PM
> To: Mitchell Greenberg; [email protected]
> Subject: Re: [Kwant] 2D Current Density Streamplot of 3D System
>
> Hi Mitchell,
>
>> 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.
>
> The input to 'interpolate_current' is a current defined on the hoppings
> of your system. The output is a current defined over a realspace grid.
> First the current defined on the hoppings is convoluted with a bump
> function to smooth it out, then the resulting continuous vector field is
> sampled on a regular grid. The docstring explains how this is done. The
> interpolation grid does not in general coincide with the "grid" of sites
> that form your system. Typically there will be several interpolation
> points between neighboring sites.
>
> The 'box' returned by 'interpolate_current' allows you to calculate the
> realspace position of the interpolation points.
>
> Also the modifications to 'interpolate_current' so that it functions
> correctly for 3D systems just landed on the most recent development
> version of kwant [1].
>
>
> Happy Kwanting,
>
> Joe
>
>
> [1]:
> https://gitlab.kwant-project.org/kwant/kwant/commit/be364e7c64c316caf86869df397446399bcef1af
>
>

Reply via email to