kmesh_dealloc Subroutine

public subroutine kmesh_dealloc()

Uses

  • proc~~kmesh_dealloc~~UsesGraph proc~kmesh_dealloc kmesh_dealloc module~w90_io w90_io proc~kmesh_dealloc->module~w90_io module~w90_constants w90_constants module~w90_io->module~w90_constants

Release memory from the kmesh module

Arguments

None

Called by

proc~~kmesh_dealloc~~CalledByGraph proc~kmesh_dealloc kmesh_dealloc program~wannier wannier program~wannier->proc~kmesh_dealloc proc~wannier_run wannier_run proc~wannier_run->proc~kmesh_dealloc proc~wannier_setup wannier_setup proc~wannier_setup->proc~kmesh_dealloc

Contents

Source Code


Source Code

  subroutine kmesh_dealloc()
    !========================================
    !
    !!  Release memory from the kmesh module
    !   This routine now check to see if arrays
    !   are allocated, as there are some code
    !   paths that will not allocate on all nodes
    !========================================
    use w90_io, only: io_error
    implicit none
    integer :: ierr

    ! Deallocate real arrays that are public
    if (allocated(bk)) then
      deallocate (bk, stat=ierr)
      if (ierr /= 0) call io_error('Error in deallocating bk in kmesh_dealloc')
    endif
    if (allocated(bka)) then
      deallocate (bka, stat=ierr)
      if (ierr /= 0) call io_error('Error in deallocating bka in kmesh_dealloc')
    endif
    if (allocated(wb)) then
      deallocate (wb, stat=ierr)
      if (ierr /= 0) call io_error('Error in deallocating wb in kmesh_dealloc')
    end if

    ! Deallocate integer arrays that are public
    if (allocated(neigh)) then
      deallocate (neigh, stat=ierr)
      if (ierr /= 0) call io_error('Error in deallocating neigh in kmesh_dealloc')
    end if
    if (allocated(nncell)) then
      deallocate (nncell, stat=ierr)
      if (ierr /= 0) call io_error('Error in deallocating nncell in kmesh_dealloc')
    endif
    if (allocated(nnlist)) then
      deallocate (nnlist, stat=ierr)
      if (ierr /= 0) call io_error('Error in deallocating nnlist in kmesh_dealloc')
    endif

    return

  end subroutine kmesh_dealloc