Skip to content

Commit

Permalink
Fix Inverted from v0.6.1 to src/transform.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
singularitti committed Nov 19, 2023
1 parent 10406ef commit 68daa08
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/CrystallographyCore.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ include("lattice.jl")
include("reciprocal.jl")
include("cell.jl")
include("eachatom.jl")
include("transform.jl")
include("show.jl")

end
10 changes: 10 additions & 0 deletions src/transform.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
struct Inverted{T<:AbstractLattice}
lattice::T
end

Base.inv(lattice::AbstractLattice) = Inverted(lattice)
Base.inv(inverted::Inverted) = inverted.lattice

(inverted::Inverted)(cartesian::AbstractVector) = parent(inverted.lattice) \ cartesian

(lattice::AbstractLattice)(reduced::AbstractVector) = parent(lattice) * reduced

0 comments on commit 68daa08

Please sign in to comment.