Use allocatable for temporary arrays

When making neighbors, the previous maximum number of neighbors is set to 64,
which can be too small in some cases, which causes problems.