Skip to content

Commit

Permalink
fixes after merge
Browse files Browse the repository at this point in the history
- fixes a few real bugs from merge, but mainly avoids a set of pointless differences with master branch
  • Loading branch information
thchr committed Oct 18, 2024
1 parent d26fd73 commit f21aa83
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 29 deletions.
4 changes: 3 additions & 1 deletion BandGraphs/src/BandGraphs.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module BandGraphs

using Crystalline
using Crystalline: irdim
import JLD2
using PrettyTables
using LinearAlgebra
Expand Down Expand Up @@ -31,7 +32,8 @@ export
permute_subgraphs,
subduction_tables,
plot_flattened_bandgraph,
findall_separable_vertices
findall_separable_vertices,
complete_split

# ---------------------------------------------------------------------------------------- #

Expand Down
3 changes: 0 additions & 3 deletions BandGraphs/src/complete-split.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using Crystalline: irdim
using BandGraphs: SubGraphPermutations, BandGraphPermutations, assemble_simple_graph

"""
complete_split(bandg::BandGraph, v::Tuple{String, Int})
Expand Down
2 changes: 1 addition & 1 deletion BandGraphs/test/seperable-irreps-testbed.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ separable_degree = 2

sgnums = 1:MAX_SGNUM[D]
contendersd = Dictionary{Int, Vector{SymVector{D}}}()
lgirsdd = Dictionary{Int, Dict{String, Crystalline.IrrepCollection{LGIrrep{D}}}}()
lgirsdd = Dictionary{Int, Dict{String, Collection{LGIrrep{D}}}}()
subtsd = Dictionary{Int, Vector{SubductionTable{D}}}()
for sgnum in sgnums
lgirsd = lgirreps(sgnum, D)
Expand Down
2 changes: 1 addition & 1 deletion BandGraphs/test/splittable-2d-irreps-in-planegroups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ timereversal = false
criterion = (lgir) -> irdim(lgir) == 2

contenders = Vector{Pair{Int, SymVector{D}}}()
lgirsdd = Dict{Int, Dict{String, Crystalline.IrrepCollection{LGIrrep{D}}}}()
lgirsdd = Dict{Int, Dict{String, Collection{LGIrrep{D}}}}()
subtsd = Dict{Int, Vector{SubductionTable{D}}}()
for sgnum in 1:MAX_SGNUM[D]
#sgnum ∈ (4) && continue # TODO: generalize to handle disconnected partitions, but #4 is not separable anyway
Expand Down
3 changes: 0 additions & 3 deletions BandGraphs/test/test-split.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ using GraphMakie
using MetaGraphsNext
using GLMakie

## --------------------------------------------------------------------------------------- #
include(joinpath((@__DIR__), "..", "src", "complete-split.jl"))

## --------------------------------------------------------------------------------------- #

D = 2
Expand Down
3 changes: 2 additions & 1 deletion Bravais/src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ for (T, space_type) in zip((:DirectBasis, :ReciprocalBasis), ("direct", "recipro
$($T){D} <: AbstractBasis{D}
A wrapper type over `D` distinct `D`-dimensional vectors (given as a
`SVector{D, SVector{D,Float64}}`), defining a lattice basis in $($space_type)
`SVector{D, SVector{D, Float64}}`), defining a lattice basis in $($space_type)
space.
"""
struct $T{D} <: AbstractBasis{D, Float64}
Expand Down Expand Up @@ -144,6 +144,7 @@ for (PT, BT, space_type) in zip((:DirectPoint, :ReciprocalPoint),
@eval $PT(v::Real...) = $PT{length(v)}(v)
end
end

# arithmetic
Base.:+(v::T, w::T) where T<:AbstractPoint = T(v.v + w.v)
Base.:-(v::T, w::T) where T<:AbstractPoint = T(v.v - w.v)
Expand Down
2 changes: 1 addition & 1 deletion build/ParseIsotropy.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module ParseIsotropy

using Crystalline
using Crystalline: AbstractIrrep, IrrepCollection
using Crystalline: AbstractIrrep

export parselittlegroupirreps

Expand Down
4 changes: 2 additions & 2 deletions src/compatibility.jl
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ function remap_lgirreps_to_point_in_kstar(
) where D

kv = position(first(lgirs))
kv′ == kv && return IrrepCollection(lgirs)
kv′ == kv && return Collection(lgirs)

# feasibility checks
if freeparams(kv) != freeparams(kv′)
Expand Down Expand Up @@ -273,5 +273,5 @@ function remap_lgirreps_to_point_in_kstar(
lg′.operations[i] = lg′_reduced[i]
end

return IrrepCollection(lgirs′)
return Collection(lgirs′)
end
2 changes: 1 addition & 1 deletion src/notation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ function seitz(op::SymOperation{D}) where D
if order > 2
x = rand(-1:1, SVector{3, Int})
while iszero(x×u) # check that generated 𝐱 is not parallel to 𝐮 (if it is, 𝐱×𝐮 = 0)
x = rand(-1:1, SVector{3, Int})
x = rand(-1:1, SVector{3, Int})
iszero(u) && error("rotation axis has zero norm; input is likely invalid")
end
Z = hcat(u, x, detW*(W*x))
Expand Down
5 changes: 3 additions & 2 deletions src/pointgroup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ function find_isomorphic_parent_pointgroup(g::AbstractVector{SymOperation{D}}) w
Iᵖ²ᵍ = invpermute!(permute!(Iᵖ, permᵖ²ᵍ), Iᵍ) # Iᵖ[permᵖ²ᵍ][invperm(Iᵍ)], but faster
invpermute!(permute!(pg.operations, permᵖ²ᵍ), Iᵍ) # sort `pg` to match `g`

return pg, Iᵖ²ᵍ, true
end
return pg, Iᵖ²ᵍ, true
end

# --------------------------------------------------------------------------------------
# if there is a rotation order with only one element, which is not simply the identity,
Expand Down Expand Up @@ -513,6 +513,7 @@ function rigorous_isomorphism_search(I_orders::AbstractVector{<:AbstractVector{I
end
return nothing # failed to find an isomorphism (because there wasn't any!)
end

function rotation_order_and_sense(op::SymOperation{D}) where D
r = rotation_order(op)
D == 1 && return (r, 0) # no "rotation sense" in 1D; `0` as sentinel
Expand Down
10 changes: 5 additions & 5 deletions src/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ function show(io::IO, ::MIME"text/plain", brs::BandRepSet)
# print k-vec labels
print(io, " KVecs: ")
join(io, klabels(brs), ", ")
end
end

# ---------------------------------------------------------------------------------------- #
# SymmetryVector
Expand Down Expand Up @@ -605,7 +605,7 @@ function Base.show(io :: IO, ::MIME"text/plain", brs :: Collection{<:NewBandRep}
# TODO: Would be nice to highlight the `row_labels` in a style matching the contents,
# but not possible atm (https://github.com/ronisbr/PrettyTables.jl/issues/122)
)
end
end

# ---------------------------------------------------------------------------------------- #
# CompositeBandRep
Expand All @@ -618,7 +618,7 @@ function Base.show(io::IO, cbr::CompositeBandRep{D}) where D
if first
first = false
c < 0 && print(io, "-")
else
else
print(io, " ", Crystalline.signaschar(c), " ")
end
if !isone(absc)
Expand All @@ -631,11 +631,11 @@ function Base.show(io::IO, cbr::CompositeBandRep{D}) where D
print(io, cbr.brs[j])
end
first && print(io, "0")
end
end

function Base.show(io::IO, ::MIME"text/plain", cbr::CompositeBandRep{D}) where D
println(io, length(irreplabels(cbr)), "-irrep ", typeof(cbr), ":")
print(io, " ")
print(io, " ")
show(io, cbr)
μ = occupation(cbr)
printstyled(io, " (", μ, " band", abs(μ) 1 ? "s" : "", ")", color=:light_black)
Expand Down
2 changes: 1 addition & 1 deletion src/symops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ end

"""
_findsubgroup(opsᴳ::T, opsᴴ::T′[, cntr]) where T⁽′⁾<:AbstractVector{SymOperation}
--> Tuple{Bool, Vector{Int}}
--> Tuple{Bool, Vector{Int}}
Returns a 2-tuple with elements:
Expand Down
2 changes: 1 addition & 1 deletion src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ translation(m::SMatrix{D,Dp1,<:Real}) where {D,Dp1} = m[:,Dp1] # not strictly
function (==)(op1::SymOperation{D}, op2::SymOperation{D}) where D
return op1.rotation == op2.rotation && translation(op1) == translation(op2)
end
function Base.Base.isapprox(op1::SymOperation{D}, op2::SymOperation{D},
function Base.isapprox(op1::SymOperation{D}, op2::SymOperation{D},
cntr::Union{Nothing,Char}=nothing, modw::Bool=true;
kws...) where D

Expand Down
12 changes: 6 additions & 6 deletions test/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ test_tp_show(v, observed::AbstractString) = test_show(repr(MIME"text/plain"(), v
Rs = DirectBasis([1,0,0], [0,1,0], [0,0,1]) # cubic
str = """
DirectBasis{3} (cubic):
[1.0, 0.0, 0.0]
[0.0, 1.0, 0.0]
[0.0, 0.0, 1.0]"""
[1.0, 0.0, 0.0]
[0.0, 1.0, 0.0]
[0.0, 0.0, 1.0]"""
test_tp_show(Rs, str)

Rs = DirectBasis([1,0,0], [-0.5, (3)/2, 0.0], [0, 0, 1.5]) # hexagonal
str = """
DirectBasis{3} (hexagonal):
[1.0, 0.0, 0.0]
[-0.5, 0.8660254037844386, 0.0]
[0.0, 0.0, 1.5]"""
[1.0, 0.0, 0.0]
[-0.5, 0.8660254037844386, 0.0]
[0.0, 0.0, 1.5]"""
test_tp_show(Rs, str)
Rs′ = directbasis(183, Val(3))
@test Rs[1] Rs′[1] && Rs[2] Rs′[2]
Expand Down

0 comments on commit f21aa83

Please sign in to comment.