@@ -4,6 +4,43 @@ using SymmetricTightBinding
44using Crystalline
55using Crystalline: free
66
7+ # ---------------------------------------------------------------------------------------- #
8+
9+ @testset " Symmetry analysis (documentation example)" begin
10+ # Example 1
11+ sgnum = 17 # plane group p6mm
12+ brs = calc_bandreps (sgnum, Val (2 )) # band representations
13+ cbr = @composite brs[5 ] # (2b|A₁) EBR
14+ tbm = tb_hamiltonian (cbr) # tight-binding model (nearest neigbors)
15+ ptbm = tbm ([0 , 1 ]) # zero self-energy, nonzero nearest-neighbor hopping
16+ ns = collect_compatible (ptbm)
17+ @test only (ns) == SymmetryVector (cbr) == SymmetryVector (CompositeBandRep (ptbm))
18+
19+ # Example 2
20+ cbr′ = @composite brs[3 ] + brs[5 ] # (2a|A₁) + (3c|B₂)
21+ tbm′ = tb_hamiltonian (cbr′)
22+ ptbm′ = tbm′ ([2.5 , 0 , 0.2 , 0 , - 1 , 0 ])
23+ ns′ = collect_compatible (ptbm′)
24+ @test length (ns′) == 1 # bands are overlapping and not separable
25+ @test only (ns′) == SymmetryVector (cbr′)
26+
27+ ptbm′′ = tbm′ ([2.5 , 0 , 0.2 , 0 , - 1 , .5 ]) # turn on hybridization and split bands
28+ ns′′ = collect_compatible (ptbm′′)
29+ @test length (ns′′) == 2 # bands are overlapping and not separable
30+ @test ns′′[1 ] ∉ brs[[3 , 5 ]]
31+ @test ns′′[2 ] ∉ brs[[3 , 5 ]]
32+ @test sum (ns′′) == SymmetryVector (cbr′)
33+ end
34+
35+ # ---------------------------------------------------------------------------------------- #
36+
37+ # Construct a tb-model for every EBR and verify that `collect_compatible` returns a set of
38+ # symmetry vectors whose sum is equal to the underlying EBR's: note that we cannot generally
39+ # require that `collect_compatible` returns a _single_ symmetry vector equaling the EBR's
40+ # symmetry vector, since the EBR might be decomposable (either into fragile or genuinely
41+ # topological EBRs): i.e., we don't know if the model is a single connected band or not,
42+ # only what the "sum" of symmetry vectors will be.
43+
744function _test_symmetry_analysis (brs, i, αβγ; rng_seed= 1234 )
845 coefs = zeros (length (brs))
946 coefs[i] = 1
@@ -17,12 +54,6 @@ function _test_symmetry_analysis(brs, i, αβγ; rng_seed=1234)
1754end
1855
1956@testset " Symmetry analysis (full scan over EBRs)" begin
20- # construct a tb-model for every EBR and verify that `collect_compatible` returns a set
21- # of symmetry vectors whose sum is equal to the underlying EBR's: note that we cannot
22- # generally require that `collect_compatible` returns a _single_ symmetry vector
23- # equaling the EBR's symmetry vector, since the EBR might be decomposable (either into
24- # fragile or genuinely topological EBRs): i.e., we don't know if the model is a single
25- # connected band or not, only what the "sum" of symmetry vectors will be
2657 for D in 1 : 3
2758 αβγ = D == 1 ? [.1 ] : D == 2 ? [.1 , .2 ] : [.1 , .2 , .3 ] # for `pin_free!`
2859 for sgnum in MAX_SGNUM[D]
0 commit comments