Skip to content

Commit

Permalink
Add checks in ReciprocalPath constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
singularitti committed Nov 1, 2023
1 parent e2a5105 commit 467ae27
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/reciprocal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,15 @@ struct ReciprocalPath{T}
start_node::ReducedCoordinates{T}
end_node::ReducedCoordinates{T}
density::Int64
function ReciprocalPath{T}(start_node, end_node, density) where {T}
if density < 2
throw(ArgumentError("you need at least two points to define a path!"))
end
return new(start_node, end_node, density)
end
end
ReciprocalPath(start_node, end_node, density) =
ReciprocalPath{Base.promote_eltype(start_node, end_node)}(start_node, end_node, density)
function ReciprocalPath(bz::BrillouinZone, start_node::Symbol, end_node::Symbol, density)
points = specialpoints(bz)
return ReciprocalPath(points[start_node], points[end_node], density)
Expand Down

0 comments on commit 467ae27

Please sign in to comment.