前提・実現したいこと
このソースコードのどこがどのような働きを持っているか詳しく解説していただきたいです。
このプログラムはリングを介して磁場を印加するときのリングのコンダクタンスを計算しているらしいのです。
https://mybinder.org/v2/gh/kwant-project/kwant-tutorial-2016/master
該当のソースコード
python3
1 2from math import pi 3 4%run matplotlib_setup.ipy 5from matplotlib import pyplot 6import numpy as np 7import kwant 8 9lat=kwant.lattice.square() 10 11#L,W=30,16 12L,W=100,12 13def myshape(R): return ( 14 (R[0]**2 + R[1]**2) > (L-W/2)**2 and 15 (R[0]**2 + R[1]**2) < (L+W/2)**2) 16H=kwant.Builder() 17H[lat.shape(myshape,(L,0) )]=4 18 19#H[lat.neighbors()]=1 20 21def Field(site1,site2,phi): 22 x1,y1=site1.pos 23 x2,y2=site2.pos 24 return -np.exp(-0.5j * phi * (x1 - x2) * (y1 + y2)) 25 26H[lat.neighbors()] = Field 27 28#def Aharonov_Bohm(site1,site2,phi): return np.exp(-2j*pi*phi) 29 30#for hop in H.hoppings(): 31 #if hop[0].tag[0]==1 and hop[0].tag[1]>0 and hop[1].tag[0]==0: 32 # H[hop]=Aharonov_Bohm 33 34sym=kwant.TranslationalSymmetry(lat.vec((1,0))) 35def lead_shape(R): return abs(R[1]) < W/2 and abs(R[0]) <3 36Hlead =kwant.Builder(sym) 37Hlead[lat.shape(lead_shape,(0,0) )]=4 38Hlead[lat.neighbors()]=1 39H.attach_lead(Hlead) 40H.attach_lead(Hlead.reversed()) 41kwant.plot(H); 42 43 44Hf=H.finalized() 45data = [] 46 47#phis = np.linspace(0,1.,50) 48phis = np.linspace(0.,0.0005,50) 49for phi in phis: 50 smatrix = kwant.smatrix(Hf, 3.3,args=[phi]) 51 data.append(smatrix.transmission(1, 0)) 52pyplot.plot(phis, data,'o'); 53pyplot.xlabel('$\phi = BS/(h/e)$') 54pyplot.ylabel('g in unit of $(2e^2/h)$'); 55pyplot.title('Aharonov-Effect')
_s__1___さんのレベルがわからないとどの程度の解説が必要かわかりません。
ご自分で詳しい解説を書く努力をされてからご依頼いただけるとお互い幸せになれます。