2D Hubbard P and AF. Postgauss

17.3.21

functions (initialization)

SetDirectory["C:\\Users\\samsung-pc\\Desktop\\proj\\manybody\\fermion\\1D\\cubicmag\\math"]

mod[p_,n_]:=If[Mod[p,n]==0,n,Mod[p,n]];m1[k1_]:=mod[k1,Nx/2];
my[p_]:=mod[p,Nx];
mv[v_]:={mt[(Subscript[v, [[1]]])],ms[(Subscript[v, [[2]]])]};
rv[dis_,f_]:=RotateRight[f,dis];
ft[f_]:=rv[{-1,-1},Fourier[rv[{1,1},f]] ];
ift[f_]:=rv[{-1,-1},InverseFourier[rv[{1,1},f]] ];
ref[f_]:=rv[{-1,-1},Reverse[f,{1,2}]];
ixp[z_]:=Exp[I z];

PostG in paramagnetic phase

P HF for fixed U and T .

Nx=4; U=4;Np=Nx/2;Ns=(Nx^2);
gapeqP[T_,μ_]:=Block[{kp,den,x,res,sol},x[k1_,ky_]:=(Sqrt[(((2Abs[Cos[((2π)/Nx)k1]+Cos[((2π)/Nx)(k1-ky)]]))^2)]);
sol=FindRoot[den==(2/Ns)Sum[(2/(1+Exp[(-μ+U den/2-x[k1,ky])/T]))-.5(Tanh[((x[k1,ky]-μ+U den/2)/(2T))]+Tanh[((x[k1,ky]-(-μ+U den/2))/(2T))]),{k1,Np},{ky,Nx}],{den,.72}];
res=den/.sol;Return[{μ,res}]];
ParallelTable[gapeqP[1./32,mu],{mu,-4,.8,.2}]

P postgauss

using the direct approach from the conductivity(lifetime) file

U=4.;Nx=4;Ns=(Nx^2);T=1./21;tp=0;cutHF=1024 4;Nt=32;cutPG=128;
P[T]={{-4.,0.0231492},{-3.8,0.0870361},{-3.6,0.12404},{-3.4,0.124998},{-3.2,0.125},{-3.,0.125},{-2.8,0.125},{-2.6,0.125},{-2.4,0.125},{-2.2,0.125},{-2.,0.125166},{-1.8,0.147636},{-1.6,0.222211},{-1.4,0.308515},{-1.2,0.397216},{-1.,0.48521},{-0.8,0.56797},{-0.6,0.621692},{-0.4,0.624993},{-0.2,0.625},{0.,0.625},{0.2,0.625},{0.4,0.625},{0.6,0.625}};
ParallelTable[den=(Subscript[P[T], [[i,2]]]);μ=(Subscript[P[T], [[i,1]]]);μr=μ-U den/2;
l={lx,ly};m={mx,my};
ϵ[{kx_,ky_}]:=-2(Cos[2π kx/Nx]+Cos[2π ky/Nx])-4tp Cos[2π kx/Nx]Cos[2π ky/Ns]-μr;
L[k_,l_,m_]:=If[ϵ[m]-ϵ[k-l-m]==0,1-((Tanh[((ϵ[m])/(2 T))])^2),(Tanh[ϵ[m]/(2T)]-Tanh[ϵ[k-l-m]/(2T)])(Tanh[ϵ[l]/(2T)]-Coth[(ϵ[k-l-m]-ϵ[m])/(2T)])];
M[k_,l_,m_]:=ϵ[l]+ϵ[m]-ϵ[k-l-m];
γm[z_,kx_,ky_]:=z+ϵ[{kx,ky}]-((U^2)/(4(Ns^2)))Sum[((L[{kx,ky},{lx,ly},{mx,my}])/(z+M[{kx,ky},{lx,ly},{mx,my}])),{lx,Nx},{ly,Nx},{mx,Nx},{my,Nx}];
gfHF[z_,kx_,ky_]:=-(1/(z+ϵ[{kx,ky}]));
gfPG[z_,kx_,ky_]:=-(1/(γm[z,kx,ky]));
(*w1=I π T;
Print[{gfHF[w1,1,1],gfPG[w1,1,1]}];*)
{(Subscript[P[T], [[i,1]]]),(1/Ns)Sum[ 4T Re[Sum[If[ω<cutPG,((-1.)/(γm[I π T(2 ω+1),kx,ky])),((-1.)/(I π T(2 ω+1)+ϵ[{kx,ky}]))],{ω,0,cutHF}]],{kx,Nx},{ky,Nx}]+1},{i,1Length[P[T]]}]

PG AF

In this section Ns is the number of sites

AF HF for fixed U and T.

