-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve algebra and show implementation for
(Abstract)SymmetryVector
s
- Loading branch information
Showing
4 changed files
with
39 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Test | ||
using Crystalline | ||
|
||
@testset "(Abstract)SymmetryVectors" begin | ||
brs = calc_bandreps(221) # ::Collection{NewBandRep{3}} | ||
|
||
# addition of symmetry vectors | ||
@test brs[1] + brs[2] == SymmetryVector(brs[1]) + SymmetryVector(brs[2]) | ||
@test Vector(brs[1] + brs[2]) == Vector(brs[1]) + Vector(brs[2]) | ||
|
||
# multiplication of symmetry vectors | ||
@test brs[1] + brs[1] == 2brs[1] | ||
@test -brs[1] == 2brs[1] - 3brs[1] | ||
@test zero(brs[1]) == 0*brs[1] | ||
@test brs[3]*7 == 7*brs[3] | ||
|
||
# type-stable summation | ||
@test sum(brs[1:1]) isa SymmetryVector{3} | ||
@test sum(brs[1:2]) isa SymmetryVector{3} | ||
|
||
# printing SymmetryVector that have zero-contents | ||
n = SymmetryVector(brs[1]) | ||
@test n*0 == zero(n) | ||
@test string(n) == "[0Mᵢ, 0Xᵢ, 0Γᵢ, 0Rᵢ] (0 bands)" | ||
end # @testset "(Abstract)SymmetryVectors" |