Skip to content

Commit

Permalink
Merge pull request #22 from MineralsCloud:ReducedCoordinates
Browse files Browse the repository at this point in the history
Fix `similar_type` interface for `ReducedCoordinates`
  • Loading branch information
singularitti authored Oct 8, 2023
2 parents b4bfd2d + 31659de commit bec5efb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/cell.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using StaticArrays: FieldVector
using StaticArrays: FieldVector, Size
using StructEquality: @struct_hash_equal_isequal

import StaticArrays: similar_type

export ReducedCoordinates, CrystalCoordinates, Cell, natoms, atomtypes

struct ReducedCoordinates{T} <: FieldVector{3,T}
Expand Down Expand Up @@ -50,3 +52,7 @@ atomtypes(cell::Cell) = unique(cell.atoms)
Get the lattice of a `Cell`.
"""
Lattice(cell::Cell) = cell.lattice

# See https://juliaarrays.github.io/StaticArrays.jl/dev/pages/api/#StaticArraysCore.FieldVector
similar_type(::Type{<:ReducedCoordinates}, ::Type{T}, s::Size{(3,)}) where {T} =
ReducedCoordinates{T}

0 comments on commit bec5efb

Please sign in to comment.