5. Parallel transport for top valence band of MoS2

In this tutorial, we will Wannierize the top valence band of MoS2, by constructing the parallel transport gauge (PTG).

Usually, Wannierization of selected group of bands is difficult because there is no prior knowledge of the initial projections. Possible solutions are

  • use random Gaussian as initial projections, then run many iterations of maxiaml localization
  • use SCDM for the isolated manifold, then run maximal localization

The PTG does not need any initial projections, rather it constructs smooth Bloch frames sequentially in the reciprocal space, thus getting rid of the need of initial projections. Moreover, PTG only works in reciprocal space, thus more efficient than SCDM, which requires wavefunctions in real space.

Outline

  1. construct a Model, by reading the win, amn, mmn, and eig files
  2. truncate the Model to the valence bands
  3. run Wannier.jl parallel_transport on the new Model to construct PTG
  4. further rotate the gauge to remove the gauge arbitraness of the first kpoint
  5. maxiaml localize to smoothen the gauge
  6. interpolate band, and write the real space WF
  7. similarly, Wannierize the top valence band
Tip

This is a HTML version of the tutorial, you can download corresponding

Preparation

Load the package

using Wannier
using WannierPlots

Model generation

We will use the read_w90 function to read the win, amn, mmn, and eig files, and construct a Model that abstracts the calculation

model = read_w90("mos2")
lattice: Å
  a1:  3.19064  0.00000  0.00000
  a2: -1.59532  2.76318  0.00000
  a3:  0.00000  0.00000 10.00000

atoms: fractional
  Mo:  0.00000  0.00000  0.00000
   S:  0.33333  0.66667 -0.15620
   S:  0.33333  0.66667  0.15620

n_bands: 11
n_wann : 11
kgrid  : 3 3 1
n_kpts : 9
n_bvecs: 8

b-vectors:
         [bx, by, bz] / Å⁻¹                weight
  1       0.00000    0.00000   -0.62832    1.26651
  2       0.00000    0.00000    0.62832    1.26651
  3      -0.65642   -0.37898    0.00000    0.58020
  4       0.65642    0.37898    0.00000    0.58020
  5       0.00000   -0.75797    0.00000    0.58020
  6       0.00000    0.75797    0.00000    0.58020
  7       0.65642   -0.37898    0.00000    0.58020
  8      -0.65642    0.37898    0.00000    0.58020

Maximal localization

Although results from this section is not used in the following sections, it's good to have a general feeling of the system by maximal localizing the valence + conduction manifolds of MoS2.

Since we are focusing on the isolated manifolds of MoS2, we only need to run max_localize function,

