hamiltonian_dealloc Subroutine

public subroutine hamiltonian_dealloc(ham_logical, ham_k, ham_r, wannier_centres_translated, irvec, ndegen, error, comm)

Uses

  • proc~~hamiltonian_dealloc~~UsesGraph proc~hamiltonian_dealloc hamiltonian_dealloc module~w90_wannier90_types w90_wannier90_types proc~hamiltonian_dealloc->module~w90_wannier90_types module~w90_constants w90_constants module~w90_wannier90_types->module~w90_constants

Deallocate module data

Arguments

Type IntentOptional Attributes Name
type(ham_logical_type), intent(inout) :: ham_logical
complex(kind=dp), intent(inout), allocatable :: ham_k(:,:,:)
complex(kind=dp), intent(inout), allocatable :: ham_r(:,:,:)
real(kind=dp), intent(inout), allocatable :: wannier_centres_translated(:,:)
integer, intent(inout), allocatable :: irvec(:,:)
integer, intent(inout), allocatable :: ndegen(:)
type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm

Calls

proc~~hamiltonian_dealloc~~CallsGraph proc~hamiltonian_dealloc hamiltonian_dealloc proc~set_error_dealloc set_error_dealloc proc~hamiltonian_dealloc->proc~set_error_dealloc proc~comms_sync_error comms_sync_error proc~set_error_dealloc->proc~comms_sync_error proc~set_base_error set_base_error proc~set_error_dealloc->proc~set_base_error

Source Code

  subroutine hamiltonian_dealloc(ham_logical, ham_k, ham_r, wannier_centres_translated, irvec, &
                                 ndegen, error, comm)
    !================================================!
    !
    !! Deallocate module data
    !
    !================================================!

    use w90_wannier90_types, only: ham_logical_type

    implicit none

    ! arguments
    type(ham_logical_type), intent(inout) :: ham_logical
    type(w90_error_type), allocatable, intent(out) :: error
    type(w90_comm_type), intent(in) :: comm

    integer, intent(inout), allocatable :: ndegen(:)
    integer, intent(inout), allocatable :: irvec(:, :)

    real(kind=dp), intent(inout), allocatable :: wannier_centres_translated(:, :)

    complex(kind=dp), intent(inout), allocatable :: ham_r(:, :, :)
    complex(kind=dp), allocatable, intent(inout) :: ham_k(:, :, :)

    ! local variables
    integer :: ierr

    if (allocated(ham_r)) then
      deallocate (ham_r, stat=ierr)
      if (ierr /= 0) then
        call set_error_dealloc(error, 'Error in deallocating ham_r in hamiltonian_dealloc', comm)
        return
      end if
    end if
    if (allocated(ham_k)) then
      deallocate (ham_k, stat=ierr)
      if (ierr /= 0) then
        call set_error_dealloc(error, 'Error in deallocating ham_k in hamiltonian_dealloc', comm)
        return
      end if
    end if
    if (allocated(irvec)) then
      deallocate (irvec, stat=ierr)
      if (ierr /= 0) then
        call set_error_dealloc(error, 'Error in deallocating irvec in hamiltonian_dealloc', comm)
        return
      end if
    end if
    if (allocated(ndegen)) then
      deallocate (ndegen, stat=ierr)
      if (ierr /= 0) then
        call set_error_dealloc(error, 'Error in deallocating ndegen in hamiltonian_dealloc', comm)
        return
      end if
    end if
    if (allocated(wannier_centres_translated)) then
      deallocate (wannier_centres_translated, stat=ierr)
      if (ierr /= 0) then
        call set_error_dealloc(error, 'Error in deallocating wannier_centres_translated in hamiltonian_dealloc', comm)
        return
      end if
    end if

    ham_logical%ham_have_setup = .false.
    ham_logical%have_translated = .false.
    ham_logical%use_translation = .false.
    ham_logical%have_ham_r = .false.
    ham_logical%have_ham_k = .false.
    !================================================!
  end subroutine hamiltonian_dealloc