sitesym_read Subroutine

public subroutine sitesym_read(sitesym, num_bands, num_kpts, num_wann, seedname, error, comm)

Uses

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

Arguments

Type IntentOptional Attributes Name
type(sitesym_type), intent(inout) :: sitesym
integer, intent(in) :: num_bands
integer, intent(in) :: num_kpts
integer, intent(in) :: num_wann
character(len=*), intent(in) :: seedname
type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm

Calls

proc~~sitesym_read~~CallsGraph proc~sitesym_read sitesym_read proc~set_error_alloc set_error_alloc proc~sitesym_read->proc~set_error_alloc proc~set_error_file set_error_file proc~sitesym_read->proc~set_error_file 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 proc~set_error_file->proc~comms_sync_error proc~set_error_file->proc~set_base_error

Called by

proc~~sitesym_read~~CalledByGraph proc~sitesym_read sitesym_read program~wannier wannier program~wannier->proc~sitesym_read

Source Code

  subroutine sitesym_read(sitesym, num_bands, num_kpts, num_wann, seedname, error, comm)
    !================================================!

    use w90_wannier90_types, only: sitesym_type

    implicit none

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

    integer, intent(in) :: num_bands
    integer, intent(in) :: num_wann
    integer, intent(in) :: num_kpts
    character(len=*), intent(in)  :: seedname

    ! local variables
    integer :: iu, ibnum, iknum, ierr

    open (newunit=iu, file=trim(seedname)//".dmn", form='formatted', status='old', action='read')
    read (iu, *)
    read (iu, *) ibnum, sitesym%nsymmetry, sitesym%nkptirr, iknum
    if (ibnum .ne. num_bands) then
      call set_error_file(error, "Error: Number of bands is not correct (sitesym_read)", comm)
      return
    end if
    if (iknum .ne. num_kpts) then
      call set_error_file(error, "Error: Number of k-points is not correct (sitesym_read)", comm)
      return
    end if

    allocate (sitesym%ik2ir(num_kpts), stat=ierr)
    if (ierr /= 0) then
      call set_error_alloc(error, 'Error in allocating sitesym%ik2ir in sitesym_read', comm)
      return
    end if
    allocate (sitesym%ir2ik(sitesym%nkptirr), stat=ierr)
    if (ierr /= 0) then
      call set_error_alloc(error, 'Error in allocating sitesym%ir2ik in sitesym_read', comm)
      return
    end if
    allocate (sitesym%kptsym(sitesym%nsymmetry, sitesym%nkptirr), stat=ierr)
    if (ierr /= 0) then
      call set_error_alloc(error, 'Error in allocating sitesym%kptsym in sitesym_read', comm)
      return
    end if
    allocate (sitesym%d_matrix_band(num_bands, num_bands, sitesym%nsymmetry, sitesym%nkptirr), stat=ierr)
    if (ierr /= 0) then
      call set_error_alloc(error, 'Error in allocating sitesym%d_matrix_band in sitesym_read', comm)
      return
    end if
    allocate (sitesym%d_matrix_wann(num_wann, num_wann, sitesym%nsymmetry, sitesym%nkptirr), stat=ierr)
    if (ierr /= 0) then
      call set_error_alloc(error, 'Error in allocating sitesym%d_matrix_wann in sitesym_read', comm)
      return
    end if

    read (iu, *) sitesym%ik2ir
    read (iu, *) sitesym%ir2ik
    read (iu, *) sitesym%kptsym
    read (iu, *) sitesym%d_matrix_wann
    read (iu, *) sitesym%d_matrix_band
    close (iu)

    return
  end subroutine sitesym_read