Write checkpoint file IMPORTANT! If you change the chkpt format, adapt accordingly also the w90chk2chk.x utility! note that this routine writes the full u_matrix and the m_matrix --remember to gather them from u_matrix_loc and m_matrix_loc first! (nothing here is parallel)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | chkpt | |||
| integer, | intent(in), | allocatable | :: | exclude_bands(:) | ||
| type(wannier_data_type), | intent(in) | :: | wannier_data | |||
| type(kmesh_info_type), | intent(in) | :: | kmesh_info | |||
| real(kind=dp), | intent(in) | :: | kpt_latt(:,:) | |||
| integer, | intent(in) | :: | num_kpts | |||
| type(dis_manifold_type), | intent(in) | :: | dis_manifold | |||
| integer, | intent(in) | :: | num_bands | |||
| integer, | intent(in) | :: | num_wann | |||
| complex(kind=dp), | intent(in) | :: | u_matrix(:,:,:) | |||
| complex(kind=dp), | intent(in) | :: | u_matrix_opt(:,:,:) | |||
| complex(kind=dp), | intent(in) | :: | m_matrix(:,:,:,:) | |||
| integer, | intent(in) | :: | mp_grid(3) | |||
| real(kind=dp), | intent(in) | :: | real_lattice(3,3) | |||
| real(kind=dp), | intent(in) | :: | omega_invariant | |||
| logical, | intent(in) | :: | have_disentangled | |||
| integer, | intent(in) | :: | iprint | |||
| integer, | intent(in) | :: | stdout | |||
| character(len=*), | intent(in) | :: | seedname |
subroutine w90_wannier90_readwrite_write_chkpt(chkpt, exclude_bands, wannier_data, kmesh_info, & kpt_latt, num_kpts, dis_manifold, num_bands, & num_wann, u_matrix, u_matrix_opt, m_matrix, & mp_grid, real_lattice, omega_invariant, & have_disentangled, iprint, stdout, seedname) !================================================! !! Write checkpoint file !! IMPORTANT! If you change the chkpt format, adapt !! accordingly also the w90chk2chk.x utility! !! note that this routine writes the full u_matrix and the m_matrix !! --remember to gather them from u_matrix_loc and m_matrix_loc first! !! (nothing here is parallel) !================================================! use w90_io, only: io_date use w90_utility, only: utility_recip_lattice_base implicit none ! arguments type(wannier_data_type), intent(in) :: wannier_data type(kmesh_info_type), intent(in) :: kmesh_info type(dis_manifold_type), intent(in) :: dis_manifold complex(kind=dp), intent(in) :: m_matrix(:, :, :, :) complex(kind=dp), intent(in) :: u_matrix(:, :, :) complex(kind=dp), intent(in) :: u_matrix_opt(:, :, :) real(kind=dp), intent(in) :: kpt_latt(:, :) real(kind=dp), intent(in) :: omega_invariant real(kind=dp), intent(in) :: real_lattice(3, 3) integer, allocatable, intent(in) :: exclude_bands(:) integer, intent(in) :: mp_grid(3) integer, intent(in) :: num_bands integer, intent(in) :: num_kpts integer, intent(in) :: num_wann integer, intent(in) :: stdout, iprint character(len=*), intent(in) :: seedname character(len=*), intent(in) :: chkpt logical, intent(in) :: have_disentangled ! local variables integer :: chk_unit, nkp, i, j, k, l, num_exclude_bands real(kind=dp) :: recip_lattice(3, 3), volume character(len=9) :: cdate, ctime character(len=33) :: header character(len=20) :: chkpt1 if (iprint > 0) write (stdout, '(/1x,3a)', advance='no') 'Writing checkpoint file ', trim(seedname), '.chk...' call io_date(cdate, ctime) header = 'written on '//cdate//' at '//ctime open (newunit=chk_unit, file=trim(seedname)//'.chk', form='unformatted') write (chk_unit) header ! Date and time write (chk_unit) num_bands ! Number of bands if (allocated(exclude_bands)) then num_exclude_bands = size(exclude_bands) else num_exclude_bands = 0 end if write (chk_unit) num_exclude_bands ! Number of excluded bands write (chk_unit) (exclude_bands(i), i=1, num_exclude_bands) ! Excluded bands write (chk_unit) ((real_lattice(i, j), i=1, 3), j=1, 3) ! Real lattice call utility_recip_lattice_base(real_lattice, recip_lattice, volume) write (chk_unit) ((recip_lattice(i, j), i=1, 3), j=1, 3) ! Reciprocal lattice write (chk_unit) num_kpts ! Number of k-points write (chk_unit) (mp_grid(i), i=1, 3) ! M-P grid write (chk_unit) ((kpt_latt(i, nkp), i=1, 3), nkp=1, num_kpts) ! K-points write (chk_unit) kmesh_info%nntot ! Number of nearest k-point neighbours write (chk_unit) num_wann ! Number of wannier functions chkpt1 = adjustl(trim(chkpt)) write (chk_unit) chkpt1 ! Position of checkpoint write (chk_unit) have_disentangled ! Whether a disentanglement has been performed if (have_disentangled) then write (chk_unit) omega_invariant ! Omega invariant ! lwindow, ndimwin and U_matrix_opt write (chk_unit) ((dis_manifold%lwindow(i, nkp), i=1, num_bands), nkp=1, num_kpts) write (chk_unit) (dis_manifold%ndimwin(nkp), nkp=1, num_kpts) write (chk_unit) (((u_matrix_opt(i, j, nkp), i=1, num_bands), j=1, num_wann), nkp=1, num_kpts) end if write (chk_unit) (((u_matrix(i, j, k), i=1, num_wann), j=1, num_wann), k=1, num_kpts) ! U_matrix write (chk_unit) ((((m_matrix(i, j, k, l), i=1, num_wann), j=1, num_wann), k=1, kmesh_info%nntot), l=1, num_kpts) ! M_matrix write (chk_unit) ((wannier_data%centres(i, j), i=1, 3), j=1, num_wann) write (chk_unit) (wannier_data%spreads(i), i=1, num_wann) close (chk_unit) if (iprint > 0) write (stdout, '(a/)') ' done' return end subroutine w90_wannier90_readwrite_write_chkpt