Chiral polarization in honeycomb lattice

This notebook generates the data of all the two dimensional systems of the article and the supplementary material.
It runs correctly on Mathematica version 12.3.1.0

Generating the graph

Parameters of the system:
1. System size in terms of amount of unit cells along each bravais vector
2. Disorder in interactions
3. Disorder in positions

(*System Size*)
{nCellsx,nCellsy}={6,6};
(*Position disorder*)
dSpositions=0.;
(*Interaction disorder*)
dSinteractions=0.00001;
(*interaction disorder: correlation*)
σSinteractions=0.2nCellsx nCellsy;

Clear[graph];
graph=createGraph[nCellsx,nCellsy,dSpositions,dSinteractions,σSinteractions]

Poly-crystal

This is an interactive selector. 
You select a polygonal region by clicking different points in the system. Once you are done you run the next cell.

(*Selection of the region of the second domain*)
delimitersDomain={};
ClickPane[Show[{graph,Graphics[{Red,Line[Dynamic@delimitersDomain]}]},ImageSize->Large],AppendTo[delimitersDomain,#]&]

graph=secondDomain[graph,Region[Polygon[delimitersDomain]]]

Graph trimming

(*Selection of the region*)
delimitersDomain={};
ClickPane[Show[{graph,Graphics[{Red,Line[Dynamic@delimitersDomain]}]},ImageSize->Large],AppendTo[delimitersDomain,#]&]

graph=trimGraph[graph,Region[Polygon[delimitersDomain]]]

Spectral information

We retrieve the negative and zero energy eigenmodes

{{negEval,negEvec},{zmEval,zmEvec}}=negativeAndZMspectrum[graphToHamiltonian[graph]];

Illustration of all the zero modes

graphZM[graph,zmEvec]

Chiral polarization

To compute the chiral polarization first we need a localised basis for the negative (or positive) energy space.

Localized basis

Here we present two methods to obtain a localized basis:
1. Matrix Pencil
2. Maximally localized Wannier functions

Matrix Pencil

basisPencilMatrix=localizedBasisPencilMatrix[graph,negEval,negEvec];

Maximally localized Wannier functions

{basisMLWF,minimizationTrace}=localizedWannier[graph,negEval,negEvec,200];

ListLogPlot[minimizationTrace,AxesLabel->{"Minimization steps","Spreading"}]

Chiral polarization

field=chiralPolarizationField[graph,basisPencilMatrix];

Illustration of the chiral polarization field superimposed with the zero energy modes

Show[plotChiralPolarizaionField[field][[1]],graphZM[graph,zmEvec]]

Comparison between the Pencil Matrix method and the maximally localized Wannier functions

Chiral polarization

Here we compare both methods through the chiral polarization results

Basis generation

First we generate several basis with the pencil matrix and a basis of MLWF.
pencilM=λ A+(1-λ) B (we play with the λ parameter)

Clear[basisMLWF,minimizationTrace];
{basisMLWF,minimizationTrace}=localizedWannier[graph,negEval,negEvec,10000];

Clear[severalBasisMatrixPencil,λList];
(*λList=Range[0,1,0.01];*)
λList=RandomReal[{-0.2,0.2},100];
severalBasisMatrixPencil=Table[localizedBasisPencilMatrix[graph,negEval,negEvec,λ],{λ,λList}];

Spreading comparison

Clear[positions,spreadingBasisMatrixPencil,spreadingMLWF,spreadingDelocalized];
positions=positionList[graph];
spreadingBasisMatrixPencil=spreading[positions,#]&/@severalBasisMatrixPencil;
spreadingMLWF=spreading[positions,basisMLWF];
spreadingDelocalized=spreading[positions,negEvec];

ListPlot[{λList,spreadingBasisMatrixPencil}\[Transpose],Mesh->Full,Joined->True,AxesLabel->{"λ","Ω"},Epilog->{Red,InfiniteLine[{{0,spreadingMLWF},{1,spreadingMLWF}}],InfiniteLine[{{0,spreadingDelocalized},{1,spreadingDelocalized}}]},PlotRange->{All,{-0.1,10}}]

Comparison of the orientation distribution of the chiral polarization

histogramPencilMatrixAndMLWF[graph,severalBasisMatrixPencil,basisMLWF]

Comparison of the chiral polarization fields

Clear[fields,plotFields]
fields=chiralPolarizationField[graph,#]&/@severalBasisMatrixPencil[[;;20]];
plotFields=plotChiralPolarizaionField[#][[1]]&/@fields;

Show[plotFields,graphZM[graph,zmEvec]]

Spreading

Here we compare the spreading of the MLWF and the pencil matrix parametrized by the polar angle

Basis generation

First we generate several basis with the pencil matrix and a basis of MLWF.
pencilM=Px Cos[θ]-Py Sin[θ] (we play with the θ parameter)

Clear[severalBasisMatrixPencil,θList];
θList=Range[0,2π,0.01];
severalBasisMatrixPencil=Table[localizedBasisPencilMatrixAroundCircle[graph,negEval,negEvec,θ],{θ,θList}];

Clear[basisMLWF,minimizationTrace];
{basisMLWF,minimizationTrace}=localizedWannier[graph,negEval,negEvec,100];

Comparing spreading

positions=positionList[graph];
spreadingBasisMatrixPencil=spreading[positions,#]&/@severalBasisMatrixPencil;
spreadingMLWF=spreading[positions,basisMLWF];

Clear[polarGridLines,epilog1,epilog2,plotMinimization,plotPolar];
(*minimization steps to be highlighted*)
{hp1,hp2}={10,100};
plotMinimization=ListPlot[minimizationTrace,];
polarGridLines=# π/6&/@Range[0,11,1];
plotPolar=ListPolarPlot[{θList,spreadingBasisMatrixPencil}\[Transpose],];
Row[{plotMinimization,plotPolar}]

Utils

color1=RGBColor[0.24,0.76,0.22];
color2=RGBColor[0.9,0.16,0.58];

SetDirectory[NotebookDirectory[]];
Get[FindFile["chiralGraph`"]];
SetOptions[SelectedNotebook[], 
 StyleDefinitions -> 
  Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]], 
            Cell[StyleData["Text"], FontColor -> Black, FontWeight->Italic,Background->LightOrange]}]];