Clear[liens,ppts,l,ll,RawHamFlux];

Octonacci[k_]:=Module[{octo,i},
octo=Table[0,{i,1,k}];
octo[[1]]=1;
octo[[2]]=2;
Do[ octo[[i]]=octo[[i-2]]+2*octo[[i-1]],{i,3,k}];
octo];

Octonacci[10]

liens=Import["liensPBC6v2.dat"];
ppts=Import["PtsPBC6v2.dat"];
l=Length[liens];
ll=Length[ppts];
cut=0.5;

RawHamFlux=Reap[Do[{rat=N[169*Sqrt[2]];
dx=ppts[[liens[[m,1]],1]]-ppts[[liens[[m,2]],1]];
dy=ppts[[liens[[m,1]],2]]-ppts[[liens[[m,2]],2]];

If[(liens[[m,1]]<liens[[m,2]])&&(Abs[dy]<cut)&&(Abs[dx]<cut),(*Print["Cond  "," ",dx," ",dy," ",liens[[m,1]]," ",liens[[m,2]]];*)
Sow[{{liens[[m,1]],liens[[m,2]]},-Exp[I*Pi*Phi*rat*rat*((ppts[[liens[[m,2]]]])[[2]]-(ppts[[liens[[m,1]]]])[[2]])*((ppts[[liens[[m,2]]]])[[1]]+(ppts[[liens[[m,1]]]])[[1]])]}];
Sow[{{liens[[m,2]],liens[[m,1]]},-Exp[-I*Pi*Phi*rat*rat*((ppts[[liens[[m,2]]]])[[2]]-(ppts[[liens[[m,1]]]])[[2]])*((ppts[[liens[[m,2]]]])[[1]]+(ppts[[liens[[m,1]]]])[[1]])]}];]
},{m,1,l}]][[2,1]];

tmp=Split[Sort[RawHamFlux],#1[[1]]==#2[[1]]&];
RawHamFlux=Table[tmp[[i,1,1]]->Tr[Transpose[tmp[[i]]][[2]]],{i,1,Length[tmp]}];

l

ll

Clear[t4]

t2=Print[Timing[Eigenvalues[SparseArray[RawHamFlux/.Phi->0]]][[1]]]

t3=Print[Timing[Eigenvalues[SparseArray[RawHamFlux/.Phi->0]]][[1]]]

t4=Print[Timing[Eigenvalues[SparseArray[RawHamFlux/.Phi->0]]][[1]]]

t5=Print[Timing[Eigenvalues[SparseArray[RawHamFlux/.Phi->0]]][[1]]]

ham6=SparseArray[RawHamFlux/.Phi->0];

Clear[t6 ]

t6=Timing[Eigenvalues[ham6,1]][[1]]

t6tot=Timing[Eigenvalues[SparseArray[RawHamFlux/.Phi->0]]][[1]]