Skip to content

Commit 19ef4dc

Browse files
committed
Allow Cell.magmoms to be nothing by default
See #91 (comment)
1 parent b3e8601 commit 19ef4dc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/model.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ struct Cell{L,P,T,M}
2020
lattice::MMatrix{3,3,L,9}
2121
positions::Vector{MVector{3,P}}
2222
types::Vector{T}
23-
magmoms::Vector{M}
23+
magmoms::M
2424
end
25-
function Cell(lattice, positions, types, magmoms = zeros(length(types)))
25+
function Cell(lattice, positions, types, magmoms = nothing)
2626
if !(lattice isa AbstractMatrix)
2727
lattice = reduce(hcat, lattice) # Use `reduce` can make it type stable
2828
end
@@ -42,7 +42,7 @@ function Cell(lattice, positions, types, magmoms = zeros(length(types)))
4242
P = eltype(Base.promote_typeof(positions...))
4343
positions = collect(map(MVector{3,P}, positions))
4444
end
45-
L, T, M = eltype(lattice), eltype(types), eltype(magmoms)
45+
L, T, M = eltype(lattice), eltype(types), typeof(magmoms)
4646
return Cell{L,P,T,M}(lattice, positions, types, magmoms)
4747
end
4848

0 commit comments

Comments
 (0)