anchor.diff:      implicit none
       type(photon),intent(in) :: p
       integer :: ic
  -    type(kdtree2_result) :: results(3)
  +    type(kdtree2_result) :: results(1)
       real(dp) :: point(3)
       if(debug) write(*,'(" [debug] find_cell")')
       ! TODO: nearest-neighbor algorithm - potentially going to be the
       ! bottleneck.
       point = [p%r%x, p%r%y, p%r%z]
  -    call kdtree2_n_nearest(geo%tree, point, 3, results)
  +    call kdtree2_n_nearest(geo%tree, point, 1, results)
       ic = results(1)%idx
       icell = new_grid_cell(ic, geo)
     end function find_cell
  
positive.code:     ! Find number of cells
      geo%n_cells = size(x)
      geo%n_masked = geo%n_cells
  
      print *,geo%n_cells
  
      ! Allocate cells
      allocate(geo%cells(geo%n_cells))
  
negative.code:           geo%mask_map(iv) = ic
         end if
      end do
  
      where(geo%volume < 0._dp) geo%volume = 0._dp
  
      geo%n_dim = 3
  