U = max_localize(model);
[ Info: Initial spread
  WF     center [rx, ry, rz]/Š             spread/Ų
   1    -0.00000     0.00000    -0.00000     1.32249
   2    -0.00000    -0.00508     0.00000     1.40657
   3    -0.00000     0.00550    -0.00000     1.40658
   4     0.00000    -0.08390    -0.00000     1.34939
   5     0.00000     0.08536     0.00000     1.34957
   6    -0.00000     1.84212    -1.68768     1.47204
   7    -0.00000     1.84724    -1.53227     1.35339
   8    -0.00000     1.83633    -1.53227     1.35339
   9    -0.00000     1.84212     1.68768     1.47204
  10    -0.00000     1.84724     1.53227     1.35339
  11    -0.00000     1.83633     1.53227     1.35339
Sum spread: Ω = ΩI + Ω̃, Ω̃ = ΩOD + ΩD
   ΩI  =    14.02836
   Ω̃   =     1.16387
   ΩOD =     1.14694
   ΩD  =     0.01693
   Ω   =    15.19223


Iter     Function value   Gradient norm
     0     1.519223e+01     1.875610e+00
 * time: 0.0008330345153808594
     1     1.508566e+01     3.778374e-02
 * time: 0.005322933197021484
     2     1.507656e+01     4.676487e-03
 * time: 0.00974893569946289
     3     1.507619e+01     2.269699e-03
 * time: 0.01413106918334961
     4     1.507611e+01     1.457915e-03
 * time: 0.02048206329345703
     5     1.507604e+01     1.559373e-03
 * time: 0.02662491798400879
     6     1.507548e+01     4.723188e-03
 * time: 0.034800052642822266
     7     1.506872e+01     1.401101e-02
 * time: 0.04248809814453125
     8     1.506551e+01     1.418407e-02
 * time: 0.04680490493774414
     9     1.506308e+01     1.701166e-02
 * time: 0.05107402801513672
    10     1.505694e+01     5.058202e-03
 * time: 0.05717897415161133
    11     1.505645e+01     1.984510e-03
 * time: 0.061296939849853516
    12     1.505638e+01     1.062548e-03
 * time: 0.06734991073608398
    13     1.505635e+01     1.483286e-03
 * time: 0.07322907447814941
    14     1.505628e+01     1.228934e-03
 * time: 0.07921409606933594
    15     1.505611e+01     1.623964e-03
 * time: 0.08505797386169434
    16     1.505598e+01     1.741845e-03
 * time: 0.09126710891723633
    17     1.505595e+01     5.963593e-04
 * time: 0.0973360538482666
    18     1.505593e+01     8.736247e-04
 * time: 0.10339093208312988
    19     1.505589e+01     1.421848e-03
 * time: 0.10930109024047852
    20     1.505583e+01     1.106753e-03
 * time: 0.11536192893981934
    21     1.505579e+01     1.127908e-03
 * time: 0.12131094932556152
    22     1.505578e+01     7.020496e-04
 * time: 0.12737298011779785
    23     1.505577e+01     7.487464e-04
 * time: 0.13328099250793457
    24     1.505574e+01     9.377154e-04
 * time: 0.13936400413513184
    25     1.505570e+01     1.194677e-03
 * time: 0.2116689682006836
    26     1.505568e+01     6.325705e-04
 * time: 0.21780610084533691
    27     1.505567e+01     4.222628e-04
 * time: 0.22409796714782715
    28     1.505566e+01     5.227612e-04
 * time: 0.23000693321228027
    29     1.505565e+01     7.171461e-04
 * time: 0.23597192764282227
    30     1.505562e+01     8.427797e-04
 * time: 0.24175691604614258
    31     1.505560e+01     8.659909e-04
 * time: 0.2476339340209961
    32     1.505559e+01     3.411627e-04
 * time: 0.2536139488220215
    33     1.505559e+01     3.146433e-04
 * time: 0.25952792167663574
    34     1.505558e+01     4.735664e-04
 * time: 0.2653510570526123
    35     1.505557e+01     5.687287e-04
 * time: 0.27123308181762695
    36     1.505555e+01     3.337094e-04
 * time: 0.2771010398864746
    37     1.505555e+01     2.706709e-04
 * time: 0.28339195251464844
    38     1.505555e+01     1.994675e-04
 * time: 0.28924989700317383
    39     1.505555e+01     2.097114e-04
 * time: 0.29513096809387207
[ Info: Final spread
  WF     center [rx, ry, rz]/Š             spread/Ų
   1     0.00000    -0.05038    -0.00000     1.34165
   2     0.00000    -0.00665     0.00000     1.44473
   3     0.00000     0.00688    -0.00000     1.44382
   4    -0.00000    -0.04716    -0.00000     1.33478
   5    -0.00000     0.10022     0.00000     1.36101
   6    -0.00000     1.84264    -1.69614     1.42436
   7     0.00000     1.85074    -1.53177     1.32055
   8    -0.00000     1.83165    -1.53162     1.31987
   9    -0.00000     1.84264     1.69614     1.42436
  10    -0.00000     1.85074     1.53177     1.32055
  11    -0.00000     1.83165     1.53162     1.31987
Sum spread: Ω = ΩI + Ω̃, Ω̃ = ΩOD + ΩD
   ΩI  =    14.02836
   Ω̃   =     1.02719
   ΩOD =     1.01101
   ΩD  =     0.01618
   Ω   =    15.05555

The initial spread is

omega(model)
  WF     center [rx, ry, rz]/Š             spread/Ų
   1    -0.00000     0.00000    -0.00000     1.32249
   2    -0.00000    -0.00508     0.00000     1.40657
   3    -0.00000     0.00550    -0.00000     1.40658
   4     0.00000    -0.08390    -0.00000     1.34939
   5     0.00000     0.08536     0.00000     1.34957
   6    -0.00000     1.84212    -1.68768     1.47204
   7    -0.00000     1.84724    -1.53227     1.35339
   8    -0.00000     1.83633    -1.53227     1.35339
   9    -0.00000     1.84212     1.68768     1.47204
  10    -0.00000     1.84724     1.53227     1.35339
  11    -0.00000     1.83633     1.53227     1.35339
Sum spread: Ω = ΩI + Ω̃, Ω̃ = ΩOD + ΩD
   ΩI  =    14.02836
   Ω̃   =     1.16387
   ΩOD =     1.14694
   ΩD  =     0.01693
   Ω   =    15.19223

The final spread is

omega(model, U)
  WF     center [rx, ry, rz]/Š             spread/Ų
   1     0.00000    -0.05038    -0.00000     1.34165
   2     0.00000    -0.00665     0.00000     1.44473
   3     0.00000     0.00688    -0.00000     1.44382
   4    -0.00000    -0.04716    -0.00000     1.33478
   5    -0.00000     0.10022     0.00000     1.36101
   6    -0.00000     1.84264    -1.69614     1.42436
   7     0.00000     1.85074    -1.53177     1.32055
   8    -0.00000     1.83165    -1.53162     1.31987
   9    -0.00000     1.84264     1.69614     1.42436
  10    -0.00000     1.85074     1.53177     1.32055
  11    -0.00000     1.83165     1.53162     1.31987
Sum spread: Ω = ΩI + Ω̃, Ω̃ = ΩOD + ΩD
   ΩI  =    14.02836
   Ω̃   =     1.02719
   ΩOD =     1.01101
   ΩD  =     0.01618
   Ω   =    15.05555
Note

The convergence thresholds is determined by the keyword arguments of max_localize, e.g., f_tol for the tolerance on spread, and g_tol for the tolerance on the norm of spread gradient, etc. You can use stricter thresholds to further minimize a bit the spread.

Truncate bands

To Wannierize the valence bands, we need to remove the conduction bands from the model, i.e., keeping the first 7 bands (the second 1:7 means targeting 7 WFs)

model_val = Wannier.truncate(model, 1:7, 1:7)
lattice: Å
  a1:  3.19064  0.00000  0.00000
  a2: -1.59532  2.76318  0.00000
  a3:  0.00000  0.00000 10.00000

atoms: fractional
  Mo:  0.00000  0.00000  0.00000
   S:  0.33333  0.66667 -0.15620
   S:  0.33333  0.66667  0.15620

n_bands: 7
n_wann : 7
kgrid  : 3 3 1
n_kpts : 9
n_bvecs: 8

b-vectors:
         [bx, by, bz] / Å⁻¹                weight
  1       0.00000    0.00000   -0.62832    1.26651
  2       0.00000    0.00000    0.62832    1.26651
  3      -0.65642   -0.37898    0.00000    0.58020
  4       0.65642    0.37898    0.00000    0.58020
  5       0.00000   -0.75797    0.00000    0.58020
  6       0.00000    0.75797    0.00000    0.58020
  7       0.65642   -0.37898    0.00000    0.58020
  8      -0.65642    0.37898    0.00000    0.58020

In most cases, the initial gauge after truncation is often useless, we can inspect the initial spread by

omega(model_val)
  WF     center [rx, ry, rz]/Š             spread/Ų
   1    -0.00000     0.02484     0.45513     3.36811
   2    -0.25007    -0.47694     0.60369     4.21672
   3    -0.02533     0.75243     0.40878     3.44071
   4     0.22527    -0.01558     0.03695     3.84977
   5     0.43234    -0.44993     0.43280     5.50568
   6    -0.00505     1.85216    -1.27125     2.94659
   7    -0.19179     1.77816    -0.73814     4.07216
Sum spread: Ω = ΩI + Ω̃, Ω̃ = ΩOD + ΩD
   ΩI  =    12.33249
   Ω̃   =    15.06725
   ΩOD =    10.48250
   ΩD  =     4.58475
   Ω   =    27.39974

not particularly bad but this is mostly due to luck.

Parallel transport

In such case, we run the parallel_transport which will construct a smooth gauge.

Before running PTG, let me assure you that indeed there is no initial projection: we will generate a series of random unitary matrices, and run PTG starting from those matrices.

However, to make the tutorial reproducible, we will use a fixed random seed.

using Random
Random.seed!(12345)
R = Wannier.rand_unitary(eltype(model_val.U), size(model_val.U)...)
7×7×9 Array{ComplexF64, 3}:
[:, :, 1] =
   0.611982-0.0680831im    0.369925+0.0936156im   …    -0.362093-0.255007im
   -0.25193+0.138914im      0.48321+0.457435im        -0.0925643+0.117003im
  -0.162812+0.0191976im   -0.256817+0.207641im         0.0807378+0.227207im
   0.180351+0.119913im    -0.481932+0.0711173im        -0.455623-0.263607im
   0.348206+0.354799im    -0.145836-0.00655689im     -0.00600927+0.178631im
 -0.0932865-0.307372im   -0.0107652+0.0280361im   …    0.0186097-0.26766im
   0.336833+0.0229696im   -0.205406+0.0293806im         0.402728+0.424565im

[:, :, 2] =
  0.249699+0.0280008im     0.15524-0.326421im   …  -0.246195+0.159139im
 -0.219683+0.322728im     0.402313+0.106178im      -0.150253+0.128701im
 -0.265469-0.219713im   -0.0271274-0.0266899im     0.0759199+0.20338im
 -0.234369+0.201627im   -0.0116844+0.269579im      -0.694983+0.0675179im
  0.122346-0.193733im     0.518155+0.358749im       0.359184-0.118547im
  0.511342-0.142161im   -0.0382278+0.443339im   …  -0.129856-0.0988981im
 0.0250173-0.485093im    -0.132823-0.09552im       -0.302858+0.280718im

[:, :, 3] =
   0.220081+0.301573im       0.458887-0.574796im   …   0.194548-0.149449im
  -0.604122-0.05156im       0.0596934-0.316014im       0.151232+0.0609445im
   0.270142-0.0408827im     -0.174124+0.0984644im     -0.393726+0.245831im
 -0.0487575-0.210768im       0.190202-0.239918im      -0.521906+0.0728123im
   0.542912+0.14655im        0.209871+0.0821898im      0.128521+0.28652im
  -0.104922+0.180385im    -0.00615728-0.205619im   …   -0.27056+0.365389im
   0.108353+0.00549941im     0.130917-0.334057im       -0.04467+0.335815im

[:, :, 4] =
   0.199924-0.32493im    0.0568404-0.345109im   …  -0.0163937+0.381016im
 -0.0544485-0.257386im  -0.0837769-0.164187im        0.454662-0.162614im
 -0.0381853+0.212404im   -0.304111-0.199846im        0.387314-0.15001im
   0.473746+0.184167im  -0.0683422-0.0376258im      -0.106274-0.177766im
  -0.348457+0.331936im     0.37868+0.032441im       0.0912384-0.0274424im
  0.0473047-0.183143im   -0.517365-0.174058im   …   -0.225556-0.193239im
   0.375416+0.268315im   -0.273593+0.433495im        0.431483+0.350021im

[:, :, 5] =
  0.0304204+0.335772im     0.161422+0.106822im   …   0.421953-0.335036im
   0.314532+0.0310171im    0.546942+0.102912im       0.281583+0.0807793im
   0.120628-0.315156im    -0.165074+0.201351im      -0.120464+0.197715im
 -0.0977367-0.166836im    -0.193524+0.106837im       0.113727-0.505037im
  0.0943698+0.523404im   -0.0706901+0.0793945im     -0.325802+0.180726im
  -0.221252-0.252172im     0.644096+0.307316im   …  -0.262349-0.0871109im
  -0.476233+0.113932im   -0.0864456+0.0897854im      0.289695+0.0560925im

[:, :, 6] =
 -0.0501477+0.3189im      0.0330964+0.109512im   …  -0.0054632-0.531903im
  -0.184153+0.0454354im  -0.0109615-0.198156im       -0.156099-0.658811im
  0.0199912-0.0433592im    0.223478+0.0201311im     -0.0514811+0.0703047im
  0.0422625+0.287128im   0.00831853+0.305946im        0.148835-0.130233im
  -0.414246-0.305453im     0.427801+0.499466im      -0.0344314-0.115551im
   0.514051+0.206011im     0.330122-0.186367im   …    0.403505+0.00577608im
  -0.333167-0.301185im     0.163535-0.447849im      -0.0103551+0.185608im

[:, :, 7] =
   0.581664+0.17107im       0.488161+0.000879105im  …  0.0851223-0.0953079im
   0.289617-0.0501643im    -0.150571-0.175104im        -0.362389-0.198743im
 0.00393263-0.43418im       0.370635+0.17527im         0.0602814-0.162912im
 -0.0869405+0.245303im      0.064244-0.293404im          0.31082-0.0196805im
 -0.0340595+0.0111228im  -0.00661423+0.609133im        0.0261347-0.162969im
  -0.349461+0.310165im      0.164785-0.196307im     …   0.075267-0.0196238im
  -0.258172+0.0590374im   -0.0303501+0.11119im         -0.385934-0.709534im

[:, :, 8] =
   0.400752+0.101786im    -0.242088-0.201209im   …  -0.125929-0.0348899im
  -0.290945+0.398706im     -0.14719+0.37873im        0.217468-0.0232411im
  0.0521347-0.552845im     0.138991-0.0516373im      0.352616+0.0101564im
  -0.364262-0.262155im    0.0354486-0.110671im      0.0395224+0.0795288im
   0.138979+0.0501244im   -0.341471-0.251166im       0.672165-0.16197im
 -0.0738819+0.125356im     0.522146-0.437798im   …   0.106716-0.148227im
   0.119564+0.135494im   -0.0511758+0.231751im       0.484316+0.238332im

[:, :, 9] =
  -0.142998-0.2444im       0.092259-0.117479im   …     0.360929-0.177272im
  -0.218318+0.268954im     0.209595+0.584083im        -0.528864-0.0797708im
   0.218642-0.0747457im    -0.20578-0.139807im        -0.267355+0.269007im
    0.24092+0.236821im    -0.257236+0.245718im         0.271825+0.164903im
   0.635563+0.457827im    -0.213159-0.0568265im        0.055898-0.354462im
  0.0424859-0.00145579im  0.0380851-0.196714im   …    -0.236862-0.20326im
 -0.0981146+0.0855813im   -0.498158+0.259211im      -0.00461223+0.2848im

and assign it to the model_val

model_val.U .= R;

of course now we have totally destroyed the gauge 😈

omega(model_val)
  WF     center [rx, ry, rz]/Š             spread/Ų
   1     1.91982    -0.55414     0.01989    16.25920
   2     0.58057    -0.63851    -0.30170    16.39322
   3     1.16335     0.00838     0.02894    12.67233
   4    -0.46909     0.75040    -0.07022    14.02873
   5    -0.60391     0.52268     0.36086    17.52953
   6    -0.16228    -1.34043     0.01853    14.47228
   7    -0.02840     0.36807    -0.07231    15.28373
Sum spread: Ω = ΩI + Ω̃, Ω̃ = ΩOD + ΩD
   ΩI  =    12.33249
   Ω̃   =    94.30653
   ΩOD =    19.63642
   ΩD  =    74.67011
   Ω   =   106.63902

and we will ask parallel_transport to explicitly use our random matrices, by setting argument use_U = true,

U2, _ = parallel_transport(model_val; use_U=true)
([0.21291453311544217 + 0.04558671478978092im 0.12790772127434905 + 0.10857796586380286im … -0.1128456423784215 + 0.08141271387049343im 0.07414963458795239 + 0.754681890261154im; -0.450635234159315 + 0.09805893396481324im 0.4340401302786704 + 0.30903842176321994im … 0.16115602995815012 - 0.02329399420561397im -0.1667241944203604 + 0.08543315152250104im; … ; -0.04353146481690904 - 0.06018943415132813im 0.4692355591680636 + 0.03281958116357149im … 0.15686597649203896 - 0.3568346518173716im 0.0433547478772239 - 0.24457737034643548im; 0.5324260963857044 - 0.2676097566016405im -0.05740567355357558 - 0.11202039522373078im … 0.4316429284160802 - 0.23119497948248488im -0.4283749757019721 + 0.010611027409609284im;;; -0.52936035031419 + 0.21998485945037022im 0.03986446488377517 - 0.11277099704621964im … 0.31440392483926466 - 0.028298780547463303im -0.174452001222516 - 0.4435076241109663im; 0.14114960590628758 - 0.5562349453586419im 0.18245560830766802 - 0.16366392643653135im … 0.11618693802010405 - 0.4756988389072461im 0.03462240253883337 - 0.13603643371825697im; … ; 0.07001216122197576 + 0.38593129658856623im 0.4220919014804138 - 0.19987148832927765im … -0.2552144513919128 - 0.0982340835132849im 0.02927256213798671 + 0.17376988680478725im; 0.05515441348435997 + 0.36703134747665517im 0.132173099232664 - 0.13540615128062813im … -0.23770744580540773 + 0.20662801899801156im 0.2111535357977925 - 0.32928630391140606im;;; 0.3436921983745592 + 0.2492458288444569im -0.23990402941602545 + 0.05789363416180981im … -0.2774759170111624 - 0.1993421096801158im -0.2063132921171284 + 0.08804848537665065im; 0.503544039002621 - 0.22680881258878624im 0.16366415592014316 - 0.008081386411168588im … 0.5441385010350192 - 0.014759971655975491im 0.06640480204435702 + 0.30350467715171375im; … ; -0.3237229445216122 - 0.08950665373146979im -0.11877427997176902 + 0.4375801576433175im … 0.1393904564752471 - 0.06427408141503804im -0.20151254245255748 - 0.013608081218234914im; 0.44706452935384855 - 0.2894080910073682im -0.2011670051053731 - 0.10176582588037769im … 0.09030692283673991 - 0.14823060428368742im -0.2271241210292925 - 0.2127777544782365im;;; -0.058207842028567484 + 0.38429277238046217im 0.35563976753679777 - 0.036119338989376644im … -0.48861992715887725 + 0.07848919123876917im -0.24549110451404935 + 0.2725817972160385im; 0.03985420156458462 - 0.32211969459466827im 0.060673186806658994 + 0.47934901711027983im … -0.23128549703342088 - 0.018500232852300274im 0.06366842826327884 + 0.019842279382737055im; … ; -0.2809703655767062 + 0.09521356789023978im -0.11409338446842616 + 0.07473176886257002im … -0.06269205929032685 + 0.13251746244639354im -0.2941464724411054 - 0.2465376939293816im; 0.43761825803769516 - 0.3378542083389246im 0.28510994193184797 - 0.24961906426139416im … -0.07845332495183362 - 0.4750006946271968im -0.028364941521279205 - 0.21344529527854583im;;; -0.2787878455314008 + 0.2779621990783426im -0.1989849041443083 - 0.5649457424583634im … -0.130496296182022 - 0.5601776595371158im -0.1723721893915088 + 0.09709822272529245im; 0.3984015896685359 + 0.24878506354668897im 0.054087502827458694 - 0.16983106665118983im … 0.3635342195465332 - 0.013079009359152086im 0.11093633351584742 + 0.18329758227374943im; … ; 0.26523297910500687 + 0.22875071589535734im 0.01756074746559881 + 0.09542670790617273im … -0.387293534255152 - 0.04727030143361069im 0.06966574344102179 - 0.40171009299805366im; 0.39562552614396895 - 0.06572416851824503im 0.27901581458166913 - 0.22380660588566748im … -0.16604061360863834 - 0.25610308846563584im 0.06990920113857918 - 0.43688249586883504im;;; 0.1874735002483741 - 0.16622866721943205im 0.03633902050059742 + 0.2676747172112476im … -0.15645288322463777 - 0.2226812049946523im -0.032128494226095906 - 0.006783566745056063im; 0.19202069205653421 + 0.2752532036392131im -0.3736896332454326 - 0.40503585349190296im … -0.30139328677077953 + 0.17827963331309768im -0.31191025629893177 + 0.31899061191197325im; … ; -0.41253698611439 + 0.45834744177049075im 0.14942438483338344 + 0.31274725853291113im … 0.3710220392103541 + 0.17387346829406164im 0.10448525917744375 + 0.08243950650632915im; 0.26742864084799084 - 0.08514772809178983im 0.17925720283760124 + 0.06481787747235652im … 0.2147858429050381 - 0.150740639389222im -0.10624593190323317 + 0.699265534597922im;;; -0.07839945705370016 + 0.16136089691025393im -0.12626453245871577 - 0.3720914342538491im … 0.3441732485970579 + 0.30709601696760397im 0.25565807121131984 - 0.2627554712749304im; -0.11734551358605849 + 0.44830978114471964im -0.1355148515154993 - 0.06273750459934024im … -0.2786770526987415 + 0.12162858994382124im -0.07690326307592271 - 0.24268297463468894im; … ; 0.2776061636781323 - 0.07317776968040256im 0.36742555698408136 + 0.11097159729900882im … -0.28229057880135133 + 0.1611988708892494im 0.1759989018081177 - 0.06906513308302789im; 0.6638154015001767 - 0.02082966347140669im -0.36081879909988696 - 0.01508690680415599im … -0.27044766921084584 + 0.011530934037714113im 0.11580751981499514 - 0.24253121231505623im;;; -0.13218934199384103 + 0.06089050800680937im -0.2764656742367631 - 0.11319682763329676im … 0.40877687084206976 - 0.13265281221845154im -0.3686079841169557 - 0.17639105977079755im; 0.2363909268150511 - 0.19834413179484972im 0.5442843977744735 + 0.06188067197154086im … 0.036310033156665186 - 0.43715369156811795im -0.04062704020505902 - 0.37790079164242985im; … ; -0.07919582887754678 - 0.45902046261161006im -0.008793274712461935 - 0.08697842566645556im … -0.1278792871812165 - 0.12517625129298982im -0.13205696755293855 - 0.03106808630608074im; -0.4344577307052536 - 0.37433102348075864im -0.028546381219348112 + 0.0642095761767703im … 0.42556023370599516 + 0.20668030090415387im -0.14469764899543114 - 0.16343313957562206im;;; 0.03678380650031061 + 0.031463357657447184im 0.5232653828213434 - 0.1850437310746549im … 0.05108644827954806 + 0.215674646296588im -0.332606097824494 - 0.13779385112820441im; 0.39982497131950967 + 0.1710320754847497im 0.08512388840845539 - 0.05361452134567413im … 0.2675452379294072 - 0.09723255952793287im 0.259888055649051 - 0.018027049578116388im; … ; -0.38064580260612096 - 0.1792737511685681im -0.3230937834305165 - 0.04692837162390141im … -0.07639141196366804 + 0.09413670649133189im 0.39802077587534734 + 0.4547607538689994im; -0.1020085256210547 - 0.3352796128752094im -0.32491723770177056 + 0.30064742578887416im … 0.23563848426788356 + 0.3673983036730131im -0.3245730606683568 - 0.16294306706191175im], Wannier.Obstruction{ComplexF64}([0.6155661964879394 + 0.6743238912266016im -0.01698620295753107 - 0.009084544583424115im … -0.0029948115883386556 - 0.010718638329047788im 0.08729248398286828 + 0.11610269696840395im; 0.0213818291386192 + 0.017032317664696248im 0.5022911619716379 + 0.8584459398418742im … 0.0022418016374887036 - 0.008969775343025059im -0.005189953712266613 - 0.002221024013051043im; … ; -0.05939568134413286 - 0.003030770293062958im 0.012669782880174743 + 0.016100339460750686im … 0.5682542758664519 + 0.7910375207052937im 0.09960220850459828 + 0.0713370296491256im; -0.11351746456250383 - 0.06751407571615217im 0.005906354754450286 + 0.01936291790152432im … -0.04935362985759299 - 0.1276374707254782im 0.5833968125695885 + 0.7611933268772393im;;; 0.16595868261106556 + 0.8338827111999141im 0.10733981365151225 + 0.31290509790115917im … 0.1060768903302437 + 0.06971135647772222im -0.012879061213748176 + 0.12139337685834915im; -0.10898175601526999 - 0.3815994190997508im 0.1441712891875026 + 0.49374869370469726im … -0.11428956338931584 - 0.013163949199270476im 0.32829097104934746 - 0.16393446152670837im; … ; 0.09034722038545465 - 0.040536355406216876im -0.15022351395794353 - 0.43623572607314465im … 0.2347297663182596 + 0.7361682181819768im 0.10658227636329931 - 0.0163632623327808im; -0.16173801251927286 + 0.04810814313069926im -0.1839952565337024 + 0.025637642027596483im … -0.14831058504872727 + 0.04532029652219214im 0.4175931117248599 + 0.6653664221092388im;;; 0.14629523185925863 + 0.21509575006575088im -0.508541522475798 + 0.04821987309034381im … -0.32925005147769054 + 0.1940568676232756im 0.10478922266079366 - 0.0739722256486939im; 0.589156691484849 - 0.2745255194963696im 0.19151320392050258 + 0.30992521585404187im … -0.3422249837512319 - 0.1059755120166246im 0.2087028150572766 + 0.010752261646015435im; … ; 0.3941488263651758 + 0.2316949835574115im 0.006422951964104001 - 0.37261337559486424im … 0.37870288172106525 + 0.6338407670598559im -0.07320181938926663 + 0.021766633800694525im; -0.27244716504503397 - 0.010512148924552017im -0.04189590341698644 + 0.16688425758500963im … 0.06420284619373058 + 0.21164175763914372im 0.43656116977385395 + 0.7779110141181593im], [0.8659065595718888 - 0.09078407534083519im 0.09660552659616349 + 0.08395505491105362im … 0.05386591289146256 + 0.07633023380800927im -0.1200331066003807 + 0.4017976386829168im; -0.10322457796770343 + 0.27214038598615986im 0.7328773702344165 + 0.07413143758429207im … -0.2170727975040589 - 0.10008743648246174im 0.3517443673209326 + 0.344709032493176im; … ; 0.023634408186792136 + 0.0064012126224629136im 0.3638499520481227 + 0.15465981102965445im … 0.7891979997989234 + 0.026200178538974918im -0.02171282043330458 - 0.24298266604365032im; 0.1931585433967333 + 0.15588142293750215im -0.35686460538450676 + 0.3180897197045935im … 0.10062406250860997 - 0.45175002010646514im 0.6098341052819016 - 0.11151266313471832im;;; 0.7653602945082882 - 0.4005978020945789im 0.23546186398392888 + 0.1673680016633046im … -0.09276951322207877 + 0.1386962071414601im -0.10545755444063808 - 0.10582935878138378im; -0.054446668785834304 + 0.21931735136365108im 0.7468828952920699 + 0.16877000904486927im … -0.17519644509646431 - 0.20487670311269143im 0.3090904904340727 - 0.06358485900064523im; … ; 0.06371100684374341 + 0.255390456895275im 0.3637645893255406 - 0.047170656785668154im … 0.7389342037422606 + 0.20151394319913915im -0.32645221074351416 + 0.09923767705218066im; 0.17136381496668243 - 0.11505256065013947im -0.1836839556540793 - 0.0008011653409122288im … 0.4235555019441447 + 0.1613171440267718im 0.7245485503473422 - 0.09049910768441134im;;; 0.8047049164406468 - 0.3469109987525987im 0.22449016468770527 + 0.13280773970516355im … -0.1035393653122615 + 0.17129784865806422im 0.023633062168113242 + 0.16086087115282527im; -0.24431612731528804 + 0.22344891431558722im 0.7097703847312786 + 0.27872748161673166im … -0.22332022820163291 + 0.40209333831845073im 0.12418624572278761 - 0.11385789577153876im; … ; -0.017439996753638293 + 0.020970351706938853im 0.055872318657432585 + 0.48462200337389716im … 0.6702274856922302 - 0.03115647303511353im -0.3360104057595895 - 0.14604488560357967im; 0.06122699727187636 + 0.21978365139174785im -0.02663770975999869 - 0.0651007237702975im … 0.2909319671640075 - 0.20060686865018834im 0.7705884389166733 - 0.013781953450899614im], [0.8659065595718894 - 0.09078407534083555im 0.09660552659616364 + 0.08395505491105343im … 0.05386591289146288 + 0.0763302338080091im -0.12003310660038133 + 0.40179763868291596im; -0.10322457796770282 + 0.27214038598616im 0.732877370234416 + 0.07413143758429178im … -0.21707279750405908 - 0.10008743648246166im 0.3517443673209327 + 0.34470903249317597im; … ; 0.023634408186791626 + 0.0064012126224627635im 0.3638499520481223 + 0.1546598110296542im … 0.7891979997989234 + 0.026200178538974772im -0.021712820433304063 - 0.24298266604365018im; 0.1931585433967337 + 0.15588142293750193im -0.3568646053845064 + 0.31808971970459293im … 0.10062406250860975 - 0.4517500201064646im 0.609834105281902 - 0.11151266313471775im;;; 0.7797832971458003 + 0.20859473097562872im 0.12643082242693915 + 0.0798672324159619im … 0.038534461137638934 + 0.2753072023956587im -0.23608163945733934 + 0.3736355413328114im; -0.0929874282982888 + 0.1517480785663244im 0.7234778862969511 + 0.013440813152140102im … -0.2751556568161322 - 0.16018418770087803im 0.33666329648267623 + 0.31055506908071806im; … ; -0.08842626924211569 + 0.15263940949586832im 0.31959478752003573 + 0.03849262983613636im … 0.6853838510260811 - 0.018081851252672598im -0.11448988325014055 - 0.24835677632396158im; 0.2635296411008863 + 0.3613369442384614im -0.31514568991476355 + 0.3161007127332787im … 0.14366698371213074 - 0.2304230203325433im 0.6616646332080185 - 0.06294866032216402im;;; 0.8311142679814145 - 0.039044092266147905im 0.07878769915275985 + 0.08394869899344305im … 0.08800237409214194 - 0.06254225215038497im -0.13709712600385782 + 0.35123367847558373im; -0.11391322470253808 + 0.1997066013300955im 0.7374381221520441 + 0.12426763491522298im … -0.1926251026458342 - 0.045347871941637884im 0.3778736842130258 + 0.3288495174986914im; … ; -0.1129505372914377 - 0.08498438289327452im 0.29136366067259617 + 0.08785132708731704im … 0.6712101842566495 - 0.1592023211491913im -0.06222487034919403 - 0.33949513772887im; 0.0886074764636645 + 0.290380011769579im -0.3776365445175729 + 0.28666667508635574im … 0.0805824680022702 - 0.3736445273032482im 0.6112309339803939 - 0.06301644048114641im], [0.9999999999999998 - 3.885780586188048e-16im -1.5265566588595902e-16 - 3.3480163086352377e-16im … -3.885780586188048e-16 - 3.712308238590367e-16im 3.0531133177191805e-16 - 1.1796119636642288e-16im; 3.0531133177191805e-16 - 3.7990444123892075e-16im 1.0000000000000004 - 3.885780586188048e-16im … -5.967448757360216e-16 + 7.806255641895632e-17im 1.942890293094024e-16 + 3.3306690738754696e-16im; … ; -2.651749036196924e-16 - 5.075792769111851e-16im 1.4433813291953766e-16 + 2.5979211618694885e-17im … 0.9999999999999999 + 3.3292624750188444e-16im 4.896358630067421e-16 - 1.7656175326166846e-16im; -3.4429047080374403e-16 + 4.0093432064821697e-16im -2.5768056792555844e-16 - 2.1363524124562402e-16im … 2.9704431741402886e-16 - 1.0104411654797028e-16im 1.0000000000000004 - 6.38401028482918e-17im;;; 0.9291089543592259 - 0.22578277726529605im 0.027138303654428986 + 0.023675558766535293im … -0.1170063423224871 + 0.010570259048905642im -0.07610426430482 - 0.03028889536308832im; -0.016191241687996155 - 0.001225410465894385im 0.9513337169618832 + 0.042980893727851716im … 0.11194276962318818 + 0.02842314876374715im -0.15935083806996903 + 0.006622552567054393im; … ; 0.08128116053520616 - 0.0677225551179914im -0.10990474847536637 - 0.07509279291264137im … 0.7726905753555864 + 0.2484157042355623im 0.13148986541224927 - 0.4499904363528751im; -0.14867035739626525 + 0.06596629119679358im 0.13811307777509077 - 0.0561463486184687im … -0.2416881442333981 + 0.1973842720322523im 0.08245799369669511 - 0.40537478456170034im;;; 0.929565359292382 - 0.0833426358175956im 0.0037182696079787886 + 0.10115225268956654im … 0.03361362554839131 + 0.10217999212779108im 0.03912430796060465 - 0.022675585927675115im; 0.052295067725469546 + 0.009715232275139103im 0.90557193376237 - 0.16943040582227104im … -0.054985149662094966 - 0.13810226315383053im 0.22849102114223377 - 0.004417306726787029im; … ; 0.15809359145607105 - 0.07466001734688316im -0.25836677717133627 - 0.21895181038545325im … 0.2847679564696303 - 0.03255297541374801im 0.44881972502286327 + 0.3215441644752737im; -0.16637285294188767 + 0.06552640961296666im 0.09306696633588522 + 0.020460767493965092im … 0.6819673058053274 + 0.5204356986556432im 0.29690273708531423 - 0.15024391858969355im;;;; 0.9418716380715867 + 0.3053706845169437im -0.034275207530501506 - 0.10109967031093235im … -0.02344009977382941 + 0.006456761799738744im 0.06756463431281934 + 0.01207893776025127im; 0.011281205538100067 + 0.00013876338533040915im 0.9319506871536595 + 0.3418104964707368im … 0.0008747910063864606 - 0.013625263892280273im 0.0019174813891678355 - 0.02608444456844837im; … ; -0.0003968287963681383 + 0.025142538760021673im 0.01270615416983207 - 0.014597769579127234im … 0.9464526040881749 + 0.31280138245643135im 0.04385714841385661 - 0.0003692027405266434im; -0.05660457108905686 - 0.012926949159277397im 0.015487229429225384 - 0.010885823969648656im … -0.03593887242224703 - 0.0256970518680742im 0.9523685475681827 + 0.28033539041495253im;;; 0.9233677695404081 + 0.2346216869403741im 0.06263309539851339 + 0.08577150820015761im … 0.020060756116900558 - 0.06180507912635013im 0.0006915824764732667 + 0.04528448169061279im; -0.10222766149879728 - 0.09153308080908552im 0.7945968311251582 + 0.44582966587883016im … 0.06167296681187911 + 0.10383313157936838im 0.011150478981263388 - 0.26458445457702245im; … ; 0.05260449871578716 - 0.07845231398379696im -0.24390038742256723 - 0.1543467848524217im … 0.5969742117110058 + 0.456943754012556im 0.25243159653855207 - 0.32552755908990466im; -0.13874187881554373 + 0.14201673311396182im 0.040293699776791425 + 0.05081381947612462im … -0.26790541591329897 + 0.19043532365945878im 0.3297193183892056 - 0.13844957500956548im;;; 0.7846747282988309 + 0.25185149398573015im -0.0022328330618558018 + 0.10668288590251555im … -0.07182692119860323 + 0.24953241541169557im 0.0895597711444869 - 0.16308740388677959im; 0.08753771517686754 - 0.19484773496258984im 0.7897484188617372 + 0.13867334526495764im … -0.2189342517770359 - 0.04532343741404454im 0.29688295660437347 - 0.0188489026949904im; … ; 0.35047958025807546 - 0.0959949933725811im -0.22665050572196999 - 0.38633538272656837im … 0.3606843161799988 + 0.10372430589235518im 0.21143649444462764 + 0.2720317005037015im; -0.311221118833501 + 0.06000721113145553im 0.05615396197727562 + 0.23934232419379511im … 0.43469251387661056 + 0.5655643300268036im 0.4556475341367063 + 0.1612333647044255im;;;; 0.8188339190660934 + 0.488877863929845im 0.007258234807738427 - 0.038542034392988055im … -0.04004423311393753 - 0.028541953063611795im 0.1082121176529673 + 0.09538120595034477im; 0.04480366580301066 - 0.029349462371917347im 0.7861416273140386 + 0.6076865246054242im … 0.028666142986165443 - 0.018937259694434105im 0.013056485079373695 - 0.024125099394347878im; … ; 0.012835824758234003 + 0.03556292179025934im 0.01510557072052092 - 0.033327260217864585im … 0.7940179542089094 + 0.5874786785573468im 0.07834655575921869 + 0.02545754331021436im; -0.14207780677932882 - 0.02965341744803948im 0.02774082435250454 - 0.005418933908657806im … -0.05068694521470846 - 0.06877189830461358im 0.8077789029280112 + 0.5436023724790224im;;; 0.606382319217727 + 0.6667007407667336im 0.20405948257032064 + 0.18481475053090837im … 0.12543471583855914 - 0.023123240244931818im 0.009129507661037824 + 0.0916277642483936im; -0.12685819589315153 - 0.2611393583842796im 0.45927546704558053 + 0.5878763689410086im … -0.06533666874340126 + 0.08280418667669767im 0.2587242567103391 - 0.31337703342846107im; … ; 0.07875738794400639 - 0.0711877104552086im -0.2729171764623185 - 0.3181914582863685im … 0.4224197510158781 + 0.5988115642495414im 0.2267672350712919 - 0.13372406761952352im; -0.15763161804046114 + 0.13176718470129675im -0.11134691781229404 + 0.0787608773002319im … -0.24294160385619337 + 0.12716903282915387im 0.4668604111075374 + 0.27101397986306197im;;; 0.44715998398659107 + 0.35451138182906106im -0.22093495823529613 + 0.14214580638828944im … -0.24423019784789302 + 0.29882427051839455im 0.1423803010123908 - 0.18430532638639746im; 0.3053513070578444 - 0.3848594411178202im 0.47089940644594086 + 0.31035641908701606im … -0.3469417853907348 - 0.039501598277993794im 0.26590029171950497 - 0.021442328853656198im; … ; 0.44011616377554946 + 0.03820615649222991im -0.10219667925817864 - 0.4548896771179151im … 0.44237515916592235 + 0.35387840127880615im 0.020467888269448644 + 0.12677905007868834im; -0.3153847996911859 + 0.014944545418177727im -0.04012705938310509 + 0.2976405515476643im … 0.1808147657409967 + 0.40687244853702065im 0.5227765895323025 + 0.522703531735593im], [0.8659065595718888 - 0.09078407534083519im 0.09660552659616349 + 0.08395505491105362im … 0.05386591289146256 + 0.07633023380800927im -0.1200331066003807 + 0.4017976386829168im; -0.10322457796770343 + 0.27214038598615986im 0.7328773702344165 + 0.07413143758429207im … -0.2170727975040589 - 0.10008743648246174im 0.3517443673209326 + 0.344709032493176im; … ; 0.023634408186792136 + 0.0064012126224629136im 0.3638499520481227 + 0.15465981102965445im … 0.7891979997989234 + 0.026200178538974918im -0.02171282043330458 - 0.24298266604365032im; 0.1931585433967333 + 0.15588142293750215im -0.35686460538450676 + 0.3180897197045935im … 0.10062406250860997 - 0.45175002010646514im 0.6098341052819016 - 0.11151266313471832im;;; 0.7653602945082882 - 0.4005978020945789im 0.23546186398392888 + 0.1673680016633046im … -0.09276951322207877 + 0.1386962071414601im -0.10545755444063808 - 0.10582935878138378im; -0.054446668785834304 + 0.21931735136365108im 0.7468828952920699 + 0.16877000904486927im … -0.17519644509646431 - 0.20487670311269143im 0.3090904904340727 - 0.06358485900064523im; … ; 0.06371100684374341 + 0.255390456895275im 0.3637645893255406 - 0.047170656785668154im … 0.7389342037422606 + 0.20151394319913915im -0.32645221074351416 + 0.09923767705218066im; 0.17136381496668243 - 0.11505256065013947im -0.1836839556540793 - 0.0008011653409122288im … 0.4235555019441447 + 0.1613171440267718im 0.7245485503473422 - 0.09049910768441134im;;; 0.8047049164406468 - 0.3469109987525987im 0.22449016468770527 + 0.13280773970516355im … -0.1035393653122615 + 0.17129784865806422im 0.023633062168113242 + 0.16086087115282527im; -0.24431612731528804 + 0.22344891431558722im 0.7097703847312786 + 0.27872748161673166im … -0.22332022820163291 + 0.40209333831845073im 0.12418624572278761 - 0.11385789577153876im; … ; -0.017439996753638293 + 0.020970351706938853im 0.055872318657432585 + 0.48462200337389716im … 0.6702274856922302 - 0.03115647303511353im -0.3360104057595895 - 0.14604488560357967im; 0.06122699727187636 + 0.21978365139174785im -0.02663770975999869 - 0.0651007237702975im … 0.2909319671640075 - 0.20060686865018834im 0.7705884389166733 - 0.013781953450899614im;;;;], [0.8659065595718894 - 0.09078407534083555im 0.09660552659616364 + 0.08395505491105343im … 0.05386591289146288 + 0.0763302338080091im -0.12003310660038133 + 0.40179763868291596im; -0.10322457796770282 + 0.27214038598616im 0.732877370234416 + 0.07413143758429178im … -0.21707279750405908 - 0.10008743648246166im 0.3517443673209327 + 0.34470903249317597im; … ; 0.023634408186791626 + 0.0064012126224627635im 0.3638499520481223 + 0.1546598110296542im … 0.7891979997989234 + 0.026200178538974772im -0.021712820433304063 - 0.24298266604365018im; 0.1931585433967337 + 0.15588142293750193im -0.3568646053845064 + 0.31808971970459293im … 0.10062406250860975 - 0.4517500201064646im 0.609834105281902 - 0.11151266313471775im;;; 0.7797832971458003 + 0.20859473097562872im 0.12643082242693915 + 0.0798672324159619im … 0.038534461137638934 + 0.2753072023956587im -0.23608163945733934 + 0.3736355413328114im; -0.0929874282982888 + 0.1517480785663244im 0.7234778862969511 + 0.013440813152140102im … -0.2751556568161322 - 0.16018418770087803im 0.33666329648267623 + 0.31055506908071806im; … ; -0.08842626924211569 + 0.15263940949586832im 0.31959478752003573 + 0.03849262983613636im … 0.6853838510260811 - 0.018081851252672598im -0.11448988325014055 - 0.24835677632396158im; 0.2635296411008863 + 0.3613369442384614im -0.31514568991476355 + 0.3161007127332787im … 0.14366698371213074 - 0.2304230203325433im 0.6616646332080185 - 0.06294866032216402im;;; 0.8311142679814145 - 0.039044092266147905im 0.07878769915275985 + 0.08394869899344305im … 0.08800237409214194 - 0.06254225215038497im -0.13709712600385782 + 0.35123367847558373im; -0.11391322470253808 + 0.1997066013300955im 0.7374381221520441 + 0.12426763491522298im … -0.1926251026458342 - 0.045347871941637884im 0.3778736842130258 + 0.3288495174986914im; … ; -0.1129505372914377 - 0.08498438289327452im 0.29136366067259617 + 0.08785132708731704im … 0.6712101842566495 - 0.1592023211491913im -0.06222487034919403 - 0.33949513772887im; 0.0886074764636645 + 0.290380011769579im -0.3776365445175729 + 0.28666667508635574im … 0.0805824680022702 - 0.3736445273032482im 0.6112309339803939 - 0.06301644048114641im;;;;]))

note the function returns a lit bit extra information which is irrelevant to this tutorial, so we discard it by a _.

Then we inspect the new gauge

omega(model_val, U2)
  WF     center [rx, ry, rz]/Š             spread/Ų
   1     1.30855    -0.74945     0.34574     4.70544
   2     1.10462    -0.80553    -0.45909     4.08750
   3     1.53527    -0.85513    -0.30646     3.72911
   4     1.62520    -0.87992     0.18877     4.03471
   5     1.25641    -0.45619     0.00151     7.03248
   6     1.12484    -0.51176    -0.18510     7.09370
   7     1.43836    -0.79184     0.46076     3.86795
Sum spread: Ω = ΩI + Ω̃, Ω̃ = ΩOD + ΩD
   ΩI  =    12.31910
   Ω̃   =    22.23179
   ΩOD =    13.04509
   ΩD  =     9.18670
   Ω   =    34.55089

Fix gauge at first kpoint

However, the parallel_transport itself does not fix the gauge of the first kpoint, which is arbitrary. We can fix it by maximal localizing w.r.t. a single (i.e. independent of kpoints) n_wann * n_wann rotation matrix W, by calling opt_rotate,

model_val.U .= U2;
W = opt_rotate(model_val)
7×7 Matrix{ComplexF64}:
  -0.230345-0.0989521im    -0.260593-0.540886im   …  -0.268641-0.159742im
  0.0743317+0.0139856im    -0.114993+0.430512im      -0.292182+0.0765661im
   0.216465+0.153387im      0.111167+0.216279im      -0.617052-0.213303im
   0.167665-0.520245im     -0.274795+0.0480535im     0.0978119+0.189714im
   0.379139+0.146187im      -0.16001-0.330962im       0.347539-0.00565539im
 0.00403547-0.534936im   -0.00524416-0.193797im   …  -0.311923+0.055875im
  -0.289276+0.165251im      0.122495-0.341005im      -0.341026-0.0417167im

This is convenient since the calculation is cheap, and helps evade local minimum.

Then let's rotate the input gauge by W,

U3 = rotate_U(U2, W);

and inspect the new gauge,

omega(model_val, U3)
  WF     center [rx, ry, rz]/Š             spread/Ų
   1     2.07333    -0.85352    -0.90676     3.89271
   2     0.77324    -0.56113     0.74967     4.33078
   3     1.70716    -0.29171     0.47147     3.99161
   4     1.03457    -0.66736    -0.91186     3.53966
   5     1.64362    -1.05905     0.97628     3.17720
   6     1.03972    -0.73131     0.67645     3.85515
   7     1.44388    -1.03178    -1.04718     3.18872
Sum spread: Ω = ΩI + Ω̃, Ω̃ = ΩOD + ΩD
   ΩI  =    12.31910
   Ω̃   =    13.65673
   ΩOD =    11.08352
   ΩD  =     2.57321
   Ω   =    25.97583

Final maximal localization

Often it is helpful to run a final maximal localization that could further smoothen the gauge,

model_val.U .= U3;
U4 = max_localize(model_val);
[ Info: Initial spread
  WF     center [rx, ry, rz]/Š             spread/Ų
   1     2.07333    -0.85352    -0.90676     3.89271
   2     0.77324    -0.56113     0.74967     4.33078
   3     1.70716    -0.29171     0.47147     3.99161
   4     1.03457    -0.66736    -0.91186     3.53966
   5     1.64362    -1.05905     0.97628     3.17720
   6     1.03972    -0.73131     0.67645     3.85515
   7     1.44388    -1.03178    -1.04718     3.18872
Sum spread: Ω = ΩI + Ω̃, Ω̃ = ΩOD + ΩD
   ΩI  =    12.31910
   Ω̃   =    13.65673
   ΩOD =    11.08352
   ΩD  =     2.57321
   Ω   =    25.97583


Iter     Function value   Gradient norm
     0     2.602539e+01     2.576693e+00
 * time: 0.0003972053527832031
     1     2.412622e+01     1.209305e+00
 * time: 0.0025730133056640625
     2     2.111106e+01     1.309789e+00
 * time: 0.005605220794677734
     3     1.928827e+01     3.814870e-01
 * time: 0.008604049682617188
     4     1.820980e+01     7.933732e-01
 * time: 0.011583089828491211
     5     1.717438e+01     3.602762e-01
 * time: 0.014547109603881836
     6     1.679738e+01     7.686058e-01
 * time: 0.017573118209838867
     7     1.640059e+01     2.784952e-01
 * time: 0.020629167556762695
     8     1.582352e+01     4.323702e-01
 * time: 0.023578166961669922
     9     1.536060e+01     1.992504e-01
 * time: 0.02668619155883789
    10     1.492756e+01     1.194916e-01
 * time: 0.029694080352783203
    11     1.473032e+01     7.175801e-02
 * time: 0.03264021873474121
    12     1.466869e+01     4.051092e-02
 * time: 0.03572821617126465
    13     1.464471e+01     2.103241e-02
 * time: 0.03878021240234375
    14     1.463152e+01     1.935339e-02
 * time: 0.04173707962036133
    15     1.461556e+01     3.361789e-02
 * time: 0.04467415809631348
    16     1.457790e+01     4.246903e-02
 * time: 0.04766511917114258
    17     1.454032e+01     4.025647e-02
 * time: 0.05063009262084961
    18     1.452123e+01     1.842546e-02
 * time: 0.05365419387817383
    19     1.451584e+01     9.311711e-03
 * time: 0.05667901039123535
    20     1.451325e+01     7.785603e-03
 * time: 0.05978822708129883
    21     1.450986e+01     1.167156e-02
 * time: 0.06282901763916016
    22     1.450291e+01     1.653862e-02
 * time: 0.06579017639160156
    23     1.449366e+01     2.035980e-02
 * time: 0.06868910789489746
    24     1.448904e+01     7.385620e-03
 * time: 0.07168817520141602
    25     1.448778e+01     5.292953e-03
 * time: 0.07468199729919434
    26     1.448698e+01     5.019512e-03
 * time: 0.0776071548461914
    27     1.448546e+01     8.180517e-03
 * time: 0.08050322532653809
    28     1.448347e+01     7.526146e-03
 * time: 0.08347415924072266
    29     1.448206e+01     6.233346e-03
 * time: 0.08648014068603516
    30     1.448139e+01     3.380015e-03
 * time: 0.08948016166687012
    31     1.448111e+01     2.139932e-03
 * time: 0.09241008758544922
    32     1.448094e+01     2.499538e-03
 * time: 0.09540510177612305
    33     1.448071e+01     2.797482e-03
 * time: 0.0986170768737793
    34     1.448033e+01     3.740020e-03
 * time: 0.10157108306884766
    35     1.447974e+01     4.316050e-03
 * time: 0.10460209846496582
    36     1.447935e+01     2.682243e-03
 * time: 0.10763812065124512
    37     1.447917e+01     1.733643e-03
 * time: 0.11058902740478516
    38     1.447904e+01     1.812006e-03
 * time: 0.11352419853210449
    39     1.447886e+01     2.294387e-03
 * time: 0.11646103858947754
    40     1.447833e+01     4.428291e-03
 * time: 0.11960220336914062
    41     1.447697e+01     5.535976e-03
 * time: 0.12272000312805176
    42     1.447553e+01     4.952531e-03
 * time: 0.12575817108154297
    43     1.447473e+01     3.188871e-03
 * time: 0.12781906127929688
    44     1.447435e+01     2.516891e-03
 * time: 0.13085412979125977
    45     1.447376e+01     5.741778e-03
 * time: 0.13386821746826172
    46     1.447262e+01     5.940999e-03
 * time: 0.13688111305236816
    47     1.447101e+01     5.421526e-03
 * time: 0.1399400234222412
    48     1.447024e+01     4.086283e-03
 * time: 0.1428689956665039
    49     1.446997e+01     2.069250e-03
 * time: 0.14581799507141113
    50     1.446985e+01     1.340838e-03
 * time: 0.14879512786865234
    51     1.446975e+01     1.655369e-03
 * time: 0.1517782211303711
    52     1.446957e+01     2.097816e-03
 * time: 0.15485000610351562
    53     1.446932e+01     2.756120e-03
 * time: 0.15773606300354004
    54     1.446909e+01     2.340068e-03
 * time: 0.16061711311340332
    55     1.446897e+01     1.053948e-03
 * time: 0.16363215446472168
    56     1.446893e+01     6.374744e-04
 * time: 0.16652512550354004
    57     1.446891e+01     4.925959e-04
 * time: 0.16940617561340332
    58     1.446890e+01     5.650941e-04
 * time: 0.1722722053527832
    59     1.446889e+01     7.896718e-04
 * time: 0.17513704299926758
    60     1.446885e+01     8.622655e-04
 * time: 0.1780850887298584
    61     1.446882e+01     7.519531e-04
 * time: 0.18105721473693848
    62     1.446881e+01     4.459332e-04
 * time: 0.18407821655273438
    63     1.446880e+01     2.234834e-04
 * time: 0.18708300590515137
    64     1.446880e+01     1.644921e-04
 * time: 0.19001102447509766
    65     1.446880e+01     1.649354e-04
 * time: 0.19287610054016113
    66     1.446880e+01     2.437921e-04
 * time: 0.19574999809265137
    67     1.446879e+01     3.183865e-04
 * time: 0.19876718521118164
    68     1.446879e+01     2.570612e-04
 * time: 0.20172500610351562
    69     1.446879e+01     1.515776e-04
 * time: 0.20465302467346191
    70     1.446879e+01     9.498335e-05
 * time: 0.20762419700622559
    71     1.446879e+01     6.413529e-05
 * time: 0.21056413650512695
[ Info: Final spread
  WF     center [rx, ry, rz]/Š             spread/Ų
   1     1.82568    -0.78793    -1.22746     1.95835
   2     1.82542    -0.78839     1.22833     1.95799
   3     1.59533     0.92110    -0.00000     2.71962
   4     1.36550    -0.78831    -1.22878     1.95782
   5     1.59542    -1.18673     1.22825     1.95805
   6     1.36475    -0.78788     1.22701     1.95853
   7     1.59515    -1.18719    -1.22734     1.95842
Sum spread: Ω = ΩI + Ω̃, Ω̃ = ΩOD + ΩD
   ΩI  =    12.33249
   Ω̃   =     2.13629
   ΩOD =     1.86430
   ΩD  =     0.27199
   Ω   =    14.46879

and inspect the final gauge

omega(model_val, U4)
  WF     center [rx, ry, rz]/Š             spread/Ų
   1     1.82568    -0.78793    -1.22746     1.95835
   2     1.82542    -0.78839     1.22833     1.95799
   3     1.59533     0.92110    -0.00000     2.71962
   4     1.36550    -0.78831    -1.22878     1.95782
   5     1.59542    -1.18673     1.22825     1.95805
   6     1.36475    -0.78788     1.22701     1.95853
   7     1.59515    -1.18719    -1.22734     1.95842
Sum spread: Ω = ΩI + Ω̃, Ω̃ = ΩOD + ΩD
   ΩI  =    12.33249
   Ω̃   =     2.13629
   ΩOD =     1.86430
   ΩD  =     0.27199
   Ω   =    14.46879

Band interpolation

Finally, let's have a look at the band interpolation.

Valence + conduction bands,

model.U .= U;
interp_model = Wannier.InterpModel(model)
kpi, E = interpolate(interp_model)
(StaticArraysCore.SVector{3, Float64}[[0.0, 0.0, 0.0], [0.005000000000029007, 6.579536487914742e-14, 0.0], [0.010000000000058015, 1.3159072975829484e-13, 0.0], [0.015000000000087022, 1.973879443286199e-13, 0.0], [0.02000000000011603, 2.631814595165897e-13, 0.0], [0.025000000000145038, 3.2897867408691475e-13, 0.0], [0.030000000000174044, 3.947758886572398e-13, 0.0], [0.035000000000203056, 4.605706369726613e-13, 0.0], [0.04000000000023206, 5.263629190331794e-13, 0.0], [0.045000000000261074, 5.92162599858408e-13, 0.0]  …  [0.33333333333526716, 0.3333333333379791, 0.16071428571428567], [0.33333333333526716, 0.3333333333379791, 0.14285714285714282], [0.33333333333526716, 0.3333333333379791, 0.12499999999999999], [0.33333333333526716, 0.3333333333379791, 0.10714285714285712], [0.33333333333526716, 0.3333333333379791, 0.08928571428571427], [0.33333333333526716, 0.3333333333379791, 0.07142857142857141], [0.33333333333526716, 0.3333333333379791, 0.05357142857142856], [0.33333333333526716, 0.3333333333379791, 0.035714285714285705], [0.33333333333526716, 0.3333333333379791, 0.017857142857142853], [0.33333333333526716, 0.3333333333379791, 0.0]], [-1.733862029814319 -1.7335775384579915 … -1.534027903670697 -1.534027903670697; 1.302271202092639 1.30040941301282 … -0.7482965399680505 -0.7482965399680505; … ; 6.884660328887309 6.882911559570061 … 7.463690065715058 7.463690065715058; 6.884660354635391 6.885627509299747 … 8.73410605356629 8.73410605356629])

and top valence band,

model_val.U .= U4;
interp_model_val = Wannier.InterpModel(model_val)
kpi2, E2 = interpolate(interp_model_val)
(StaticArraysCore.SVector{3, Float64}[[0.0, 0.0, 0.0], [0.005000000000029007, 6.579536487914742e-14, 0.0], [0.010000000000058015, 1.3159072975829484e-13, 0.0], [0.015000000000087022, 1.973879443286199e-13, 0.0], [0.02000000000011603, 2.631814595165897e-13, 0.0], [0.025000000000145038, 3.2897867408691475e-13, 0.0], [0.030000000000174044, 3.947758886572398e-13, 0.0], [0.035000000000203056, 4.605706369726613e-13, 0.0], [0.04000000000023206, 5.263629190331794e-13, 0.0], [0.045000000000261074, 5.92162599858408e-13, 0.0]  …  [0.33333333333526716, 0.3333333333379791, 0.16071428571428567], [0.33333333333526716, 0.3333333333379791, 0.14285714285714282], [0.33333333333526716, 0.3333333333379791, 0.12499999999999999], [0.33333333333526716, 0.3333333333379791, 0.10714285714285712], [0.33333333333526716, 0.3333333333379791, 0.08928571428571427], [0.33333333333526716, 0.3333333333379791, 0.07142857142857141], [0.33333333333526716, 0.3333333333379791, 0.05357142857142856], [0.33333333333526716, 0.3333333333379791, 0.035714285714285705], [0.33333333333526716, 0.3333333333379791, 0.017857142857142853], [0.33333333333526716, 0.3333333333379791, 0.0]], [-1.7338620380961145 -1.733352297736404 … -1.5340278691134177 -1.5340278691134177; 1.3022711565325769 1.3013340306250996 … -0.74829651791201 -0.74829651791201; … ; 2.369793516023509 2.3708901597888237 … 1.7371881594655936 1.7371881594655936; 3.8685166620914186 3.8683976856377766 … 3.9179326229453713 3.9179326229453713])

and plot the band structure

P = plot_band_diff(kpi, E, E2)

Oh, no! The band interpolation is not working well 😰.

This is because we are using a very coarse kgrid! Rerun with a finer kgrid and look at the differences.

Wannierization of top valence band

Similarly, we can Wannierize only the top valence band, with PTG

model_top = Wannier.truncate(model, [7], [1])
lattice: Å
  a1:  3.19064  0.00000  0.00000
  a2: -1.59532  2.76318  0.00000
  a3:  0.00000  0.00000 10.00000

atoms: fractional
  Mo:  0.00000  0.00000  0.00000
   S:  0.33333  0.66667 -0.15620
   S:  0.33333  0.66667  0.15620

n_bands: 1
n_wann : 1
kgrid  : 3 3 1
n_kpts : 9
n_bvecs: 8

b-vectors:
         [bx, by, bz] / Å⁻¹                weight
  1       0.00000    0.00000   -0.62832    1.26651
  2       0.00000    0.00000    0.62832    1.26651
  3      -0.65642   -0.37898    0.00000    0.58020
  4       0.65642    0.37898    0.00000    0.58020
  5       0.00000   -0.75797    0.00000    0.58020
  6       0.00000    0.75797    0.00000    0.58020
  7       0.65642   -0.37898    0.00000    0.58020
  8      -0.65642    0.37898    0.00000    0.58020

note the [1] specifies which WF to be kept, but this does not matter since we won't use the gauge from the previous model.U. We use this [1] to specify that we only need 1 WF.

The initial spread is

omega(model_top)
  WF     center [rx, ry, rz]/Š             spread/Ų
   1     0.00000    -1.22808     0.00000     5.98101
Sum spread: Ω = ΩI + Ω̃, Ω̃ = ΩOD + ΩD
   ΩI  =     3.61299
   Ω̃   =     2.36802
   ΩOD =     0.00000
   ΩD  =     2.36802
   Ω   =     5.98101

with PTG,

U_top, _ = parallel_transport(model_top)
omega(model_top, U_top)
  WF     center [rx, ry, rz]/Š             spread/Ų
   1    -1.59532     0.92106     0.00000     5.79869
Sum spread: Ω = ΩI + Ω̃, Ω̃ = ΩOD + ΩD
   ΩI  =     3.61299
   Ω̃   =     2.18570
   ΩOD =     0.00000
   ΩD  =     2.18570
   Ω   =     5.79869

In the single-band case, there is no need to run optimal rotation. But we can still run maximal localization,

model_top.U .= U_top;
U_top2 = max_localize(model_top)
omega(model_top, U_top2)
  WF     center [rx, ry, rz]/Š             spread/Ų
   1    -1.59532     0.92106     0.00000     4.41611
Sum spread: Ω = ΩI + Ω̃, Ω̃ = ΩOD + ΩD
   ΩI  =     3.61299
   Ω̃   =     0.80312
   ΩOD =     0.00000
   ΩD  =     0.80312
   Ω   =     4.41611

and band interpolation

interp_model_top = Wannier.InterpModel(model_top)
kpi3, E3 = interpolate(interp_model_top)
(StaticArraysCore.SVector{3, Float64}[[0.0, 0.0, 0.0], [0.005000000000029007, 6.579536487914742e-14, 0.0], [0.010000000000058015, 1.3159072975829484e-13, 0.0], [0.015000000000087022, 1.973879443286199e-13, 0.0], [0.02000000000011603, 2.631814595165897e-13, 0.0], [0.025000000000145038, 3.2897867408691475e-13, 0.0], [0.030000000000174044, 3.947758886572398e-13, 0.0], [0.035000000000203056, 4.605706369726613e-13, 0.0], [0.04000000000023206, 5.263629190331794e-13, 0.0], [0.045000000000261074, 5.92162599858408e-13, 0.0]  …  [0.33333333333526716, 0.3333333333379791, 0.16071428571428567], [0.33333333333526716, 0.3333333333379791, 0.14285714285714282], [0.33333333333526716, 0.3333333333379791, 0.12499999999999999], [0.33333333333526716, 0.3333333333379791, 0.10714285714285712], [0.33333333333526716, 0.3333333333379791, 0.08928571428571427], [0.33333333333526716, 0.3333333333379791, 0.07142857142857141], [0.33333333333526716, 0.3333333333379791, 0.05357142857142856], [0.33333333333526716, 0.3333333333379791, 0.035714285714285705], [0.33333333333526716, 0.3333333333379791, 0.017857142857142853], [0.33333333333526716, 0.3333333333379791, 0.0]], [3.868516729125978 3.8678853840306235 … 3.9179326031485107 3.9179326031485107])

and compare

P = plot_band_diff(kpi, E, E3)

Again, rerun with a finer kgrid and see the improvements of interpolation quality. Also, you can try to plot the WFs, by first truncating the unk

Wannier.truncate_unk(".", [7], "truncate")
UNK00001.1
┌ Info: Reading unk file:
└   filename = "./UNK00001.1"
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 1
  n_bands = 11

[ Info: Written to file: truncate/UNK00001.1
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 1
  n_bands = 1

UNK00002.1
┌ Info: Reading unk file:
└   filename = "./UNK00002.1"
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 2
  n_bands = 11

[ Info: Written to file: truncate/UNK00002.1
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 2
  n_bands = 1

UNK00003.1
┌ Info: Reading unk file:
└   filename = "./UNK00003.1"
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 3
  n_bands = 11

[ Info: Written to file: truncate/UNK00003.1
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 3
  n_bands = 1

UNK00004.1
┌ Info: Reading unk file:
└   filename = "./UNK00004.1"
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 4
  n_bands = 11

[ Info: Written to file: truncate/UNK00004.1
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 4
  n_bands = 1

UNK00005.1
┌ Info: Reading unk file:
└   filename = "./UNK00005.1"
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 5
  n_bands = 11

[ Info: Written to file: truncate/UNK00005.1
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 5
  n_bands = 1

UNK00006.1
┌ Info: Reading unk file:
└   filename = "./UNK00006.1"
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 6
  n_bands = 11

[ Info: Written to file: truncate/UNK00006.1
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 6
  n_bands = 1

UNK00007.1
┌ Info: Reading unk file:
└   filename = "./UNK00007.1"
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 7
  n_bands = 11

[ Info: Written to file: truncate/UNK00007.1
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 7
  n_bands = 1

UNK00008.1
┌ Info: Reading unk file:
└   filename = "./UNK00008.1"
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 8
  n_bands = 11

[ Info: Written to file: truncate/UNK00008.1
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 8
  n_bands = 1

UNK00009.1
┌ Info: Reading unk file:
└   filename = "./UNK00009.1"
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 9
  n_bands = 11

[ Info: Written to file: truncate/UNK00009.1
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 9
  n_bands = 1

the new unks are stored in a subfolder truncate, now write the realspace WF

write_realspace_wf(
    "wjl", model_top; n_supercells=[3, 3, 2], unkdir="truncate"
)
┌ Info: Reading unk file:
└   filename = "truncate/UNK00001.1"
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 1
  n_bands = 1

┌ Info: Reading unk file:
└   filename = "truncate/UNK00002.1"
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 2
  n_bands = 1

┌ Info: Reading unk file:
└   filename = "truncate/UNK00003.1"
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 3
  n_bands = 1

┌ Info: Reading unk file:
└   filename = "truncate/UNK00004.1"
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 4
  n_bands = 1

┌ Info: Reading unk file:
└   filename = "truncate/UNK00005.1"
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 5
  n_bands = 1

┌ Info: Reading unk file:
└   filename = "truncate/UNK00006.1"
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 6
  n_bands = 1

┌ Info: Reading unk file:
└   filename = "truncate/UNK00007.1"
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 7
  n_bands = 1

┌ Info: Reading unk file:
└   filename = "truncate/UNK00008.1"
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 8
  n_bands = 1

┌ Info: Reading unk file:
└   filename = "truncate/UNK00009.1"
  n_gx    = 6
  n_gy    = 6
  n_gz    = 18
  ik      = 9
  n_bands = 1

Max Im/Re ratio of WF    1 =    21.1727
┌ Info: Writing xsf file:
└   filename = "wjl_00001.xsf"

and visualize with your favorite tool.

As a reference, here is the real space WFs visualized with [WannierPlots.jl].

First, load the plotting packages

using WGLMakie
set_theme!(; resolution=(800, 800))
using WannierPlots
Tip

Here we want to show the WFs in this web page, so we first load WGLMakie. When you use the WannierPlots package in REPL, you can first load GLMakie, then the WFs will be shown in a standalone window.

Read the 1st WF

xsf = read_xsf("wjl_00001.xsf");

Visualize with WannierPlots.jl,

pos = inv(xsf.primvec) * xsf.atom_positions  # to fractional coordinates
atom_numbers = parse.(Int, xsf.atoms)  # to integer atomic numbers
plot_wf(xsf.rgrid, xsf.W, xsf.primvec, pos, atom_numbers)

Now we have automated Wannierization of the valence manifold, and the top valence band of MoS2, without any initial projection!


This page was generated using Literate.jl.