MatBloch3[v_,p_,k_]:=Module[{jn,jjn,rep,lcl,l,res,id},lcl=ListeClasses2[p];rep=Rep2[lcl];l=Length[rep];
res=Table[0,{x,l},{y,l}];Do[{id=Voisrep[rep[[j]],lcl,v];Do[{jjn=(Position [rep,id[[jj]]])[[1,1]];res[[j,jjn]]=-Exp[I*(k[[1]]*(p[[j,1]]-p[[jjn,1]])+k[[2]]*(p[[j,2]]-p[[jjn,2]]))];res[[jjn,j]]=-Exp[-I*(k[[1]]*(p[[j,1]]-p[[jjn,1]])+k[[2]]*(p[[j,2]]-p[[jjn,2]]))]},{jj,1,Length[id]}]},{j,1,l}];res];

calculspkx[mx_,dx_,v_,p_]:=Module[{mat},Reap[Do[{mat=MatBloch3[v,p,{kx*dx/mx,0}];Sow[Flatten[{kx*dx/mx,Eigenvalues[mat,1]}]]},{kx,-mx,mx,1}]]];
calculspky[my_,dy_,v_,p_]:=Module[{mat},Reap[Do[{mat=MatBloch3[v,p,{0,ky*dy/my}];Sow[Flatten[{ky*dy/my,Eigenvalues[mat,1]}]]},{ky,-my,my,1}]]];
calculspkxy[m_,d_,v_,p_]:=Module[{mat},Reap[Do[{mat=MatBloch3[v,p,{k*d/m,k*d/m}];Sow[Flatten[{k*d/m,Eigenvalues[mat,1]}]]},{k,-m,m,1}]]];

p4=ppniso;

v4=vois;

longueur=29*Sqrt[2];

p4norm=Sqrt[2]*p4;

v4[[3]]

Norm[p4norm[[1]]-p4norm[[1045]]]

m0=MatBloch3[v4,p4norm,{0,0}];

eig2=Eigenvalues[m0,1]

eig[[1]]

N[Pi/longueur]

(*On calcule d'abord en balayant toute la zone de Brillouin ; on zoomera plus tard en k=0 *)

spx=calculspkx[10,Pi/longueur,v4,p4];

spx[[2]][[1,2]]

spx2=spx[[2]];

spx21=spx2[[1]];

Length[spx21]

spkx={};

For[k=1,k<22,k++,AppendTo[spkx,Flatten[spx21[[k]]]]];

ListPlot[spkx]

spy=calculspky[10,Pi/longueur,v4,p4];

spkx