From f66aa7c9068f85a578a025c4ea24e6aaccd643fc Mon Sep 17 00:00:00 2001 From: singularitti Date: Sat, 7 Oct 2023 02:15:30 -0400 Subject: [PATCH 1/2] Add StaticVectors.jl to deps --- Project.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Project.toml b/Project.toml index 6fa7b3c..5d8bb43 100644 --- a/Project.toml +++ b/Project.toml @@ -6,6 +6,7 @@ version = "0.3.2" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" +StaticVectors = "20fadf95-9e3d-483c-97cd-cab2760e7998" StructEquality = "6ec83bb0-ed9f-11e9-3b4c-2b04cb4e219c" [compat] From 92834f25b12dbf675859073f312d752086f6cfcd Mon Sep 17 00:00:00 2001 From: singularitti Date: Sat, 7 Oct 2023 02:16:09 -0400 Subject: [PATCH 2/2] Use `StaticVectors.Values` to replace `StaticArrays.SVector` in `Cell` `SVector` is very slow for large number of atoms --- src/cell.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cell.jl b/src/cell.jl index 965bd4e..a348cd1 100644 --- a/src/cell.jl +++ b/src/cell.jl @@ -1,4 +1,5 @@ using StaticArrays: SVector, FieldVector +using StaticVectors: Values using StructEquality: @struct_hash_equal_isequal export ReducedCoordinates, CrystalCoordinates, Cell, natoms, atomtypes @@ -13,8 +14,8 @@ const CrystalCoordinates = ReducedCoordinates abstract type AbstractCell end @struct_hash_equal_isequal struct Cell{N,L,P,T} <: AbstractCell lattice::Lattice{L} - positions::SVector{N,ReducedCoordinates{P}} - atoms::SVector{N,T} + positions::Values{N,ReducedCoordinates{P}} + atoms::Values{N,T} end """ Cell(lattice, positions, atoms)