Load MathQ - beta

SetDirectory[NotebookDirectory[]];

nb=CreateDocument[Get["MathQ-beta.nb"], WindowSelected->False];
NotebookEvaluate@nb;
NotebookClose[nb];

Demo 1: SSH model

Build a linear chain

Custom lattice (building it “by hand”) : 

	BuildLattice[{BravaisVectors, {“Sublattice1” -> {SitePositions}, “Sublattice2” -> {SitePositions}, ...}}]

latSSH = BuildLattice[{{{2}},{"A"->{{0}},"B"->{{1}}}}]

PlotLattice[latSSH]

PlotLattice[latSSH,Labels->"Tags", UnitCells->4, Axes->True, Frame->True]

Implement the SSH model with alternating hoppings

SSH model - implemented by a hopping function

	BuildSystem[lattice, Onsite -> Function[{r}, f[r]], Hopping -> Function[{r1, r2}, g[r1,r2]]

AlternatingHopping[t1_,t2_] = Function[{r1,r2},If[EvenQ[Round[Min[r1[[1]],r2[[1]]]]],t1,t2]];
sysSSH[t1_,t2_] = BuildSystem[latSSH, Hopping->AlternatingHopping[t1,t2]]

PlotLattice[sysSSH[t1,t2],Labels->"Tags",UnitCells->3,LinkTooltips->True,SiteTooltips->True]

Bandstructure

Bloch phases
	system[ϕ] gives a system with Bloch phase ϕ = k·(Subscript[a, 0])

Bands[sysSSH[1,2][ϕ],{ϕ,0,2π}]

PlotBands[Bands[sysSSH[1,2][ϕ],{ϕ,0,2π}], FrameLabel->{"ϕ","eigenvalues"}]

Manipulate[
PlotBands[Bands[sysSSH[t1,t2][kx],{kx,0,2π}], FrameLabel->{"ϕ","eigenvalues"},PlotRange->{-3,3}],
{{t1,1},0,2},{t2,0,2}]

Finite length SSH chain

We build a finite length lattice. This time we use a lattice preset (“linear”)

LatticePresets

latSSHfinite=BuildLattice["Linear",Bounded->{Region->Function[{r},0≤r[[1]]<99]}]

sysSSHfinite[t1_,t2_]=BuildSystem[latSSHfinite, Hopping->AlternatingHopping[t1,t2]]

PlotLattice[sysSSHfinite[t1,t2], LinkTooltips->True]

sysSSHfinite[(Subscript[t, 1]),(Subscript[t, 2])]["H"]
MatrixForm[%[[1;;10,1;;10]]]

Density of states

Spectrum[sysSSHfinite[1.0,0.5]]
SmoothHistogram[%,.03, Filling->Axis, FrameLabel->{"ϵ/(Subscript[t, 1])","DOS"}, PlotDefaults]

Spectrum[sysSSHfinite[1.0,2.0]]
SmoothHistogram[%,.03, Filling->Axis, FrameLabel->{"ϵ/(Subscript[t, 1])","DOS"}, PlotDefaults]

Wavefunctions

Eigenstates[sysSSHfinite[1.0,1.5],Levels->1]

PlotEigenstates[sysSSHfinite[1.0,1.5],Levels->3, 
Filling->Axis, FrameLabel->{"x","|ψ((|)^2)"}, PlotRange->All,PrintEigenvalues->True,PlotDefaults]

Demo 2: Kitaev model

Infinite Kitaev wire

Kitaev model: H=(∑_(⟨i,j⟩)) -w (Subscript[c, i]^(+))(Subscript[c, j])± (Subscript[Δc, i]^(+))(Subscript[c, j]^(+))∓s Δ (Subscript[c, i])(Subscript[c, j]), where ±=sign((Subscript[x, i])-(Subscript[x, j]))

We can express it as H -μ N =(1/2) [(∑_(⟨i,j⟩)) ((Subscript[c, i]^(+)),(Subscript[c, j]))·(({{-w, ± Δ}, {∓ Δ, w}}))·(({{(Subscript[c, i])}, {(Subscript[c, j]^(+))}}))  + (∑_i)((Subscript[c, i]^(+)),(Subscript[c, i]))·(({{-μ, 0}, {0, μ}}))·(({{(Subscript[c, i])}, {(Subscript[c, i]^(+))}}))]  (Bogoliubov - Nambu notation)

latLinear=BuildLattice["Linear"]

KitaevOnsite = Function[{r},(({{-μ, 0}, {0, μ}})) ];
KitaevHopping = Function[{r1,r2},(({{-w, 0}, {0, w}}))+Sign[(r1-r2)[[1]]](({{0, Δ}, {-Δ, 0}})) ]

sysKitaev[w_,Δ_,μ_] = BuildSystem[latLinear,Onsite->KitaevOnsite,Hopping->KitaevHopping, Nambu->True]

PlotLattice[sysKitaev[w,Δ,μ],UnitCells->4]

PlotBands[Bands[sysKitaev[1,0,0][ϕ],{ϕ,0,2π}],FrameLabel->{"ϕ","eigenvalues"}]

Is that an anticrossing?

PlotBands[Bands[sysKitaev[1,0,0][ϕ],{ϕ,0,2π},SamplePoints->100], FrameLabel->{"ϕ","eigenvalues"}]

Advanced interpolating sampling: UntangledBands

PlotBands[UntangledBands[sysKitaev[1,0,0][ϕ],{ϕ,0,2π}], FrameLabel->{"ϕ","eigenvalues"}]

Topological transition at |μ|=2|w|

Manipulate[
PlotBands[UntangledBands[sysKitaev[w,Δ,μ][ϕ],{ϕ,0,2π}], 
FrameLabel->{"ϕ","eigenvalues"},
PlotRange->{-5,5}, PlotLabel->"μ/w = "~~ToString[μ/w]],
{{w,1},0,1},{Δ,0,1},{{μ,0},-4,4}]

BDI-class topological invariant: ν=sign(∏_k)Pf[(Subscript[τ, x])(Subscript[H, k])]
(A general Pfafian implementation by M. Wimmer can be found in https://arxiv.org/src/1102.3440v2/anc/pfapack/mathematica/pfaffian.nb)

invariant[w_,Δ_,μ_]:=Sign[Pfaffian[(({{0, 1}, {1, 0}})).sysKitaev[w,Δ,μ][0]["Flat"]["H"]]*Pfaffian[(({{0, 1}, {1, 0}})).sysKitaev[w,Δ,μ][π]["Flat"]["H"]]]
Manipulate[
PlotBands[
UntangledBands[sysKitaev[w,Δ,μ][ϕ],{ϕ,0,2π}], 
FrameLabel->{"ϕ","eigenvalues"},
PlotLabel->"invariant = "~~ToString[invariant[w,Δ,μ]],
PlotRange->{-5,5}],
{{w,1},0,1},{Δ,0,1},{{μ,0},-3,3}]

Finite length Kitaev chain

latLinearFinite=BuildLattice["Linear",Bounded->{Region->Function[{r},0≤r[[1]]<100]}]
sysKitaevFinite[w_,Δ_,μ_]=BuildSystem[latLinearFinite,Onsite->KitaevOnsite,Hopping->KitaevHopping, Nambu->True]

Density of states

Non-topological: |μ| > 2|w|

Spectrum[sysKitaevFinite[1.0,1.0, 4.0]];
SmoothHistogram[%,.03, Filling->Axis, FrameLabel->{"ϵ/w","DOS"},PlotRange->All, PlotDefaults]

Topological: |μ| < 2|w|

Spectrum[sysKitaevFinite[1.0,1, 1]];
SmoothHistogram[%,.03, Filling->Axis, FrameLabel->{"ϵ/w","DOS"}, PlotRange->All,PlotDefaults]

Majoranas at the edges

PlotBands[Bands[sysKitaevFinite[1.0,1, μ], {μ,-3,3}],FrameLabel->{"μ/w","DOS"}, PlotStyle->Directive[{Thin,Gray}], GridLines->None]

PlotEigenstates[sysKitaevFinite[1.0,1, 1],Levels->2, Filling->Axis, FrameLabel->{"x","|ψ((|)^2)"}, PlotRange->All,PrintEigenvalues->True,PlotDefaults]

Demo 3: Haldane model

Build a honeycomb lattice

latHoneycomb=BuildLattice["Honeycomb"]

PlotLattice[latHoneycomb, UnitCells->5]

Build a graphene monolayer system (nearest neighbor)

sysgraphene=BuildSystem[latHoneycomb, HoppingRange->1/(Sqrt[3]), Onsite->Function[{r},0], Hopping->Function[{r1,r2},-3.16]]

PlotLattice[sysgraphene, LinkTooltips->True, SiteTooltips->True]

Plot bandstructure

Passing multiple Bloch phases and wave-vectors:
	system[{ϕ1,ϕ2,...}]
	system[A·{k1,k2,...}], where A = lattice[“BravaisVectors”] is the Bravais matrix

A = latHoneycomb["BravaisVectors"]
PlotBands[Bands[sysgraphene[A.{kx,ky}],{kx,-2π,2π},{ky,-2π,2π}, SamplePoints->91],BoxRatios->{1,1,1}]

Haldane model

Haldane model: graphene + alternating imaginary next-nearest neighbor hopping

Haldane=With[{t2=0.3, t=3.16},Function[{r1,r2,tag1,tag2},If[Norm[r1-r2]≤1/(Sqrt[3]),t,I t2 Cos[3ArcTan@@(r1-r2)]If[tag1==="A",1,-1]]]];
sysHaldane=BuildSystem[latHoneycomb, HoppingRange->1,Hopping->Haldane]

PlotLattice[sysHaldane, LinkTooltips->True, SiteTooltips->True]

PlotBands[Bands[sysHaldane[A.{kx,ky}],{kx,-2π,2π},{ky,-2π,2π}, SamplePoints->91], BoxRatios->{1,1,1}]

Berry curvature

Algorithm: T. Fukui and Y. Hatsugai and H. Suzuki - J. Phys. Soc. Jpn.  74  1674-1677  (2005)

berrymesh=BerryMesh[sysHaldane,SamplePoints->50];

PlotBerryMesh[latHoneycomb, berrymesh, PlotLegends->Automatic, ImageSize->300]

Nanoribbon geometry

Build a generic nanoribbon, apply the Haldane model

W=30; ChiralIntegers={3,-4}; RibbonAxis=Normalize[(({{Cos[π/3], Cos[2π/3]}, {Sin[π/3], Sin[2π/3]}})).ChiralIntegers];

latRibbon=BuildLattice["Honeycomb", Supercell->{ChiralIntegers,{1,1}},Bounded->{Axes->{2},Region->(-W/2<=#.(({{0, -1}, {1, 0}})).RibbonAxis<=W/2&)}]
sysHaldaneRibbon=BuildSystem[latRibbon, HoppingRange->1,Hopping->Haldane]

PlotLattice[sysHaldaneRibbon, UnitCells->10, ImageSize->Medium, PlotDirectives->PointSize[Medium]]

Nanoribbon bands

latRibbon["BravaisVectors"]

PlotBands[UntangledBands[sysHaldaneRibbon[latRibbon["BravaisVectors"].{k, 0}],{k,0,2π},Levels->32], FrameLabel->{"k","ϵ [eV]"}, PlotRange->{-2.5,2.5}, AspectRatio->1.5]

We can color the bands depending on eigenstate properties: which side of the ribbon is each state at?

uppersites= Flatten[Position[latRibbon["FlatSites"],{x_,y_}/;y>0]];
upperhalf= Function[{vec},Norm[Flatten[vec[[uppersites]]]]];

PlotBands[UntangledBands[sysHaldaneRibbon[k],{k,0,2π},Levels->32, EigenstateObservable->upperhalf], 
FrameLabel->{"kA","ϵ [eV]"}, PlotRange->{{0,2π},{-2.5,2.5}}, AspectRatio->1.5, 
ObservableToStyle->Function[{z},Blend[{{0,Red},{1,Lighter[Gray]}},z]]]

Demo 4: Kane-Mele graphene nanoribbon

The Kane-Mele model

Kane-Mele model: graphene with an opposite Haldane term for each spin sector

KaneMele=With[{t2=0.1,t=3.16},Function[{r1,r2,tag1,tag2},If[Norm[r1-r2]≤1/(Sqrt[3]),t(({{1, 0}, {0, 1}})),I t2(({{1, 0}, {0, -1}}))Cos[3ArcTan@@(r1-r2)[[1;;2]]]If[tag1==="A",1,-1]]]];
sysKaneMele=BuildSystem[latHoneycomb,HoppingRange->1,Onsite->Function[{r},(({{0, 0}, {0, 0}}))],Hopping->KaneMele]

PlotLattice[sysKaneMele, SiteTooltips->True, LinkTooltips->True, SiteRadius->0.2, LinkRadius->0.05,BoxCenterAtOrigin->True, UnitCells->4]

Kane-Mele nanoribbon

sysKaneMeleRibbon[Zeeman_] = BuildSystem[latRibbon, HoppingRange->1,Onsite->Function[{r},Zeeman(({{1, 0}, {0, -1}}))],Hopping->KaneMele]

PlotLattice[sysKaneMeleRibbon[0], UnitCells->10, ImageSize->Medium, PlotDirectives->PointSize[Medium]]

Bands

PlotBands[UntangledBands[sysKaneMeleRibbon[0.02][ϕ],{ϕ,0,2π},Levels->32], FrameLabel->{"ϕ","ϵ [eV]"}, PlotRange->{-1.5,1.5}, AspectRatio->1.5]

Quantum Spin-Hall: counter-propagating spins

PlotBands[UntangledBands[sysKaneMeleRibbon[0.05][k],{k,0,2π},Levels->32, EigenstateObservable->upperhalf], 
FrameLabel->{"kA","ϵ [eV]"}, PlotRange->{{0,2π},{-1.5,1.5}}, AspectRatio->1.5, 
ObservableToStyle->Function[{z},Blend[{{0,Red},{1,Lighter[Gray]}},z]]]

spin=Function[{vec},Total[#\[Conjugate].(({{1, 0}, {0, -1}})).#&/@vec]];

PlotBands[UntangledBands[sysKaneMeleRibbon[0.05][k],{k,0,2π},Levels->32, EigenstateObservable->spin], 
FrameLabel->{"kA","ϵ [eV]"}, PlotRange->{{0,2π},{-1.5,1.5}}, AspectRatio->1.5, 
ObservableToStyle->Function[{z},Blend[{{-1,Red},{1,Blue}},z]]]

Edge modes

With[{ϕ=0.99π},PlotEigenstates[latRibbon,sysRibbon[ϕ],
Levels->2,
UnitCells->7,
ImageSize->Medium,
MaskRegion->(-W/2<=#.(({{0, -1}, {1, 0}})).RibbonAxis<=W/2&)]]

With[{z=0.51},PlotEigenstates[latRibbon,sysRibbon[2π z],
Levels->2,
UnitCells->7,
ImageSize->Medium,
BubblePlot->True]]