Nx=4; U=4;Np=Nx/2;Ns=(Nx^2);
gapeq[T_,μ_]:=Block[{pg,k1,ky,den,x,res1,res2,sol},x[k1_,ky_,pg_]:=(Sqrt[(((2Abs[Cos[((2π)/Nx)k1]+Cos[((2π)/Nx)(k1-ky)]]))^2)+(pg^2)]);
Print[ContourPlot[(((-(4/U)+(1/(Nx Np))Sum[(1/(x[k1,ky,pg]))(Tanh[((x[k1,ky,pg]-μ+U den/2)/(2T))]+Tanh[((x[k1,ky,pg]-(-μ+U  den/2))/(2T))]),{k1,Np},{ky,Nx}]))^2)+(((-den+(2/Ns)Sum[(2/(1+Exp[(-μ+U den/2-x[k1,ky,pg])/T]))-.5(Tanh[((x[k1,ky,pg]-μ+U den/2)/(2T))]+Tanh[((x[k1,ky,pg]-(-μ+U den/2))/(2T))]),{k1,Np},{ky,Nx}]))^2),{pg,.1,5.99},{den,.25,.999999},PlotRange->{0,.01}]];
sol=FindRoot[{(4/U)==(2/Ns)Sum[(1/(x[k1,ky,pg]))(Tanh[((x[k1,ky,pg]-μ+U den/2)/(2T))]+Tanh[((x[k1,ky,pg]-(-μ+U  den/2))/(2T))]),{k1,Np},{ky,Nx}],den==(2/Ns)Sum[(2/(1+Exp[(-μ+U den/2-x[k1,ky,pg])/T]))-.5(Tanh[((x[k1,ky,pg]-μ+U den/2)/(2T))]+Tanh[((x[k1,ky,pg]-(-μ+U den/2))/(2T))]),{k1,Np},{ky,Nx}]},{pg,.001},{den,.99993}];
min=FindMinimum[(((-(4/U)+(2/Ns)Sum[(1/(x[k1,ky,pg]))(Tanh[((x[k1,ky,pg]-μ+U den/2)/(2T))]+Tanh[((x[k1,ky,pg]-(-μ+U  den/2))/(2T))]),{k1,Np},{ky,Nx}]))^2)+(((-den+(2/Ns)Sum[(2/(1+Exp[(-μ+U den/2-x[k1,ky,pg])/T]))-.5(Tanh[((x[k1,ky,pg]-μ+U den/2)/(2T))]+Tanh[((x[k1,ky,pg]-(-μ+U den/2))/(2T))]),{k1,Np},{ky,Nx}]))^2),{pg,.3,1.},{den,.7,.9}];Print[min];
res1=Abs[pg]/.sol;res2=den/.sol;Return[{μ,res1,res2}]];Table[gapeq[1./32,mu],{mu,.7,1.7,.1}]

AF[8.,.32]=
{{0.6,1.82592,0.669725},{0.65,2.25641,0.740934},{0.75,2.69236,0.821123},{0.8,2.83618,0.849017},{0.9,3.04792,0.891178},{1.,3.19411,0.920973},{1.,1,3.29779,0.942411},{1.2,3.37228,0.95796},{1.3,3.42617,0.969283},{1.4,3.46531,0.977544},{1.6`,3.514599,0.9879899}};

AF[4.,1./4]={{0.76,0.205889,0.694278},{0.77,0.337383,0.712249},{0.78,0.437183,0.730088},{0.79,0.52095,0.747242},{0.8,0.593078,0.763318},{0.9,0.986627,0.866653},{1.,1.15454,0.917214},{1.1,1.2476,0.946714},{1.2,1.30413,0.965138},{1.3,1.33989,0.97701},{1.4,1.36298,0.984798},{1.5,1.37802,0.989972},{1.6,1.38782,0.993456},{1.7,1.39411,0.995852},{1.8,1.39796,0.997563}};
AF[4.,1./8]={{0.83,1.10176,0.901425},{0.84,1.15813,0.918739},{0.85,1.19477,0.930183},{0.86,1.2223,0.938877},{0.88,1.26249,0.951722},{0.89,1.2779,0.956691}};
AF[4.,1./16]={{0.7,1.29853223,0.94717384},{0.8`,1.35994869,0.9835901},{1.,1.40737,0.99945}};
AF[4.,1./32]={{0.7,1.26891,0.953794},{0.8,1.40758,0.999526},{0.9,1.40893,0.999981},{1.,1.40898,0.999999},{1.1,1.40898,1.},{1.2,1.40898,1.},{1.3,1.40898,1.},{1.4,1.40898,1.},{1.5,1.40898,1.},{1.7,1.40898,1.}};

