subroutine clean_overlap_states() implicit none integer :: i, ierr if (allocated(overlap_states)) then do i = 1, gf_count if (allocated(overlap_states(i)%dets)) deallocate(overlap_states(i)%dets, stat=ierr) end do deallocate(overlap_states, stat=ierr) end if end subroutine clean_overlap_states