w90_readwrite_read_final_alloc Subroutine

public subroutine w90_readwrite_read_final_alloc(disentanglement, dis_manifold, wannier_data, num_wann, num_bands, num_kpts, error, comm)

Uses

  • proc~~w90_readwrite_read_final_alloc~~UsesGraph proc~w90_readwrite_read_final_alloc w90_readwrite_read_final_alloc module~w90_error w90_error proc~w90_readwrite_read_final_alloc->module~w90_error module~w90_comms w90_comms module~w90_error->module~w90_comms module~w90_error_base w90_error_base module~w90_error->module~w90_error_base module~w90_comms->module~w90_error_base module~w90_constants w90_constants module~w90_comms->module~w90_constants

Arguments

Type IntentOptional Attributes Name
logical, intent(in) :: disentanglement
type(dis_manifold_type), intent(inout) :: dis_manifold
type(wannier_data_type), intent(inout) :: wannier_data
integer, intent(in) :: num_wann
integer, intent(in) :: num_bands
integer, intent(in) :: num_kpts
type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm

Calls

proc~~w90_readwrite_read_final_alloc~~CallsGraph proc~w90_readwrite_read_final_alloc w90_readwrite_read_final_alloc proc~set_error_alloc set_error_alloc proc~w90_readwrite_read_final_alloc->proc~set_error_alloc proc~comms_sync_error comms_sync_error proc~set_error_alloc->proc~comms_sync_error proc~set_base_error set_base_error proc~set_error_alloc->proc~set_base_error

Called by

proc~~w90_readwrite_read_final_alloc~~CalledByGraph proc~w90_readwrite_read_final_alloc w90_readwrite_read_final_alloc program~postw90 postw90 program~postw90->proc~w90_readwrite_read_final_alloc

Source Code

  subroutine w90_readwrite_read_final_alloc(disentanglement, dis_manifold, wannier_data, num_wann, &
                                            num_bands, num_kpts, error, comm)
    !================================================== !
    ! Some checks and initialisations !
    ! conditionally allocates:
    !   dis_manifold%lwindow(num_bands, num_kpts)
    !   dis_manifold%ndimwin(num_kpts)
    !   dis_manifold%nfirstwin(num_kpts)
    !   wannier_data%centres(3, num_wann)
    !   wannier_data%spreads(num_wann)
    !     small arrays... maybe overkill here?
    !
    !   this is currenty only called by the legacy library (Jun 23)
    !================================================== !
    use w90_error, only: w90_error_type, set_error_alloc
    implicit none
    logical, intent(in) :: disentanglement
    type(dis_manifold_type), intent(inout) :: dis_manifold
    type(wannier_data_type), intent(inout) :: wannier_data
    integer, intent(in) :: num_wann, num_bands, num_kpts
    type(w90_error_type), allocatable, intent(out) :: error
    type(w90_comm_type), intent(in) :: comm

    integer :: ierr

    if (disentanglement) then
      if (allocated(dis_manifold%ndimwin)) deallocate (dis_manifold%ndimwin)
      allocate (dis_manifold%ndimwin(num_kpts), stat=ierr)
      if (ierr /= 0) then
        call set_error_alloc(error, 'Error allocating ndimwin in w90_wannier90_read_final_alloc()', comm)
        return
      end if
      if (allocated(dis_manifold%nfirstwin)) deallocate (dis_manifold%nfirstwin)
      allocate (dis_manifold%nfirstwin(num_kpts), stat=ierr)
      if (ierr /= 0) then
        call set_error_alloc(error, 'Error allocating nfirstwin in w90_wannier90_read_final_alloc()', comm)
        return
      end if
      if (allocated(dis_manifold%lwindow)) deallocate (dis_manifold%lwindow)
      allocate (dis_manifold%lwindow(num_bands, num_kpts), stat=ierr)
      if (ierr /= 0) then
        call set_error_alloc(error, 'Error allocating lwindow in w90_wannier90_read_final_alloc()', comm)
        return
      end if
    end if

!    if ( wannier_plot .and. (index(wannier_plot_format,'cub').ne.0) ) then
!       cosa(1)=dot_product(real_lattice(1,:),real_lattice(2,:))
!       cosa(2)=dot_product(real_lattice(1,:),real_lattice(3,:))
!       cosa(3)=dot_product(real_lattice(2,:),real_lattice(3,:))
!       cosa = abs(cosa)
!       if (any(cosa.gt.eps6)) &
!            call io_error('Error: plotting in cube format requires orthogonal lattice vectors')
!    endif

    if (allocated(wannier_data%centres)) deallocate (wannier_data%centres)
    allocate (wannier_data%centres(3, num_wann), stat=ierr)
    if (ierr /= 0) then
      call set_error_alloc(error, 'Error allocating wannier_centres in w90_readwrite_read_final_alloc', comm)
      return
    end if
    wannier_data%centres = 0.0_dp
    if (allocated(wannier_data%spreads)) deallocate (wannier_data%spreads)
    allocate (wannier_data%spreads(num_wann), stat=ierr)
    if (ierr /= 0) then
      call set_error_alloc(error, 'Error in allocating wannier_spreads in w90_readwrite_read_final_alloc', comm)
      return
    end if
    wannier_data%spreads = 0.0_dp
  end subroutine w90_readwrite_read_final_alloc