T=1./8;x[k1_,ky_,pg_]:=(Sqrt[(((2Abs[Cos[((2π)/Nx)k1]+Cos[((2π)/Nx)(k1-ky)]]))^2)+(pg^2)]);(((-(4/U)+(2/Ns)Sum[(1/(x[k1,ky,pg]))(Tanh[((x[k1,ky,pg]-μ+U den/2)/(2T))]+Tanh[((x[k1,ky,pg]-(-μ+U  den/2))/(2T))]),{k1,Np},{ky,Nx}]))^2)+(((-den+(2/Ns)Sum[(2/(1+Exp[(-μ+U den/2-x[k1,ky,pg])/T]))-.5(Tanh[((x[k1,ky,pg]-μ+U den/2)/(2T))]+Tanh[((x[k1,ky,pg]-(-μ+U den/2))/(2T))]),{k1,Np},{ky,Nx}]))^2)/.{μ->0.83,pg->1.101763090745225`,den->0.9014246880549771`}

setsun AF

Nx=4;Ns=(Nx^2);T=1./16; U=4.;Np=Nx/2;
ParallelTable[pg=(Subscript[AF[U,T], [[i,2]]]);den=(Subscript[AF[U,T], [[i,3]]]);μ=(Subscript[AF[U,T], [[i,1]]]);μr=μ-U den/2;Print["i=",i];
x=Table[(Sqrt[(((2Abs[Cos[((2π)/Nx)k1]+Cos[((2π)/Nx)(k1-ky)]]))^2)+(pg^2)]),{k1,Np},{ky,Nx}];h=Table[1+ixp[-((4π)/Nx)k1]+ixp[-((2π)/Nx)ky]+ixp[-((2π)/Nx)(2k1-ky)],{k1,Np},{ky,Nx}];
hs=Table[1+ixp[((4π)/Nx)k1]+ixp[((2π)/Nx)ky]+ixp[((2π)/Nx)(2k1-ky)],{k1,Np},{ky,Nx}];
γ[s_,z_,k1_,ky_]:=(({{-(z-μr)-(((-1))^s)*pg, (Subscript[hs, [[k1,ky]]])}, {(Subscript[h, [[k1,ky]]]), -(z-μr)+(((-1))^s)*pg}}));
ss1a[a_,b_,c_,z_]:=(1/(16b))Tanh[(b+μr)/(2T)](-((Tanh[(μr+a)/(2T)])/(a ((a^2)+2 a b+(b^2)-(c^2)-2 a z-2 b z+(z^2)+2 a μr+2 b μr-2 z μr+((μr)^2))))+((Tanh[(μr-a)/(2T)])/(a ((a^2)-2 a b+(b^2)-(c^2)+2 a z-2 b z+(z^2)-2 a μr+2 b μr-2 z μr+((μr)^2))))-((Coth[(-b+c)/(2T)])/(c (-(a^2)+(b^2)-2 b c+(c^2)-2 b z+2 c z+(z^2)+2 b μr-2 c μr-2 z μr+((μr)^2))))+((Coth[(-b-c)/(2T)])/(c (-(a^2)+(b^2)+2 b c+(c^2)-2 b z-2 c z+(z^2)+2 b μr+2 c μr-2 z μr+((μr)^2)))));
ss1b[a_,b_,c_,z_]:=(1/(16c))Tanh[(c+μr)/(2T)](-((Tanh[(μr+a)/(2T)])/(a ((a^2)-(b^2)-2 a c+(c^2)-2 a z+2 c z+(z^2)+2 a μr-2 c μr-2 z μr+((μr)^2))))+((Tanh[(μr-a)/(2T)])/( a ((a^2)-(b^2)+2 a c+(c^2)+2 a z+2 c z+(z^2)-2 a μr-2 c μr-2 z μr+((μr)^2))))-((Coth[(b+c)/(2T)])/( b (-(a^2)+(b^2)+2 b c+(c^2)+2 b z+2 c z+(z^2)-2 b μr-2 c μr-2 z μr+((μr)^2))))+((Coth[(-b+c)/(2T)])/( b (-(a^2)+(b^2)-2 b c+(c^2)-2 b z+2 c z+(z^2)+2 b μr-2 c μr-2 z μr+((μr)^2)))));
SS1[a_,b_,c_,z_]:=If[c==b,(1/(16 (b^2)))(-(2/((a^2)-(((z-μr))^2)))-(2 (a ((a^2)-4 (b^2)-(((z-μr))^2)) Coth[(b/T)]+b Sech[((a-μr)/(2 T))] Sech[((a+μr)/(2 T))] (-((a^2)-4 (b^2)+(((z-μr))^2)) Sinh[(a/T)]+2 a (-z+μr) Sinh[((μr)/T)])) Tanh[((-b+μr)/(2 T))])/(a (a-2 b+z-μr) (a+2 b+z-μr) (a-2 b-z+μr) (a+2 b-z+μr))+(((Tanh[((-b+μr)/(2 T))])^2)/((a^2)-(((z-μr))^2)))+(2 (a ((a^2)-4 (b^2)-(((z-μr))^2)) Coth[(b/T)]+b Sech[((a-μr)/(2 T))] Sech[((a+μr)/(2 T))] (-((a^2)-4 (b^2)+(((z-μr))^2)) Sinh[(a/T)]+2 a (-z+μr) Sinh[((μr)/T)])) Tanh[((b+μr)/(2 T))])/(a (a-2 b+z-μr) (a+2 b+z-μr) (a-2 b-z+μr) (a+2 b-z+μr))+(((Tanh[((b+μr)/(2 T))])^2)/((a^2)-(((z-μr))^2)))),ss1a[a,b,c,z]+ss1a[a,-b,c,z]+ss1b[a,b,c,z]+ss1b[a,b,-c,z]];
ss2a[a_,b_,c_,d_,z_]:= ((Tanh[(b+μr)/(2T)])/(16b))(-(((a-d) (b+d) (a+b+d-z+μr)Tanh[(μr+a)/(2T)])/(a ((a^2)+2 a b+(b^2)-(c^2)-2 a z-2 b z+(z^2)+2 a μr+2 b μr-2 z μr+((μr)^2))))+(((a+d) (b+d) (a-b-d+z-μr)Tanh[(μr-a)/(2T)])/(a((a^2)-2 a b+(b^2)-(c^2)+2 a z-2 b z+(z^2)-2 a μr+2 b μr-2 z μr+((μr)^2))))+(((b+d) (c+d) (b-c+d-z+μr)Coth[(-b+c)/(2T)])/(c (-(a^2)+(b^2)-2 b c+(c^2)-2 b z+2 c z+(z^2)+2 b μr-2 c μr-2 z μr+((μr)^2))))+(((c-d) (b+d) (b+c+d-z+μr)Coth[(-b-c)/(2T)])/(c (-(a^2)+(b^2)+2 b c+(c^2)-2 b z-2 c z+(z^2)+2 b μr+2 c μr-2 z μr+((μr)^2)))));
ss2b[a_,b_,c_,d_,z_]:=((Tanh[(c+μr)/(2T)])/(16c))((((a-d) (c+d) (a-c-d-z+μr)Tanh[(μr+a)/(2T)])/(a((a^2)-(b^2)-2 a c+(c^2)-2 a z+2 c z+(z^2)+2 a μr-2 c μr-2 z μr+((μr)^2))))-(((a+d) (c+d) (a+c+d+z-μr)Tanh[(μr-a)/(2T)])/(a ((a^2)-(b^2)+2 a c+(c^2)+2 a z+2 c z+(z^2)-2 a μr-2 c μr-2 z μr+((μr)^2))))+(((b-d) (c+d) (b+c-d+z-μr)Coth[(b+c)/(2T)])/(b (-(a^2)+(b^2)+2 b c+(c^2)+2 b z+2 c z+(z^2)-2 b μr-2 c μr-2 z μr+((μr)^2))))-(((b+d) (c+d) (b-c+d-z+μr)Coth[(c-b)/(2T)])/(b(-(a^2)+(b^2)-2 b c+(c^2)-2 b z+2 c z+(z^2)+2 b μr-2 c μr-2 z μr+((μr)^2)))));
SS2[a_,b_,c_,d_,z_]:=If[c==b, (1/(16 (b^3)))((b^2) (-b+d) (((4 (b-d) T (z-μr) (d-z+μr))/(b ((((a^2)-(((z-μr))^2)))^2)))-((2 T ((b^2)-b d+d (d-z+μr)))/((b^2) ((a^2)-(((z-μr))^2))))+(((b+d) (2 b-d+z-μr) Coth[(b/T)])/(b (-(a^2)+(((2 b+z-μr))^2))))-(((a+d) (a+b-d+z-μr) Tanh[((-a+μr)/(2 T))])/(a (a+z-μr) (a+2 b+z-μr)))+(((a-d) (a-b+d-z+μr) Tanh[((a+μr)/(2 T))])/(a (a-z+μr) (a-2 b-z+μr)))) Tanh[((-b+μr)/(2 T))]+(((2 (((b-d))^2) T (d-z+μr))/((a^2)-(((z-μr))^2)))+b (((2 (b-d) T ((-(a^2)+(((z-μr))^2)) (b-z+μr)+2 (b-d) (z-μr) (d-z+μr)))/((((a^2)-(((z-μr))^2)))^2))+(((b-d) (b+d) (2 b+d-z+μr) Coth[(b/T)])/(-(a^2)+(((2 b-z+μr))^2)))+((b (a+d) (-b+d) (a-b+d+z-μr) Tanh[((-a+μr)/(2 T))])/(a (a+z-μr) (a-2 b+z-μr)))+((b (a-d) (b-d) (a+b-d-z+μr) Tanh[((a+μr)/(2 T))])/(a (a-z+μr) (a+2 b-z+μr))))) Tanh[((-b+μr)/(2 T))]+((b (((b-d))^2) (d-z+μr) (-1+((Tanh[((-b+μr)/(2 T))])^2)))/(-(a^2)+(((z-μr))^2)))+(b+d) (-((2 (b+d) T (d-z+μr))/((a^2)-(((z-μr))^2)))+(1/((((a^2)-(((z-μr))^2)))^2))b (-2 (a^2) T (b+z-μr)+2 T (z-μr) (2 (d^2)-2 d (z-μr)+(((z-μr))^2)+b (2 d-z+μr)))+((b (b-d) (2 b-d+z-μr) Coth[(b/T)])/(-(a^2)+(((2 b+z-μr))^2)))-(((b^2) (a+d) (a+b+d+z-μr) Tanh[((-a+μr)/(2 T))])/(a (a+z-μr) (a+2 b+z-μr)))-(((b^2) (a-d) (-a+b+d+z-μr) Tanh[((a+μr)/(2 T))])/(a (a-z+μr) (a-2 b-z+μr)))) Tanh[((b+μr)/(2 T))]+(b^2) (b+d) (-((4 (b+d) T (z-μr) (d-z+μr))/(b ((((a^2)-(((z-μr))^2)))^2)))+((2 T ((b^2)+b d+d (d-z+μr)))/((b^2) ((a^2)-(((z-μr))^2))))-(((b-d) (2 b+d-z+μr) Coth[(b/T)])/(b (-(a^2)+(((2 b-z+μr))^2))))+(((a+d) (a-b-d+z-μr) Tanh[((-a+μr)/(2 T))])/(a (a+z-μr) (a-2 b+z-μr)))-(((a-d) (a+b+d-z+μr) Tanh[((a+μr)/(2 T))])/(a (a-z+μr) (a+2 b-z+μr)))) Tanh[((b+μr)/(2 T))]+((b (((b+d))^2) (d-z+μr) (-1+((Tanh[((b+μr)/(2 T))])^2)))/(-(a^2)+(((z-μr))^2)))), ss2a[a,b,c,d,z]+ss2a[a,-b,c,d,z]+ss2b[a,b,c,d,z]+ss2b[a,b,-c,d,z]];
Σ[s_,z_,k1_,ky_]:=Block[{res,Σ11,Σ12,Σ21,Σ22,p1,py,q1,qy},
res=(((((2U)/Ns)))^2)Sum[Σ11=SS2[(Subscript[x, [[p1,py]]]),(Subscript[x, [[q1,qy]]]),(Subscript[x, [[m1[p1+q1-k1],my[py+qy-ky]]]]),(((-1))^s)pg,z];
Σ12=(Subscript[hs, [[p1,py]]])(Subscript[hs, [[q1,qy]]])(Subscript[h, [[m1[p1+q1-k1],my[py+qy-ky]]]])SS1[(Subscript[x, [[p1,py]]]),(Subscript[x, [[q1,qy]]]),(Subscript[x, [[m1[p1+q1-k1],my[py+qy-ky]]]]),z];
Σ21=(Subscript[h, [[p1,py]]])(Subscript[h, [[q1,qy]]])(Subscript[hs, [[m1[p1+q1-k1],my[py+qy-ky]]]])SS1[(Subscript[x, [[p1,py]]]),(Subscript[x, [[q1,qy]]]),(Subscript[x, [[m1[p1+q1-k1],my[py+qy-ky]]]]),z];Σ22=SS2[(Subscript[x, [[p1,py]]]),(Subscript[x, [[q1,qy]]]),(Subscript[x, [[m1[p1+q1-k1],my[py+qy-ky]]]]),-(((-1))^s)pg,z];(({{Σ11, Σ12}, {Σ21, Σ22}})),{p1,Np},{py,Nx},{q1,Np},{qy,Nx}];
Return[res]];
gf[s_,z_,k1_,ky_]:=Inverse[γ[s,z,k1,ky]+Σ[s,z,k1,ky]];
gfs[z_,kx_,ky_]:=Block[{res,gfspin},Do[gfspin[s]=gf[s,z,m1[kx],my[kx+ky]],{s,2}];res=(1/4)Sum[(Subscript[gfspin[s], [[1,1]]])+(Subscript[gfspin[s], [[2,2]]])+ixp[-((2π kx)/Nx)](Subscript[gfspin[s], [[1,2]]])+ixp[((2π kx)/Nx)](Subscript[gfspin[s], [[2,1]]]),{s,2}];
Return[res]];
gfHF[s_,z_,k1_,ky_]:=Inverse[γ[s,z,k1,ky]];
gfHFs[z_,kx_,ky_]:=Block[{res,gfspin},Do[gfspin[s]=gfHF[s,z,m1[kx],my[kx+ky]],{s,2}];res=(1/4)Sum[(Subscript[gfspin[s], [[1,1]]])+(Subscript[gfspin[s], [[2,2]]])+ixp[-((2π kx)/Nx)](Subscript[gfspin[s], [[1,2]]])+ixp[((2π kx)/Nx)](Subscript[gfspin[s], [[2,1]]]),{s,2}];
Return[res]];
cutHF=1024;Nt=32;cutPG=128;
{(Subscript[AF[U,T], [[i,1]]]),
Sum[4T Re[Sum[If[ω<cutPG,gfs[I π T(2ω+1),kx,ky],gfHFs[I π T(2ω+1),kx,ky]],{ω,0,cutHF}]],{kx,Nx},{ky,Nx}]/Ns+1},{i,Length[AF[U,T]]}]

