
Hello, I'm trying to calculate transmission function including spin with Matrix for onsite values but when i am writting the code that is explained on the site (http://kwant-project.org/doc/1.0/tutorial/tutorial2) it makes the calculation but a few seconds later Python stops and all the datas vanishe. Thank you for your help. Best Regards. Alexis Bozio

Hi Alexis, Can you share the code that you wrote? Is there any error being raised? Can you check if your kwant installation is working? To do so execute import kwant kwant.test() and check the output. Best, Anton On Thu, Jun 25, 2015 at 11:25 AM, Alexis Bozio <alexis-bozio@hotmail.fr> wrote:
Hello,
I'm trying to calculate transmission function including spin with Matrix for onsite values but when i am writting the code that is explained on the site (http://kwant-project.org/doc/1.0/tutorial/tutorial2) it makes the calculation but a few seconds later Python stops and all the datas vanishe. Thank you for your help. Best Regards. Alexis Bozio

Hi Anton, Thank you for awnsering! I don't think that it is e problem with my code because there because i am using the one that is used on the tutoring of kwant: import kwant # For plotting from matplotlib import pyplot # For matrix support import tinyarray # 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=1, t=1.0, alpha=0.5, e_z=0.08, W=10, L=30): # 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 xrange(W))] = 4 * t * sigma_0 + e_z * sigma_z # hoppings in x-direction lead[kwant.builder.HoppingKind((1, 0), lat, lat)] = \ -t * sigma_0 - 1j * alpha * sigma_y # hoppings in y-directions lead[kwant.builder.HoppingKind((0, 1), lat, lat)] = \ -t * sigma_0 + 1j * alpha * sigma_x #### 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() # We should see non-monotonic conductance steps. plot_conductance(sys, energies=[0.01 * i - 0.3 for i in xrange(100)]) # Call the main function if the script gets executed (as opposed to imported). # See <http://docs.python.org/library/__main__.html>. if __name__ == '__main__': main()Best Regards, Alexis
From: anton.akhmerov@gmail.com Date: Thu, 25 Jun 2015 11:28:58 +0200 Subject: Re: [Kwant] Spin To: alexis-bozio@hotmail.fr CC: kwant-discuss@kwant-project.org
Hi Alexis,
Can you share the code that you wrote? Is there any error being raised?
Can you check if your kwant installation is working? To do so execute
import kwant kwant.test()
and check the output.
Best, Anton
On Thu, Jun 25, 2015 at 11:25 AM, Alexis Bozio <alexis-bozio@hotmail.fr> wrote:
Hello,
I'm trying to calculate transmission function including spin with Matrix for onsite values but when i am writting the code that is explained on the site (http://kwant-project.org/doc/1.0/tutorial/tutorial2) it makes the calculation but a few seconds later Python stops and all the datas vanishe. Thank you for your help. Best Regards. Alexis Bozio

So this means your Kwant installation is broken. What is the OS? How did you install Kwant? What does import kwant; kwant.test() return? Best, Anton On Thu, Jun 25, 2015 at 1:34 PM, Alexis Bozio <alexis-bozio@hotmail.fr> wrote:
Hi Anton, Thank you for awnsering! I don't think that it is e problem with my code because there because i am using the one that is used on the tutoring of kwant:
import kwant
# For plotting from matplotlib import pyplot
# For matrix support import tinyarray
# 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=1, t=1.0, alpha=0.5, e_z=0.08, W=10, L=30): # 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 xrange(W))] = 4 * t * sigma_0 + e_z * sigma_z # hoppings in x-direction lead[kwant.builder.HoppingKind((1, 0), lat, lat)] = \ -t * sigma_0 - 1j * alpha * sigma_y # hoppings in y-directions lead[kwant.builder.HoppingKind((0, 1), lat, lat)] = \ -t * sigma_0 + 1j * alpha * sigma_x
#### 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()
# We should see non-monotonic conductance steps. plot_conductance(sys, energies=[0.01 * i - 0.3 for i in xrange(100)])
# Call the main function if the script gets executed (as opposed to imported). # See <http://docs.python.org/library/__main__.html>. if __name__ == '__main__': main()
Best Regards,
Alexis
From: anton.akhmerov@gmail.com Date: Thu, 25 Jun 2015 11:28:58 +0200 Subject: Re: [Kwant] Spin To: alexis-bozio@hotmail.fr CC: kwant-discuss@kwant-project.org
Hi Alexis,
Can you share the code that you wrote? Is there any error being raised?
Can you check if your kwant installation is working? To do so execute
import kwant kwant.test()
and check the output.
Best, Anton
On Thu, Jun 25, 2015 at 11:25 AM, Alexis Bozio <alexis-bozio@hotmail.fr> wrote:
Hello,
I'm trying to calculate transmission function including spin with Matrix for onsite values but when i am writting the code that is explained on the site (http://kwant-project.org/doc/1.0/tutorial/tutorial2) it makes the calculation but a few seconds later Python stops and all the datas vanishe. Thank you for your help. Best Regards. Alexis Bozio

