@@ -48,12 +48,12 @@ function FullGridCellList(; min_corner, max_corner, search_radius = 0.0,
4848 # Pad domain to avoid 0 in cell indices due to rounding errors.
4949 # We can't just use `eps()`, as one might use lower precision types.
5050 # This padding is safe, and will give us one more layer of cells in the worst case.
51- min_corner = SVector (Tuple (min_corner .- 1e -3 * search_radius))
52- max_corner = SVector (Tuple (max_corner .+ 1e -3 * search_radius))
51+ min_corner = SVector (Tuple (min_corner .- 1.0f -3 * search_radius))
52+ max_corner = SVector (Tuple (max_corner .+ 1.0f -3 * search_radius))
5353
5454 if search_radius < eps ()
5555 # Create an empty "template" cell list to be used with `copy_cell_list`
56- cells = construct_backend (backend, 0 , 0 )
56+ cells = construct_backend (backend, 0 , max_points_per_cell )
5757 linear_indices = nothing
5858 else
5959 # Note that we don't shift everything so that the first cell starts at `min_corner`.
@@ -180,5 +180,15 @@ function copy_cell_list(cell_list::FullGridCellList, search_radius, periodic_box
180180 (; min_corner, max_corner) = cell_list
181181
182182 return FullGridCellList (; min_corner, max_corner, search_radius,
183- backend = typeof (cell_list. cells))
183+ backend = typeof (cell_list. cells),
184+ max_points_per_cell = max_points_per_cell (cell_list. cells))
185+ end
186+
187+ function max_points_per_cell (cells:: DynamicVectorOfVectors )
188+ return size (cells. backend, 1 )
189+ end
190+
191+ # Fallback when backend is a `Vector{Vector{T}}`
192+ function max_points_per_cell (cells)
193+ return 100
184194end
0 commit comments