details of residuum calculations off diagonal (f1^sAB)

Residue[(1/(-(((z-μr))^2)+(b^2)))(1/(-(((z-μr+2π I T m))^2)+(c^2))),{z,μr+c-2π I T m},Assumptions->{c>0,b>0,μr∈Reals,m∈Integers}]

(*iwb[n_]:=2I π T n;*)
zb=(1/(2 b ((((b+z))^2)-(c^2))));
zmb=-(1/(2 b ((((b-z))^2)-(c^2))));
zc=(1/(2 c ((((c-z))^2)-(b^2))));
zmc=-(1/(2 c ((((c+z))^2)-(b^2))));
f1[b_,c_,iw_]:=-(1/2)(zb Tanh[(b+μr)/(2T)]+zmb Tanh[(μr-b)/(2T)]+zc Tanh[(c+μr)/(2T)]+zmc Tanh[(μr-c)/(2T)])

(*{Residue[(1/(-(((z+iw-μr))^2)+(a^2)))zb,{z,μr-iw+a},Assumptions->{a>0,c>0,b>0,d>0,μr∈Reals,iw∈Reals}],Residue[(1/(-(((z+iw-μr))^2)+(a^2)))zb,{z,μr-iw-a},Assumptions->{a>0,c>0,b>0,d>0,μr∈Reals,iw∈Reals}],Residue[(1/(-(((z+iw-μr))^2)+(a^2)))zb,{z,-b+c},Assumptions->{a>0,c>0,b>0,d>0,μr∈Reals,iw∈Reals}],Residue[(1/(-(((z+iw-μr))^2)+(a^2)))zb,{z,-b-c},Assumptions->{a>0,c>0,b>0,d>0,μr∈Reals,iw∈Reals}]};*)
{Residue[(1/(-(((z+iw-μr))^2)+(a^2)))zc,{z,μr-iw+a},Assumptions->{a>0,c>0,b>0,d>0,μr∈Reals,iw∈Reals}],Residue[(1/(-(((z+iw-μr))^2)+(a^2)))zc,{z,μr-iw-a},Assumptions->{a>0,c>0,b>0,d>0,μr∈Reals,iw∈Reals}],Residue[(1/(-(((z+iw-μr))^2)+(a^2)))zc,{z,b+c},Assumptions->{a>0,c>0,b>0,d>0,μr∈Reals,iw∈Reals}],Residue[(1/(-(((z+iw-μr))^2)+(a^2)))zc,{z,-b+c},Assumptions->{a>0,c>0,b>0,d>0,μr∈Reals,iw∈Reals}]}