It returns : ................................................................................................ ---------------------------------------------------------------------- Ran 96 tests in 16.963s OK And i am on Windows. Best, Alexis
From: anton.akhmerov@gmail.com Date: Fri, 26 Jun 2015 00:42:29 +0200 Subject: Re: [Kwant] Spin To: alexis-bozio@hotmail.fr CC: kwant-discuss@kwant-project.org
So this means your Kwant installation is broken.
What is the OS? How did you install Kwant? What does
import kwant; kwant.test()
return?
Best, Anton
On Thu, Jun 25, 2015 at 1:34 PM, Alexis Bozio <alexis-bozio@hotmail.fr> wrote:
Hi Anton, Thank you for awnsering! I don't think that it is e problem with my code because there because i am using the one that is used on the tutoring of kwant:
import kwant
# For plotting from matplotlib import pyplot
# For matrix support import tinyarray
# 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=1, t=1.0, alpha=0.5, e_z=0.08, W=10, L=30): # 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 xrange(W))] = 4 * t * sigma_0 + e_z * sigma_z # hoppings in x-direction lead[kwant.builder.HoppingKind((1, 0), lat, lat)] = \ -t * sigma_0 - 1j * alpha * sigma_y # hoppings in y-directions lead[kwant.builder.HoppingKind((0, 1), lat, lat)] = \ -t * sigma_0 + 1j * alpha * sigma_x
#### 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()
# We should see non-monotonic conductance steps. plot_conductance(sys, energies=[0.01 * i - 0.3 for i in xrange(100)])
# Call the main function if the script gets executed (as opposed to imported). # See <http://docs.python.org/library/__main__.html>. if __name__ == '__main__': main()
Best Regards,
Alexis
From: anton.akhmerov@gmail.com Date: Thu, 25 Jun 2015 11:28:58 +0200 Subject: Re: [Kwant] Spin To: alexis-bozio@hotmail.fr CC: kwant-discuss@kwant-project.org
Hi Alexis,
Can you share the code that you wrote? Is there any error being raised?
Can you check if your kwant installation is working? To do so execute
import kwant kwant.test()
and check the output.
Best, Anton
On Thu, Jun 25, 2015 at 11:25 AM, Alexis Bozio <alexis-bozio@hotmail.fr> wrote:
Hello,
I'm trying to calculate transmission function including spin with Matrix for onsite values but when i am writting the code that is explained on the site (http://kwant-project.org/doc/1.0/tutorial/tutorial2) it makes the calculation but a few seconds later Python stops and all the datas vanishe. Thank you for your help. Best Regards. Alexis Bozio

That looks OK. Something could be wrong with plotting. Does the code run if you remove the all the related to plotting, so these: from matplotlib import pyplot pyplot.figure() pyplot.plot(energies, data) pyplot.xlabel("energy [t]") pyplot.ylabel("conductance [e^2/h]") pyplot.show() kwant.plot(sys) Best, Anton On Fri, Jun 26, 2015 at 10:52 AM, Alexis Bozio <alexis-bozio@hotmail.fr> wrote:
It returns :
................................................................................................ ---------------------------------------------------------------------- Ran 96 tests in 16.963s
OK
And i am on Windows. Best, Alexis
From: anton.akhmerov@gmail.com Date: Fri, 26 Jun 2015 00:42:29 +0200
Subject: Re: [Kwant] Spin To: alexis-bozio@hotmail.fr CC: kwant-discuss@kwant-project.org
So this means your Kwant installation is broken.
What is the OS? How did you install Kwant? What does
import kwant; kwant.test()
return?
Best, Anton
On Thu, Jun 25, 2015 at 1:34 PM, Alexis Bozio <alexis-bozio@hotmail.fr> wrote:
Hi Anton, Thank you for awnsering! I don't think that it is e problem with my code because there because i am using the one that is used on the tutoring of kwant:
import kwant
# For plotting from matplotlib import pyplot
# For matrix support import tinyarray
# 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=1, t=1.0, alpha=0.5, e_z=0.08, W=10, L=30): # 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 xrange(W))] = 4 * t * sigma_0 + e_z * sigma_z # hoppings in x-direction lead[kwant.builder.HoppingKind((1, 0), lat, lat)] = \ -t * sigma_0 - 1j * alpha * sigma_y # hoppings in y-directions lead[kwant.builder.HoppingKind((0, 1), lat, lat)] = \ -t * sigma_0 + 1j * alpha * sigma_x
#### 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()
# We should see non-monotonic conductance steps. plot_conductance(sys, energies=[0.01 * i - 0.3 for i in xrange(100)])
# Call the main function if the script gets executed (as opposed to imported). # See <http://docs.python.org/library/__main__.html>. if __name__ == '__main__': main()
Best Regards,
Alexis
From: anton.akhmerov@gmail.com Date: Thu, 25 Jun 2015 11:28:58 +0200 Subject: Re: [Kwant] Spin To: alexis-bozio@hotmail.fr CC: kwant-discuss@kwant-project.org
Hi Alexis,
Can you share the code that you wrote? Is there any error being raised?
Can you check if your kwant installation is working? To do so execute
import kwant kwant.test()
and check the output.
Best, Anton
On Thu, Jun 25, 2015 at 11:25 AM, Alexis Bozio <alexis-bozio@hotmail.fr> wrote:
Hello,
I'm trying to calculate transmission function including spin with Matrix for onsite values but when i am writting the code that is explained on the site (http://kwant-project.org/doc/1.0/tutorial/tutorial2) it makes the calculation but a few seconds later Python stops and all the datas vanishe. Thank you for your help. Best Regards. Alexis Bozio
participants (2)
-
Alexis Bozio
-
Anton Akhmerov