diff --git a/src/geometry.F90 b/src/geometry.F90 index 70e4192e4..2d2ec9bae 100644 --- a/src/geometry.F90 +++ b/src/geometry.F90 @@ -199,7 +199,7 @@ contains p % coord % universe = c % fill ! Determine all distribcell offsets for this cell level - if (.not. allocated(p % coord % mapping)) then + if (.not. associated(p % coord % mapping)) then allocate(p % coord % mapping(n_maps)) end if do j = 1, n_maps @@ -264,7 +264,7 @@ contains ! Determine all distribcell offsets for this cell level if (lat % are_valid_indices(i_xyz)) then - if (.not. allocated(p % coord % mapping)) then + if (.not. associated(p % coord % mapping)) then allocate(p % coord % mapping(n_maps)) end if @@ -637,7 +637,7 @@ contains p % coord % universe = lat % universes(i_xyz(1), i_xyz(2), i_xyz(3)) ! Determine all distribcell offsets for this lattice cell - if (.not. allocated(p % coord % mapping)) then + if (.not. associated(p % coord % mapping)) then allocate(p % coord % mapping(n_maps)) end if do i = 1, n_maps diff --git a/src/particle_header.F90 b/src/particle_header.F90 index 8528f3112..3224d6346 100644 --- a/src/particle_header.F90 +++ b/src/particle_header.F90 @@ -28,7 +28,7 @@ module particle_header logical :: rotated = .false. ! Distributed Mapping Info - integer, allocatable :: mapping(:) + integer, pointer :: mapping(:) => null() ! Pointer to next (more local) set of coordinates type(LocalCoord), pointer :: next => null() @@ -105,7 +105,9 @@ contains if (associated(coord % next)) call deallocate_coord(coord%next) ! deallocate original coordinate - if (allocated(coord % mapping)) deallocate(coord % mapping) + if (associated(coord % mapping)) deallocate(coord % mapping) + + ! deallocate this coord deallocate(coord) end if diff --git a/src/tally.F90 b/src/tally.F90 index 4bc0b31a1..47502b5d4 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -1160,7 +1160,7 @@ contains coord => p % coord0 offset = 0 do while(associated(coord)) - if (allocated(coord % mapping)) then + if (associated(coord % mapping)) then offset = offset + coord % mapping(t % filters(i) % offset) end if if (t % filters(i) % int_bins(1) == coord % cell) then