(1/(16c))Tanh[(c+μr)/(2T)](-(1/(a ((a^2)-(b^2)-2 a c+(c^2)-2 a iw+2 c iw+(iw^2)+2 a μr-2 c μr-2 iw μr+((μr)^2))))Tanh[(μr+a)/(2T)]+(1/( a ((a^2)-(b^2)+2 a c+(c^2)+2 a iw+2 c iw+(iw^2)-2 a μr-2 c μr-2 iw μr+((μr)^2))))Tanh[(μr-a)/(2T)]-(1/( b (-(a^2)+(b^2)+2 b c+(c^2)+2 b iw+2 c iw+(iw^2)-2 b μr-2 c μr-2 iw μr+((μr)^2))))Coth[(b+c)/(2T)]+(1/( b (-(a^2)+(b^2)-2 b c+(c^2)-2 b iw+2 c iw+(iw^2)+2 b μr-2 c μr-2 iw μr+((μr)^2))))Coth[(-b+c)/(2T)])

(1/(16b))Tanh[(b+μr)/(2T)](-(1/(a ((a^2)+2 a b+(b^2)-(c^2)-2 a iw-2 b iw+(iw^2)+2 a μr+2 b μr-2 iw μr+((μr)^2))))Tanh[(μr+a)/(2T)]+(1/(a ((a^2)-2 a b+(b^2)-(c^2)+2 a iw-2 b iw+(iw^2)-2 a μr+2 b μr-2 iw μr+((μr)^2))))Tanh[(μr-a)/(2T)]-(1/(c (-(a^2)+(b^2)-2 b c+(c^2)-2 b iw+2 c iw+(iw^2)+2 b μr-2 c μr-2 iw μr+((μr)^2))))Coth[(-b+c)/(2T)]+(1/(c (-(a^2)+(b^2)+2 b c+(c^2)-2 b iw-2 c iw+(iw^2)+2 b μr+2 c μr-2 iw μr+((μr)^2))))Coth[(-b-c)/(2T)])

