Read checkpoint file IMPORTANT! If you change the chkpt format, adapt accordingly also the w90chk2chk.x utility!
Note on parallelization: this function should be called from the root node only!
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(dis_manifold_type), | intent(inout) | :: | dis_manifold | |||
| type(kmesh_info_type), | intent(in) | :: | kmesh_info | |||
| type(wannier_data_type), | intent(inout) | :: | wannier_data | |||
| complex(kind=dp), | intent(inout) | :: | m_matrix(:,:,:,:) | |||
| complex(kind=dp), | intent(inout) | :: | u_matrix(:,:,:) | |||
| complex(kind=dp), | intent(inout) | :: | u_matrix_opt(:,:,:) | |||
| real(kind=dp), | intent(inout) | :: | omega_invariant | |||
| integer, | intent(in) | :: | num_bands | |||
| integer, | intent(in) | :: | num_kpts | |||
| integer, | intent(in) | :: | num_wann | |||
| logical, | intent(in) | :: | have_disentangled | |||
| character(len=*), | intent(in) | :: | seedname | |||
| integer, | intent(in) | :: | chk_unit | |||
| integer, | intent(in) | :: | stdout | |||
| type(w90_error_type), | intent(out), | allocatable | :: | error | ||
| type(w90_comm_type), | intent(in) | :: | comm |
subroutine w90_readwrite_read_chkpt_matrices(dis_manifold, kmesh_info, wannier_data, m_matrix, & u_matrix, u_matrix_opt, omega_invariant, num_bands, & num_kpts, num_wann, have_disentangled, seedname, & chk_unit, stdout, error, comm) !================================================! !! Read checkpoint file !! IMPORTANT! If you change the chkpt format, adapt !! accordingly also the w90chk2chk.x utility! !! !! Note on parallelization: this function should be called !! from the root node only! !! !================================================! use w90_comms, only: mpirank use w90_error, only: w90_error_type, set_error_file, set_error_file, set_error_alloc use w90_utility, only: utility_recip_lattice implicit none type(dis_manifold_type), intent(inout) :: dis_manifold type(kmesh_info_type), intent(in) :: kmesh_info type(w90_comm_type), intent(in) :: comm type(w90_error_type), allocatable, intent(out) :: error type(wannier_data_type), intent(inout) :: wannier_data integer, intent(in) :: num_kpts integer, intent(in) :: num_bands integer, intent(in) :: num_wann integer, intent(in) :: stdout, chk_unit complex(kind=dp), intent(inout) :: u_matrix(:, :, :) complex(kind=dp), intent(inout) :: u_matrix_opt(:, :, :) complex(kind=dp), intent(inout) :: m_matrix(:, :, :, :) real(kind=dp), intent(inout) :: omega_invariant character(len=*), intent(in) :: seedname logical, intent(in) :: have_disentangled ! local variables integer :: nkp, i, j, k, l, ierr, stat if (have_disentangled) then read (chk_unit) omega_invariant ! omega invariant ! lwindow if (.not. allocated(dis_manifold%lwindow)) then allocate (dis_manifold%lwindow(num_bands, num_kpts), stat=ierr) if (ierr /= 0) then call set_error_alloc(error, 'Error allocating lwindow in w90_readwrite_read_chkpt_matrices', comm) return end if end if read (chk_unit, err=122) ((dis_manifold%lwindow(i, nkp), i=1, num_bands), nkp=1, num_kpts) ! ndimwin if (.not. allocated(dis_manifold%ndimwin)) then allocate (dis_manifold%ndimwin(num_kpts), stat=ierr) if (ierr /= 0) then call set_error_alloc(error, 'Error allocating ndimwin in w90_readwrite_read_chkpt_matrices', comm) return end if end if read (chk_unit, err=123) (dis_manifold%ndimwin(nkp), nkp=1, num_kpts) ! U_matrix_opt read (chk_unit, err=124) (((u_matrix_opt(i, j, nkp), i=1, num_bands), j=1, num_wann), nkp=1, num_kpts) else ! if not read, u_matrix_opt must be explicitly zeroed u_matrix_opt(:, :, :) = 0 end if ! U_matrix read (chk_unit, err=125) (((u_matrix(i, j, k), i=1, num_wann), j=1, num_wann), k=1, num_kpts) ! M_matrix read (chk_unit, err=126) & ((((m_matrix(i, j, k, l), i=1, num_wann), j=1, num_wann), k=1, kmesh_info%nntot), l=1, num_kpts) ! wannier_centres read (chk_unit, err=127) ((wannier_data%centres(i, j), i=1, 3), j=1, num_wann) ! wannier spreads read (chk_unit, err=128) (wannier_data%spreads(i), i=1, num_wann) close (chk_unit) if (mpirank(comm) == 0) write (stdout, '(a/)') ' ... done' return 122 call set_error_file(error, 'Error reading lwindow from '//trim(seedname)//'.chk in & & w90_readwrite_read_chkpt_matrices', comm) return 123 call set_error_file(error, 'Error reading ndimwin from '//trim(seedname)//'.chk in & & w90_readwrite_read_chkpt_matrices', comm) return 124 call set_error_file(error, 'Error reading u_matrix_opt from '//trim(seedname)//'.chk in & & w90_readwrite_read_chkpt_matrices', comm) return 125 call set_error_file(error, 'Error reading u_matrix from '//trim(seedname)//'.chk in & & w90_readwrite_read_chkpt_matrices', comm) return 126 call set_error_file(error, 'Error reading m_matrix from '//trim(seedname)//'.chk in & & w90_readwrite_read_chkpt_matrices', comm) return 127 call set_error_file(error, 'Error reading wannier_centres from '//trim(seedname)//'.chk in & & w90_readwrite_read_chkpt_matrices', comm) return 128 call set_error_file(error, 'Error reading wannier_spreads from '//trim(seedname)//'.chk in & & w90_readwrite_read_chkpt_matrices', comm) return end subroutine w90_readwrite_read_chkpt_matrices