From 0927f2530065f91ebf951d1f44f5596fc14460c6 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 18 Nov 2015 07:57:06 -0600 Subject: [PATCH] Fix bug in reimplementation of neighbor_lists. --- src/geometry.F90 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/geometry.F90 b/src/geometry.F90 index 75165158bf..3f8b43d4cb 100644 --- a/src/geometry.F90 +++ b/src/geometry.F90 @@ -903,13 +903,17 @@ contains do i = 1, n_surfaces ! Copy positive neighbors to Surface instance j = neighbor_pos(i)%size() - allocate(surfaces(i)%obj%neighbor_pos(j)) - surfaces(i)%obj%neighbor_pos(:) = neighbor_pos(i)%data(1:j) + if (j > 0) then + allocate(surfaces(i)%obj%neighbor_pos(j)) + surfaces(i)%obj%neighbor_pos(:) = neighbor_pos(i)%data(1:j) + end if ! Copy negative neighbors to Surface instance j = neighbor_neg(i)%size() - allocate(surfaces(i)%obj%neighbor_neg(j)) - surfaces(i)%obj%neighbor_neg(:) = neighbor_neg(i)%data(1:j) + if (j > 0) then + allocate(surfaces(i)%obj%neighbor_neg(j)) + surfaces(i)%obj%neighbor_neg(:) = neighbor_neg(i)%data(1:j) + end if end do end subroutine neighbor_lists