overlap_dealloc Subroutine

public subroutine overlap_dealloc()

Uses

  • proc~~overlap_dealloc~~UsesGraph proc~overlap_dealloc overlap_dealloc module~w90_parameters w90_parameters proc~overlap_dealloc->module~w90_parameters module~w90_io w90_io proc~overlap_dealloc->module~w90_io module~w90_parameters->module~w90_io module~w90_constants w90_constants module~w90_parameters->module~w90_constants module~w90_io->module~w90_constants

Dellocate memory

Arguments

None

Called by

proc~~overlap_dealloc~~CalledByGraph proc~overlap_dealloc overlap_dealloc program~wannier wannier program~wannier->proc~overlap_dealloc proc~wannier_run wannier_run proc~wannier_run->proc~overlap_dealloc

Contents

Source Code


Source Code

  subroutine overlap_dealloc()
    !%%%%%%%%%%%%%%%%%%%%%
    !! Dellocate memory

    use w90_parameters, only: u_matrix, m_matrix, m_matrix_orig, &
      a_matrix, u_matrix_opt, &
      m_matrix_local, m_matrix_orig_local
    use w90_io, only: io_error

    implicit none

    integer :: ierr

    if (allocated(u_matrix_opt)) then
      deallocate (u_matrix_opt, stat=ierr)
      if (ierr /= 0) call io_error('Error deallocating u_matrix_opt in overlap_dealloc')
    end if
    if (allocated(a_matrix)) then
      deallocate (a_matrix, stat=ierr)
      if (ierr /= 0) call io_error('Error deallocating a_matrix in overlap_dealloc')
    end if
    if (on_root) then
    if (allocated(m_matrix_orig)) then
      deallocate (m_matrix_orig, stat=ierr)
      if (ierr /= 0) call io_error('Error deallocating m_matrix_orig in overlap_dealloc')
    endif
    endif
    if (allocated(m_matrix_orig_local)) then
      deallocate (m_matrix_orig_local, stat=ierr)
      if (ierr /= 0) call io_error('Error deallocating m_matrix_orig_local in overlap_dealloc')
    endif
!~![ysl-b]
!~    if (allocated( ph_g)) then
!~       deallocate( ph_g, stat=ierr )
!~       if (ierr/=0) call io_error('Error deallocating ph_g in overlap_dealloc')
!~    endif
!~![ysl-e]

!    if (on_root) then
!    deallocate ( m_matrix, stat=ierr )
!    if (ierr/=0) call io_error('Error deallocating m_matrix in overlap_dealloc')
!    endif
!    deallocate ( m_matrix_local, stat=ierr )
!    if (ierr/=0) call io_error('Error deallocating m_matrix_local in overlap_dealloc')
!    deallocate ( u_matrix, stat=ierr )
!    if (ierr/=0) call io_error('Error deallocating u_matrix in overlap_dealloc')
    if (on_root) then
      if (allocated(m_matrix)) then
        deallocate (m_matrix, stat=ierr)
        if (ierr /= 0) call io_error('Error deallocating m_matrix in overlap_dealloc')
      endif
    endif
    if (allocated(m_matrix_local)) then
      deallocate (m_matrix_local, stat=ierr)
      if (ierr /= 0) call io_error('Error deallocating m_matrix_local in overlap_dealloc')
    endif
    if (allocated(u_matrix)) then
      deallocate (u_matrix, stat=ierr)
      if (ierr /= 0) call io_error('Error deallocating u_matrix in overlap_dealloc')
    endif

    return

  end subroutine overlap_dealloc