GradientDisk[f_,{x_,y_},{Rx_,Ry_}]:=Graphics[Table[{RGBColor[0,1-f r,0],Circle[{x,y},r{Rx,Ry}]},{r,0,1,0.01}]];

SetDirectory[NotebookDirectory[]];

fname="Wanniers.mat";

Import[fname,"LabeledData"];

(* Import data *)

mesh=Flatten[{"Mesh"}/.Import[fname,"LabeledData"]];

WCenter=Flatten[{"WCenter"}/.Import[fname,"LabeledData"]];

WCenterPoints=Table[{mesh[[i]],WCenter[[i]]},{i,1,Length[mesh]}];

WLeft=Flatten[{"WLeft"}/.Import[fname,"LabeledData"]];

WLeftPoints=Table[{mesh[[i]],WLeft[[i]]},{i,1,Length[mesh]}];

WRight=Flatten[{"WRight"}/.Import[fname,"LabeledData"]];

WRightPoints=Table[{mesh[[i]],WRight[[i]]},{i,1,Length[mesh]}];

W0=WCenter*WCenter;

W0Points=Table[{mesh[[i]],W0[[i]]},{i,1,Length[mesh]}];

W1=WLeft*WRight;

W1Points=Table[{mesh[[i]],W1[[i]]},{i,1,Length[mesh]}];

kmesh=Flatten[{"kmesh"}/.Import[fname,"LabeledData"]];

FW0=Flatten[{"FW0"}/.Import[fname,"LabeledData"]];

FW0Points=Table[{kmesh[[i]],FW0[[i]]},{i,1,Length[mesh]}];

FW1=Flatten[{"FW1"}/.Import[fname,"LabeledData"]];

FW1Points=Table[{kmesh[[i]],FW1[[i]]},{i,1,Length[mesh]}];

FW0I=Interpolation[FW0Points];

FW1I=Interpolation[FW1Points];

Phi=ArcCos[-FW0I[2]/FW0I[0]]/2;

pattern=Table[Cos[2*π*mesh[[i]]+Phi-π/2]*Cos[2*π*mesh[[i]]+π-Phi-π/2],{i,1,Length[mesh]}];

W0L=WLeft*WLeft;

JInt0Points=Table[{mesh[[i]],W0L[[i]]*pattern[[i]]},{i,1,Length[mesh]}];

JInt0=Interpolation[JInt0Points];

NIntegrate[JInt0[x],{x,mesh[[1]],Last[mesh]}]arduino

JInt1Points=Table[{mesh[[i]],W1[[i]]*pattern[[i]]},{i,1,Length[mesh]}];

JInt1=Interpolation[JInt1Points];

NIntegrate[JInt1[x],{x,mesh[[1]],Last[mesh]}]

B1=Show[Graphics[{Dashed,Line[{{-1.35,0},{1.35,0}}]}],Plot[{0.25(((Cos[2*π*x])^2)-1/2),0.25Cos[2*π*x+Phi-π/2],0.25Cos[2*π*x+π-Phi-π/2],0.25Cos[2*π*x+Phi-π/2]*Cos[2*π*x+π-Phi-π/2]},{x,-3,3},Axes->None,Mesh->None,PlotRange->{-2π,2π},PlotStyle->{{Black,Thickness[0.002]},{Red,Thickness[0.002],Dashing[Small]},{Blue,Thickness[0.002],Dashing[Small]},{Orange,Thickness[0.005]}},AspectRatio->0.2],GradientDisk[0.65,{1/4,0},0.05{1,1}],GradientDisk[0.65,{-1/4,0},0.05{1,1}],GradientDisk[0.65,{3/4,0},0.05{1,1}],GradientDisk[0.65,{-3/4,0},0.05{1,1}],GradientDisk[0.65,{5/4,0},0.05{1,1}],GradientDisk[0.65,{-5/4,0},0.05{1,1}],PlotRange->{{-1.35,1.35},0.28{-1,1}}]

B2=Show[Graphics[{Dashed,Line[{{-1.35,0},{1.35,0}}]}],Plot[{0.25(((Cos[2*π*x])^2)-1/2),0.25Cos[2*π*x]},{x,-3,3},Axes->None,Mesh->None,PlotRange->{-2π,2π},PlotStyle->{{Black,Thickness[0.002]},{Orange,Thickness[0.005]}},AspectRatio->0.2],GradientDisk[0.65,{1/4,0},0.05{1,1}],GradientDisk[0.65,{-1/4,0},0.05{1,1}],GradientDisk[0.65,{3/4,0},0.05{1,1}],GradientDisk[0.65,{-3/4,0},0.05{1,1}],GradientDisk[0.65,{5/4,0},0.05{1,1}],GradientDisk[0.65,{-5/4,0},0.05{1,1}],PlotRange->{{-1.35,1.35},0.28{-1,1}}]

AppendTo[$Path,"/home/kozlowski/.local/Wolfram/Mathematica/Packages"];

Get["SciDraw`"]

DefineStyle["StyleIn",{DataLine->{LineDashing->3,LineColor->Red},DataSymbol->{Show->False}}];
DefineStyle["StyleOut",{DataLine->{LineDashing->3,LineColor->Blue},DataSymbol->{Show->False}}];
DefineStyle["StyleCombined",{DataLine->{LineColor->Orange,LineThickness->2.5},DataSymbol->{Show->False}}];

Diagram=Figure[
Multipanel[
{
FigurePanel[
{
(* Plots *)
FigGraphics[B1];

},
{1,1},
YTicks->{{0,"u=0"}}
];
FigurePanel[
{
(* Plots *)
FigGraphics[B2];
},
{2,1},
YTicks->{{0,"u=0"}}
];
},

(* legend *)
DataLegend[
Scaled[{0.185,-0.02}],
{
{"StyleIn",Row[{Subscript[textit["u"],"0"]}]},
{"StyleOut",Row[{Subscript[textit["u"],"1"]}]},
{"StyleCombined",Row[{Subsuperscript[textit["u"],"1","*"],Subscript[textit["u"],"0"]}]}
},
Width->18,
RowLimit->1
];

Dimensions->{2,1},
XPlotRange->{-1.35,1.35},XTicks->None,
YPlotRange->{-0.28,0.28},
FontSize->15,
PanelLetterFontSize->15,PanelLetterPosition->{TopLeft,14}
],
CanvasSize->{4,2*(0.28/1.35)*4},CanvasFrame->False,CanvasMargin->{{0.35,0.1},{0.42,0.1}}
]

Export["Diagram.pdf",Diagram,ImageResolution-> 600]