read_response_from_file_local Subroutine

public subroutine read_response_from_file_local(fieldmat, could_read, suffix)

Routine to read the current response matrix data from file dump. One file per connected domain. Each written by the head of the supercell. NOTE: Have to have setup communicators etc.

Arguments

Type IntentOptional Attributes Name
class(fieldmat_type), intent(inout) :: fieldmat
logical, intent(out) :: could_read

Flag to indicate if all files successfully read

character(len=*), intent(in), optional :: suffix

If passed then use as part of file suffix


Contents


Source Code

  subroutine read_response_from_file_local(fieldmat, could_read, suffix)
    implicit none
    class(fieldmat_type), intent(in out) :: fieldmat
    !> Flag to indicate if all files successfully read
    logical, intent(out) :: could_read
    !> If passed then use as part of file suffix
    character(len=*), optional, intent(in) :: suffix
    integer :: ik, is

    could_read = .true.

    !First we have to pull data so that head of each supercell has full data
    !Currently we are lazy and just ensure all procs in supercell has full data
    do ik=1,fieldmat%naky
       !If ik isn't local than cycle
       if(.not.fieldmat%kyb(ik)%is_local) cycle

       !Loop over supercells
       do is=1,fieldmat%kyb(ik)%nsupercell
          !If is isn't local than cycle
          if (.not.fieldmat%kyb(ik)%supercells(is)%is_local) cycle

          call fieldmat%kyb(ik)%supercells(is)%read_from_file(could_read = could_read, suffix = suffix)
          ! If we failed to read this file then leave immediately
          if (.not. could_read) return
       end do
    end do
  end subroutine read_response_from_file_local