details of residuum calculations diagonal (f2^sII)

Residue[((z-μr+d)/(-(((z-μr))^2)+(b^2)))((z-μr+2π I T m+d)/(-(((z-μr+2π I T m))^2)+(c^2))),{z,μr-2π I T m-c},Assumptions->{c>0,b>0,d>0,μr∈Reals,m∈Integers}]

(*z=2 I m π T;iwb[n_]:=2I π T n;iw[n_]:=I π T(2 n+1);*)
zb=(((b+d) (b+d+z))/(2 b ((((b+z))^2)-(c^2))));
zmb=-(((b-d) (b-d-z))/(2 b ((((b-z))^2)-(c^2))));
zc=(((c+d) (c+d-z))/(2 c (-(b^2)+(((c-z))^2))));
zmc=-(((c-d) (c-d+z))/(2 c (-(b^2)+(((c+z))^2))));
f2[b_,c_,d_,z_]:=-(1/2)(zb Tanh[(b+μr)/(2T)]+zmb Tanh[(μr-b)/(2T)]+zc Tanh[(c+μr)/(2T)]+zmc Tanh[(μr-c)/(2T)]);
{Residue[((z+iw-d)/(-(((z+iw-μr))^2)+(a^2)))zb,{z,μr-iw+a},Assumptions->{a>0,c>0,b>0,d>0,μr∈Reals,iw∈Reals}],Residue[((z+iw-d)/(-(((z+iw-μr))^2)+(a^2)))zb,{z,μr-iw-a},Assumptions->{a>0,c>0,b>0,d>0,μr∈Reals,iw∈Reals}],Residue[((z+iw-d)/(-(((z+iw-μr))^2)+(a^2)))zb,{z,-b+c},Assumptions->{a>0,c>0,b>0,d>0,μr∈Reals,iw∈Reals}],Residue[((z+iw-d)/(-(((z+iw-μr))^2)+(a^2)))zb,{z,-b-c},Assumptions->{a>0,c>0,b>0,d>0,μr∈Reals,iw∈Reals}]}
(*
{Residue[((z+iw-d)/(-(((z+iw-μr))^2)+(a^2)))zc,{z,μr-iw+a},Assumptions->{a>0,c>0,b>0,d>0,μr∈Reals,iw∈Reals}],Residue[((z+iw-d)/(-(((z+iw-μr))^2)+(a^2)))zc,{z,μr-iw-a},Assumptions->{a>0,c>0,b>0,d>0,μr∈Reals,iw∈Reals}],
Residue[((z+iw-d)/(-(((z+iw-μr))^2)+(a^2)))zc,{z,b+c},Assumptions->{a>0,c>0,b>0,d>0,μr∈Reals,iw∈Reals}],Residue[((z+iw-d)/(-(((z+iw-μr))^2)+(a^2)))zc,{z,-b+c},Assumptions->{a>0,c>0,b>0,d>0,μr∈Reals,iw∈Reals}]}*)

