Magnetoresistance & disorder average
Dear All, I've been trying to calculate the magnetotransport properties of some 3D tightbinding models by kwant. However there's something wrong with the setup of magnetic field. Below is my code: import kwant import matplotlib from matplotlib import pyplot import scipy import numpy as np import tinyarray import math from cmath import exp from kwant.digest import gauss %matplotlib inline #pauli matrices 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]]) #Magnetoconductance with B=Bz, A=(By, 0, 0) def make_system(a=1, t1=1.0, t2=1.0,t3=1.0,m=2.0,W=20,L=10,H=10): lat = kwant.lattice.general([(1, 0, 0), (0, 1, 0), (0, 0, 1)]) sys = kwant.Builder() def onsite(site, phi, salt): return 0.05 * gauss(repr(site))*sigma_0m*sigma_z sys[(lat(x, y, z) for x in range(L) for y in range(W) for \ z in range(H))]=onsite #various hoppings for i in range(L): for j in range(W): for k in range(H): if i > 0: sys[lat(i, j, k), lat(i  1, j, k)] =\ t1*exp(1j * phi * j)*sigma_x\ +t3*exp(1j * phi * j)*sigma_z if j > 0: sys[lat(i, j, k), lat(i, j  1, k)] =\ t1*sigma_x+t3*sigma_z if k>0: sys[lat(i, j, k), lat(i, j, k1)] =\ t3*sigma_z if i>0 and j>0: sys[lat(i, j, k), lat(i1, j1, k)] =\ 1j*(t2/4)*exp(0.5j * phi * (2*j1))* sigma_y sys[lat(i1, j, k), lat(i, j1, k)] =\ 1j*(t2/4)*exp(0.5j * phi *(2*j1))* sigma_y lead = kwant.Builder(kwant.TranslationalSymmetry((0, 0, 1))) lead[(lat(i,j,0) for i in range(L) for j in range(W))] =\ m*sigma_z lead[kwant.builder.HoppingKind((1,0,0), lat, lat)] = \ t1 * sigma_x + t3*sigma_z lead[kwant.builder.HoppingKind((0,1,0), lat, lat)] = \ t1 * sigma_x + t3*sigma_z lead[kwant.builder.HoppingKind((0,0,1), lat, lat)] = \ t3 * sigma_z lead[kwant.builder.HoppingKind((1,1,0), lat, lat)] = \ 1j*t2/4 * sigma_y lead[kwant.builder.HoppingKind((1,1,0), lat, lat)] = \ 1j*t2/4 * sigma_y sys.attach_lead(lead) sys.attach_lead(lead.reversed()) return sys def main(): sys = make_system(0) kwant.plot(sys) sys = sys.finalized() energy = 0.15 reciprocal_phis = np.linspace(1, 50, 50) conductances = [] for phi in 1 / reciprocal_phis: smatrix = kwant.smatrix(sys, energy, args=[phi, ""]) conductances.append(smatrix.transmission(1, 0)) pyplot.plot(reciprocal_phis, conductances) pyplot.show() if __name__ == '__main__': main() The resultant magnetoconductance is a straight line independent of magnetic field, which is absurd. What is the right way of doing this? Anther issue concerns about disorder average. I've added 0.05 * gauss(repr(site))*sigma_0 in the onsite term as a disorder potential. Then if I want to study the transport properties of a macroscopic system, how to perform the disorder average? Should I sismply repeat the calculation for many times and do the statistical average? Best, Xin Dai
Dear Xin, Hoppings should be defined in a Function (not as a value), taking \phi as an argument (see examples). In your code, the values of \phi are not updated. Best wishes, Sergey On 09/07/15 03:33, Xin Dai wrote:
Dear All,
I've been trying to calculate the magnetotransport properties of some 3D tightbinding models by kwant. However there's something wrong with the setup of magnetic field. Below is my code:
import kwant import matplotlib from matplotlib import pyplot import scipy import numpy as np import tinyarray import math from cmath import exp from kwant.digest import gauss %matplotlib inline
#pauli matrices 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]])
#Magnetoconductance with B=Bz, A=(By, 0, 0) def make_system(a=1, t1=1.0, t2=1.0,t3=1.0,m=2.0,W=20,L=10,H=10): lat = kwant.lattice.general([(1, 0, 0), (0, 1, 0), (0, 0, 1)]) sys = kwant.Builder()
def onsite(site, phi, salt): return 0.05 * gauss(repr(site))*sigma_0m*sigma_z sys[(lat(x, y, z) for x in range(L) for y in range(W) for \ z in range(H))]=onsite
#various hoppings for i in range(L): for j in range(W): for k in range(H): if i > 0: sys[lat(i, j, k), lat(i  1, j, k)] =\ t1*exp(1j * phi * j)*sigma_x\ +t3*exp(1j * phi * j)*sigma_z if j > 0: sys[lat(i, j, k), lat(i, j  1, k)] =\ t1*sigma_x+t3*sigma_z if k>0: sys[lat(i, j, k), lat(i, j, k1)] =\ t3*sigma_z if i>0 and j>0: sys[lat(i, j, k), lat(i1, j1, k)] =\ 1j*(t2/4)*exp(0.5j * phi * (2*j1))* sigma_y sys[lat(i1, j, k), lat(i, j1, k)] =\ 1j*(t2/4)*exp(0.5j * phi *(2*j1))* sigma_y
lead = kwant.Builder(kwant.TranslationalSymmetry((0, 0, 1)))
lead[(lat(i,j,0) for i in range(L) for j in range(W))] =\ m*sigma_z lead[kwant.builder.HoppingKind((1,0,0), lat, lat)] = \ t1 * sigma_x + t3*sigma_z lead[kwant.builder.HoppingKind((0,1,0), lat, lat)] = \ t1 * sigma_x + t3*sigma_z lead[kwant.builder.HoppingKind((0,0,1), lat, lat)] = \ t3 * sigma_z lead[kwant.builder.HoppingKind((1,1,0), lat, lat)] = \ 1j*t2/4 * sigma_y lead[kwant.builder.HoppingKind((1,1,0), lat, lat)] = \ 1j*t2/4 * sigma_y sys.attach_lead(lead) sys.attach_lead(lead.reversed())
return sys
def main(): sys = make_system(0) kwant.plot(sys) sys = sys.finalized() energy = 0.15
reciprocal_phis = np.linspace(1, 50, 50) conductances = [] for phi in 1 / reciprocal_phis: smatrix = kwant.smatrix(sys, energy, args=[phi, ""]) conductances.append(smatrix.transmission(1, 0)) pyplot.plot(reciprocal_phis, conductances) pyplot.show() if __name__ == '__main__': main()
The resultant magnetoconductance is a straight line independent of magnetic field, which is absurd. What is the right way of doing this?
Anther issue concerns about disorder average. I've added 0.05 * gauss(repr(site))*sigma_0 in the onsite term as a disorder potential. Then if I want to study the transport properties of a macroscopic system, how to perform the disorder average? Should I sismply repeat the calculation for many times and do the statistical average?
Best,
Xin Dai
Dear Sergey, Problem solved, thanks for your help! I've defined the hopping function like def hopx1(site1, site2, B, salt): y1 = site1.pos[1] y2 = site2.pos[1] return 1j*(t2/4)*exp(1j * B * (y2+y1)/2) *sigma_y the "salt" argument, which also appears in the onsite term makes this hopping function work. Though the actual usage is obscure to me. Best, Xin 20150709 16:02 GMT+08:00 Sergey <sereza@gmail.com>:
Dear Xin, Hoppings should be defined in a Function (not as a value), taking \phi as an argument (see examples). In your code, the values of \phi are not updated. Best wishes, Sergey
On 09/07/15 03:33, Xin Dai wrote:
Dear All,
I've been trying to calculate the magnetotransport properties of some 3D tightbinding models by kwant. However there's something wrong with the setup of magnetic field. Below is my code:
import kwant import matplotlib from matplotlib import pyplot import scipy import numpy as np import tinyarray import math from cmath import exp from kwant.digest import gauss %matplotlib inline
#pauli matrices 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]])
#Magnetoconductance with B=Bz, A=(By, 0, 0) def make_system(a=1, t1=1.0, t2=1.0,t3=1.0,m=2.0,W=20,L=10,H=10): lat = kwant.lattice.general([(1, 0, 0), (0, 1, 0), (0, 0, 1)]) sys = kwant.Builder()
def onsite(site, phi, salt): return 0.05 * gauss(repr(site))*sigma_0m*sigma_z sys[(lat(x, y, z) for x in range(L) for y in range(W) for \ z in range(H))]=onsite
#various hoppings for i in range(L): for j in range(W): for k in range(H): if i > 0: sys[lat(i, j, k), lat(i  1, j, k)] =\ t1*exp(1j * phi * j)*sigma_x\ +t3*exp(1j * phi * j)*sigma_z if j > 0: sys[lat(i, j, k), lat(i, j  1, k)] =\ t1*sigma_x+t3*sigma_z if k>0: sys[lat(i, j, k), lat(i, j, k1)] =\ t3*sigma_z if i>0 and j>0: sys[lat(i, j, k), lat(i1, j1, k)] =\ 1j*(t2/4)*exp(0.5j * phi * (2*j1))* sigma_y sys[lat(i1, j, k), lat(i, j1, k)] =\ 1j*(t2/4)*exp(0.5j * phi *(2*j1))* sigma_y
lead = kwant.Builder(kwant.TranslationalSymmetry((0, 0, 1)))
lead[(lat(i,j,0) for i in range(L) for j in range(W))] =\ m*sigma_z lead[kwant.builder.HoppingKind((1,0,0), lat, lat)] = \ t1 * sigma_x + t3*sigma_z lead[kwant.builder.HoppingKind((0,1,0), lat, lat)] = \ t1 * sigma_x + t3*sigma_z lead[kwant.builder.HoppingKind((0,0,1), lat, lat)] = \ t3 * sigma_z lead[kwant.builder.HoppingKind((1,1,0), lat, lat)] = \ 1j*t2/4 * sigma_y lead[kwant.builder.HoppingKind((1,1,0), lat, lat)] = \ 1j*t2/4 * sigma_y sys.attach_lead(lead) sys.attach_lead(lead.reversed())
return sys
def main(): sys = make_system(0) kwant.plot(sys) sys = sys.finalized() energy = 0.15
reciprocal_phis = np.linspace(1, 50, 50) conductances = [] for phi in 1 / reciprocal_phis: smatrix = kwant.smatrix(sys, energy, args=[phi, ""]) conductances.append(smatrix.transmission(1, 0)) pyplot.plot(reciprocal_phis, conductances) pyplot.show() if __name__ == '__main__': main()
The resultant magnetoconductance is a straight line independent of magnetic field, which is absurd. What is the right way of doing this?
Anther issue concerns about disorder average. I've added 0.05 * gauss(repr(site))*sigma_0 in the onsite term as a disorder potential. Then if I want to study the transport properties of a macroscopic system, how to perform the disorder average? Should I sismply repeat the calculation for many times and do the statistical average?
Best,
Xin Dai
Hi,
I've defined the hopping function like def hopx1(site1, site2, B, salt): y1 = site1.pos[1] y2 = site2.pos[1] return 1j*(t2/4)*exp(1j * B * (y2+y1)/2) *sigma_y the "salt" argument, which also appears in the onsite term makes this hopping function work. Though the actual usage is obscure to me.
The reason you need the salt argument in the hopping function as well as the onsite function is that currently in Kwant *all* value functions must take the same arguments, even if a particular value function only uses a subset of these arguments. The onsite function does not use the "phi" parameter, for example, yet it is necessary to have it in the function definition. In the onsite term the "salt" is meant to be used as an argument to `kwant.digest.gauss`, however in the example you posted it is not (I'm not sure why). The use of a salt allows you to get different disorder configurations. A similar question about using `kwant.digest` was asked a while ago on the mailing list: http://article.gmane.org/gmane.comp.science.kwant.user/272/ Hope that clarifies, Joe
Hi Joe, I've tried using something like def onsite(site, B, salt): return 0.05 * gauss(repr(site),salt='config1')*sigma_0m*sigma_z It seems that if I change the argument of salt, I'll get another disorder configuration. Thank you for clarifying this! Best, Xin 20150709 17:26 GMT+08:00 Joseph Weston <joseph.weston@cea.fr>:
Hi,
I've defined the hopping function like def hopx1(site1, site2, B, salt): y1 = site1.pos[1] y2 = site2.pos[1] return 1j*(t2/4)*exp(1j * B * (y2+y1)/2) *sigma_y the "salt" argument, which also appears in the onsite term makes this hopping function work. Though the actual usage is obscure to me.
The reason you need the salt argument in the hopping function as well as the onsite function is that currently in Kwant *all* value functions must take the same arguments, even if a particular value function only uses a subset of these arguments. The onsite function does not use the "phi" parameter, for example, yet it is necessary to have it in the function definition.
In the onsite term the "salt" is meant to be used as an argument to `kwant.digest.gauss`, however in the example you posted it is not (I'm not sure why). The use of a salt allows you to get different disorder configurations. A similar question about using `kwant.digest` was asked a while ago on the mailing list:
http://article.gmane.org/gmane.comp.science.kwant.user/272/
Hope that clarifies,
Joe
Hi,
Hi Joe,
I've tried using something like
def onsite(site, B, salt): return 0.05 * gauss(repr(site),salt='config1')*sigma_0m*sigma_z
So, usually one would do: def onsite(site, B, salt): return 0.05 * gauss(repr(site),salt=salt)*sigma_0m*sigma_z i.e. don't hardcode the salt into the value function itself, otherwise there's no point in having the salt parameter at all. You can change the salt as a parameter: kwant.smatrix(sys, energy, args=[phi, "config1"]) kwant.smatrix(sys, energy, args=[phi, "config2"]) ... Joe
Hi Joe, Now I understand the usage of "salt". Thank you very much! Best, Xin 20150709 18:14 GMT+08:00 Joseph Weston <joseph.weston@cea.fr>:
Hi,
Hi Joe,
I've tried using something like
def onsite(site, B, salt): return 0.05 * gauss(repr(site),salt='config1')*sigma_0m*sigma_z
So, usually one would do:
def onsite(site, B, salt): return 0.05 * gauss(repr(site),salt=salt)*sigma_0m*sigma_z
i.e. don't hardcode the salt into the value function itself, otherwise there's no point in having the salt parameter at all. You can change the salt as a parameter:
kwant.smatrix(sys, energy, args=[phi, "config1"]) kwant.smatrix(sys, energy, args=[phi, "config2"]) ...
Joe
participants (3)

Joseph Weston

Sergey

Xin Dai