Dear John,

I believe the error message is quite accurate here: (0, 0, a) is not a
lattice vector, and therefore your lattice may not have such a
translational symmetry. If you double the period of the lead symmetry, the
lead creation should work.

Best,
Anton

On Thu, Apr 13, 2017, 16:57 John Eaves <[email protected]> wrote:

> Good day
>
> I am trying to make a simple 3D geometry; a cylinder. Now, the only
> tutorial available for 3D is
> https://kwant-project.org/doc/1.0/tutorial/tutorial6#d-example-zincblende-structure
> so there is a chance my problems come from that.
>
> The thing is that I cannot seem to attach any leads. The scattering region
> code works just fine, but when I try to attach the leads I get the error
>
> Site family <unnamed Monatomic lattice, vectors [0.0 1.0 1.0], [1.0 0.0 1.0], 
> [1.0 1.0 0.0], origin [0.0 0.0 0.0]> does not have commensurate periods with 
> symmetry <kwant.lattice.TranslationalSymmetry object at 0x00000000093B17F0>.
> The error is not completely opague of course; something seems to be 
> problematic about the lattice vectors and the proposed symmetry. For that it 
> is perhaps good to include the full code:
>
> def make_system(a=1, t=1.0, W=10, L=5, r2=20):
>     lat = kwant.lattice.general([(0, a, a), (a, 0, a), (a, a, 0)])
>     sys = kwant.Builder()
>
>     def ring(pos):
>         (x, y,z) = pos
>         rsq = x ** 2 + y ** 2
>         return rsq < r2 ** 2 and 0 <= z < L
>
>     sys[lat.shape(ring, (1, 1,1))] = 4 * t
>     sys[lat.neighbors()] = -t
>
>     sym_lead = kwant.TranslationalSymmetry((0, 0,-a))
>     lead = kwant.Builder(sym_lead)
>
>     def lead_shape(pos):
>         (x, y,z) = pos
>         rsq = x ** 2 + y ** 2
>         return rsq < r2 ** 2
>
>     lead[lat.shape(lead_shape, (0, 0,0))] = 4 * t
>     lead[lat.neighbors()] = -t
>
>     sys.attach_lead(lead)
>     sys.attach_lead(lead.reversed())
>
>     return sys
>
>
>
> I personally do not see what is wrong with this, especially as the scattering 
> region looks fine without the leads. According to the error there is 
> something wrong with the lattice vectors themselves? Should I change them in 
> some way?
> I don't care about any particular structure here really, I am just looking 
> for the 3D equivalent of the square lattice and according to the source code 
> that is defined as
>
> def square(a=1, name=''):
>     """Make a square lattice."""
>     return Monatomic(((a, 0), (0, a)), name=name)
>
> so I figured my definition should work for 3D.
>
> Could someone point out the obvious mistake I am making?
>
>
>
>

Reply via email to