Re: [Kwant] Regarding tranlational invariance along 2 directions

2017-01-24 Thread Anton Akhmerov
Dear Anant,

You are searching for the wraparound module built by Christoph and
previously announce on this mailing list. Please see the original
announcement over here:
https://www.mail-archive.com/kwant-discuss@kwant-project.org/msg00745.html

Once again I would like to remind you to try searching for questions
on this mailing list before asking questions.

Anton

On Tue, Jan 24, 2017 at 8:04 AM, ANANT VIJAY  wrote:
> Hello everyone,
>I am writing this to ask about how can I finalize the
> sytem with translational invariance along two directions.
> Code that I am using is the following as I want to make a slab system for
> band structure.
>
> sym = kwant.TranslationalSymmetry([1, 0, 0], [0, 1, 0])
>
> Error:
>
> ValueError: Currently, only builders without or
> with a 1D translational
>  symmetry can be finalized.
>
> Is there any solution to this?
>
> I also happen to get one code from notes on internet by
> edx course where thwe following code has been used using wraparound
> function.
>
> I did not get much out of it. Also, I checked I don't have this function in
> my kwant module. how can I get this functions module?
> Please anyone can explian what this function is doing in the code:
>
> def make_scatter_sys():
> from functions import wraparound
> syst = wraparound(bhz(Z=1, system_type='slab'))
> syst.attach_lead(make_lead())
> syst.attach_lead(wraparound(bhz(), keep=0))
> syst = syst.finalized()
> syst.leads[0] = TRIInfiniteSystem(syst.leads[0], trs)
> return syst
>
>
> ANANT VIJAY VARMA
> Research Scholar
> IISER-KOLKATA
> WEST BENGAL.


Re: [Kwant] Regarding smatrix and spin

2017-01-24 Thread Anton Akhmerov
Dear Camilla,

Could the difference originate from you using a lattice constant of 2
instead of 1?

Anton

On Tue, Jan 24, 2017, 10:41 Camilla Espedal  wrote:

> Dear Anton,
>
> Thanks again for all your help. I will try to do it the linux way. Just
> one more thing regarding this. I wrote a script in the old Kwant to find
> the total conductance and compare it to the one in your notebook. While the
> two plots are qualitatively similar, they are not the same. Am I missing
> something, or am I calculating different things?
>
> Best, Camilla
>
> (my code):
>
> # Tutorial 2.3.1. Matrix structure of on-site and hopping elements
> # 
> #
> # Physics background
> # --
> #  Gaps in quantum wires with spin-orbit coupling and Zeeman splititng,
> #  as theoretically predicted in
> #   http://prl.aps.org/abstract/PRL/v90/i25/e256601
> #  and (supposedly) experimentally oberved in
> #   http://www.nature.com/nphys/journal/v6/n5/abs/nphys1626.html
> #
> # Kwant features highlighted
> # --
> #  - Numpy matrices as values in Builder
>
> import kwant
>
> # For plotting
> import matplotlib.pyplot as plt
>
> # For matrix support
> import tinyarray
> import numpy as np
>
> # define Pauli-matrices for convenience
> sigma_0 = tinyarray.array([[1, 0], [0, 1]])
> sigma_x = tinyarray.array([[0, 1], [1, 0]])
> sigma_y = tinyarray.array([[0, 1j], [-1j, 0]])
> sigma_z = tinyarray.array([[1, 0], [0, -1]])
>
>
> def make_system(a=2, t=1.0, alpha=0.1, e_z=0.05, W=10, L=10):
> # Start with an empty tight-binding system and a single square lattice.
> # `a` is the lattice constant (by default set to 1 for simplicity).
> lat = kwant.lattice.square(a)
>
> sys = kwant.Builder()
>
>  Define the scattering region. 
> sys[(lat(x, y) for x in range(L) for y in range(W))] = \
> 4 * t * sigma_0 + e_z * sigma_z
> # hoppings in x-direction
> sys[kwant.builder.HoppingKind((1, 0), lat, lat)] = \
> -t * sigma_0 - 1j * alpha * sigma_y
> # hoppings in y-directions
> sys[kwant.builder.HoppingKind((0, 1), lat, lat)] = \
> -t * sigma_0 + 1j * alpha * sigma_x
>
>  Define the left lead. 
> lead = kwant.Builder(kwant.TranslationalSymmetry((-a, 0)))
>
> lead[(lat(0, j) for j in range(W))] = 4 * t * sigma_0
> # hoppings in x-direction
> lead[lat.neighbors()] = \
> -t * sigma_0
>
>  Attach the leads and return the finalized system. 
> sys.attach_lead(lead)
> sys.attach_lead(lead.reversed())
>
> return sys
>
>
> def plot_conductance(sys, energies):
> # Compute conductance
> data = []
> for energy in energies:
> smatrix = kwant.smatrix(sys, energy)
> data.append(smatrix.transmission(1, 0))
>
> pyplot.figure()
> pyplot.plot(energies, data)
> pyplot.xlabel("energy [t]")
> pyplot.ylabel("conductance [e^2/h]")
> pyplot.show()
>
>
> def main():
> sys = make_system()
>
> # Check that the system looks as intended.
> kwant.plot(sys)
>
> # Finalize the system.
> sys = sys.finalized()
> energies = np.linspace(0, 1, 200)
> smatrices = [kwant.smatrix(sys, energy) for energy in energies]
>
> fig = plt.figure(figsize=(13, 8))
> ax = fig.add_subplot(1, 1, 1)
>
> ax.plot(energies, [smatrix.transmission(1,0) for smatrix in
> smatrices], label='total')
>
> ax.set_ylabel('$G [e^2/h]$', fontsize='xx-large')
> ax.set_xlabel('$E/t$', fontsize='xx-large')
> ax.legend(fontsize='x-large')
>
> plt.show()
>
>
>
> # Call the main function if the script gets executed (as opposed to
> imported).
> # See .
> if __name__ == '__main__':
> main()
>
> -Original Message-
> From: anton.akhme...@gmail.com [mailto:anton.akhme...@gmail.com] On
> Behalf Of Anton Akhmerov
> Sent: 17. januar 2017 10:48
> To: Camilla Espedal 
> Cc: kwant-discuss@kwant-project.org
> Subject: Re: [Kwant] Regarding smatrix and spin
>
> Dear Camilla,
>
> It seems that you are trying to install Kwant on windows. This is a very
> hard task, and I fear none of the Kwant developers has enough knowledge of
> it right now (our Windows packages are built by Christoph Gohlke, see [1]
> for the build environment description). However if you are using windows
> 10, I suggest to try to install Kwant using the windows subsystem for
> linux. That way the standard Ubuntu build procedure should work for you.
>
> Best,
> Anton
>
> [1]: http://www.lfd.uci.edu/~gohlke/pythonlibs/
>
> On Mon, Jan 16, 2017 at 9:45 AM, Camilla Espedal 
> wrote:
> > Thanks a lot. I tried to install the cons_laws_combined, but I get the
> following error message:
> >
> > "LINK: fatal error LNK1181: cannot open input file 'lapack.lib'"
> >
> > Is there some package or installation I am missing?
> >
> >