subroutine dealloc(this)
class(core_space_t), intent(inout) :: this
character(*), parameter :: t_r = "core_space_t%dealloc"
integer :: ierr
call this%core_ht%dealloc()
if (allocated(this%indices_of_determ_states)) then
deallocate(this%indices_of_determ_states, stat=ierr)
call LogMemDealloc(t_r, this%IDetermTag, ierr)
end if
if (associated(this%core_space)) then
this%core_space => null()
call shared_deallocate_mpi(this%core_space_win, this%core_space_direct)
call LogMemDealloc(t_r, this%CoreSpaceTag, ierr)
end if
if (allocated(this%determ_sizes)) then
deallocate(this%determ_sizes, stat=ierr)
if (ierr /= 0) write(stdout, '("Error when deallocating determ_sizes:",1X,i8)') ierr
end if
if (allocated(this%determ_displs)) then
deallocate(this%determ_displs, stat=ierr)
if (ierr /= 0) write(stdout, '("Error when deallocating determ_displs:",1X,i8)') ierr
end if
if (allocated(this%determ_last)) then
deallocate(this%determ_last, stat=ierr)
if (ierr /= 0) write(stdout, '("Error when deallocating determ_last:",1X,i8)') ierr
end if
if (allocated(this%partial_determ_vecs)) then
deallocate(this%partial_determ_vecs, stat=ierr)
call LogMemDealloc(t_r, this%PDetermTag, ierr)
end if
if (allocated(this%full_determ_vecs)) then
deallocate(this%full_determ_vecs, stat=ierr)
call LogMemDealloc(t_r, this%FDetermTag, ierr)
end if
if (allocated(this%full_determ_vecs_av)) then
deallocate(this%full_determ_vecs_av, stat=ierr)
call LogMemDealloc(t_r, this%FDetermAvTag, ierr)
end if
call deallocate_sparse_ham(this%sparse_core_ham, this%SparseCoreHamilTags)
call deallocate_sparse_matrix_int(this%core_connections)
if (allocated(this%core_ham_diag)) then
deallocate(this%core_ham_diag, stat=ierr)
end if
end subroutine dealloc