ss2a[a_,b_,c_,d_,z_]:= ((Tanh[(b+μr)/(2T)])/(16b))(-(((b+d) (a-d+μr) (a+b+d-z+μr))/(a((a^2)+2 a b+(b^2)-(c^2)-2 a z-2 b z+(z^2)+2 a μr+2 b μr-2 z μr+((μr)^2))))Tanh[(μr+a)/(2T)]+(((b+d) (a+d-μr) (a-b-d+z-μr))/(a ((a^2)-2 a b+(b^2)-(c^2)+2 a z-2 b z+(z^2)-2 a μr+2 b μr-2 z μr+((μr)^2))))Tanh[(μr-a)/(2T)]+(((b+d) (c+d) (b-c+d-z))/(c (-(a^2)+(b^2)-2 b c+(c^2)-2 b z+2 c z+(z^2)+2 b μr-2 c μr-2 z μr+((μr)^2))))Coth[(-b+c)/(2T)]+(((c-d) (b+d) (b+c+d-z))/(c (-(a^2)+(b^2)+2 b c+(c^2)-2 b z-2 c z+(z^2)+2 b μr+2 c μr-2 z μr+((μr)^2))))Coth[(-b-c)/(2T)]);
ss2b[a_,b_,c_,d_,z_]:=((Tanh[(c+μr)/(2T)])/(16c))((((c+d) (a-d+μr) (a-c-d-z+μr))/(a ((a^2)-(b^2)-2 a c+(c^2)-2 a z+2 c z+(z^2)+2 a μr-2 c μr-2 z μr+((μr)^2))))Tanh[(μr+a)/(2T)]-(((c+d) (a+d-μr) (a+c+d+z-μr))/( a((a^2)-(b^2)+2 a c+(c^2)+2 a z+2 c z+(z^2)-2 a μr-2 c μr-2 z μr+((μr)^2))))Tanh[(μr-a)/(2T)]+(((b-d) (c+d) (b+c-d+z))/(b (-(a^2)+(b^2)+2 b c+(c^2)+2 b z+2 c z+(z^2)-2 b μr-2 c μr-2 z μr+((μr)^2))))Coth[(b+c)/(2T)]-(((b+d) (c+d) (b-c+d-z))/(b(-(a^2)+(b^2)-2 b c+(c^2)-2 b z+2 c z+(z^2)+2 b μr-2 c μr-2 z μr+((μr)^2))))Coth[(c-b)/(2T)]);
SS2[a_,b_,c_,d_,z_]:=ss2a[a,b,c,d,z]+ss2a[a,-b,c,d,z]+ss2b[a,b,c,d,z]+ss2b[a,b,-c,d,z];
Series[SS2[a,b,b+x,d,z],{x,0,0}]

