conv_write_chkpt Subroutine

public subroutine conv_write_chkpt(checkpoint, stdout, seedname)

Uses

  • proc~~conv_write_chkpt~~UsesGraph proc~conv_write_chkpt conv_write_chkpt module~w90_io w90_io proc~conv_write_chkpt->module~w90_io module~w90chk_parameters w90chk_parameters proc~conv_write_chkpt->module~w90chk_parameters module~wannchk_data wannchk_data proc~conv_write_chkpt->module~wannchk_data module~w90_constants w90_constants module~w90_io->module~w90_constants module~w90_types w90_types module~w90chk_parameters->module~w90_types module~wannchk_data->module~w90_constants module~w90_wannier90_types w90_wannier90_types module~wannchk_data->module~w90_wannier90_types module~w90_types->module~w90_constants module~w90_wannier90_types->module~w90_constants

Write formatted checkpoint file

Arguments

Type IntentOptional Attributes Name
character(len=20), intent(in) :: checkpoint
integer, intent(in) :: stdout
character(len=50), intent(in) :: seedname

Called by

proc~~conv_write_chkpt~~CalledByGraph proc~conv_write_chkpt conv_write_chkpt program~w90chk2chk w90chk2chk program~w90chk2chk->proc~conv_write_chkpt

Source Code

  subroutine conv_write_chkpt(checkpoint, stdout, seedname)
    !================================================!
    !
    !! Write formatted checkpoint file
    !
    !================================================!

    use w90_io, only: io_date
    use w90chk_parameters
    use wannchk_data

    implicit none

    integer, intent(in) :: stdout
    character(len=20), intent(in) :: checkpoint
    character(len=50), intent(in)  :: seedname

    integer :: chk_unit, nkp, i, j, k, l

    write (stdout, '(/1x,3a)', advance='no') 'Writing checkpoint file ', trim(seedname), '.chk...'

    open (newunit=chk_unit, file=trim(seedname)//'.chk', form='unformatted')

    write (chk_unit) header                                   ! Date and time from the read file
    write (chk_unit) num_bands                                ! Number of bands
    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
    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
    ! Next is correct: it always print out 20 characters
    write (chk_unit) checkpoint                               ! 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)

    write (stdout, '(a/)') ' done'

  end subroutine conv_write_chkpt