Tanh[x]
Coth[x+I π/2]

ss2d

(*-(((b-d) Tanh[(b/(2 T))])/(4 b))*)Residue[((z-d)/(-(z^2)+(a^2)))((bn-d-z)/((((bn-z))^2)-(c^2))),{z,-c+bn},Assumptions->{a>0,b>0,c>0,d>0,bn∈Reals}]

za=(((a-d) (a-bn+d))/(2 a ((a^2)-2 a bn+(bn^2)-(c^2))));
zma=-(((a+bn-d) (a+d))/(2 a ((a^2)+2 a bn+(bn^2)-(c^2))));
zc=(((bn+c-d) (c+d))/(2 c (-(a^2)+(bn^2)+2 bn c+(c^2))));
zmc=-(((c-d) (-bn+c+d))/(2 c (-(a^2)+(bn^2)-2 bn c+(c^2))));
(*(((b-d) Tanh[(b/(2 T))])/(16 b))*)
Simplify[2(za Tanh[a/(2T)]+zma Tanh[-a/(2T)]+zc Coth[(c+b)/(2T)]+zmc Coth[(-c+b)/(2T)]),Assumptions->{bn>0,a>0,b>0,c>0,d>0}]

ss2md

(*-(((c+d) Tanh[(c/(2 T))])/(4 c ))*)Residue[((z-d)/(-(z^2)+(a^2)))(( (cn+d-z) )/( -(b^2)+(((cn-z))^2))),{z,-b+cn},Assumptions->{a>0,b>0,d>0,cn∈Reals}]
(((c+d) (c+d-2 I m π T) Tanh[(c/(2 T))])/(2 c (-(b^2)+(c^2)-4 I c m π T-4 (m^2) (π^2) (T^2))))

za=(((a-d) (a-cn-d))/(2 a ((a^2)-(b^2)-2 a cn+(cn^2))));
zma=-(((a+d) (a+cn+d))/(2 a ((a^2)-(b^2)+2 a cn+(cn^2))));
zb=(((b-d) (b+cn-d))/(2 b (-(a^2)+(b^2)+2 b cn+(cn^2))));
zmb=-(((b+d) (b-cn+d))/(2 b (-(a^2)+(b^2)-2 b cn+(cn^2))));
(*(((c+d) Tanh[(c/(2 T))])/(16 c ))*)
Simplify[2(za Tanh[a/(2T)]+zma Tanh[-a/(2T)]+zb Coth[(c+b)/(2T)]+zmb Coth[(c-b)/(2T)]),Assumptions->{bn>0,a>0,b>0,c>0,d>0}]