hamiltonian_write_hr Subroutine

public subroutine hamiltonian_write_hr(ham_r, irvec, ndegen, nrpts, num_wann, timing_level, seedname, timer, error, comm)

Uses

  • proc~~hamiltonian_write_hr~~UsesGraph proc~hamiltonian_write_hr hamiltonian_write_hr module~w90_comms w90_comms proc~hamiltonian_write_hr->module~w90_comms module~w90_io w90_io proc~hamiltonian_write_hr->module~w90_io module~w90_types w90_types proc~hamiltonian_write_hr->module~w90_types module~w90_constants w90_constants module~w90_comms->module~w90_constants module~w90_error_base w90_error_base module~w90_comms->module~w90_error_base module~w90_io->module~w90_constants module~w90_types->module~w90_constants

Write the Hamiltonian in the WF basis

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(in) :: ham_r(:,:,:)
integer, intent(in) :: irvec(:,:)
integer, intent(in) :: ndegen(:)
integer, intent(in) :: nrpts
integer, intent(in) :: num_wann
integer, intent(in) :: timing_level
character(len=50), intent(in) :: seedname
type(timer_list_type), intent(inout) :: timer
type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm

Calls

proc~~hamiltonian_write_hr~~CallsGraph proc~hamiltonian_write_hr hamiltonian_write_hr proc~io_date io_date proc~hamiltonian_write_hr->proc~io_date proc~io_stopwatch_start io_stopwatch_start proc~hamiltonian_write_hr->proc~io_stopwatch_start proc~io_stopwatch_stop io_stopwatch_stop proc~hamiltonian_write_hr->proc~io_stopwatch_stop proc~set_error_file set_error_file proc~hamiltonian_write_hr->proc~set_error_file proc~comms_sync_error comms_sync_error proc~set_error_file->proc~comms_sync_error proc~set_base_error set_base_error proc~set_error_file->proc~set_base_error

Called by

proc~~hamiltonian_write_hr~~CalledByGraph proc~hamiltonian_write_hr hamiltonian_write_hr proc~plot_main plot_main proc~plot_main->proc~hamiltonian_write_hr proc~tran_main tran_main proc~tran_main->proc~hamiltonian_write_hr proc~w90_plot w90_plot proc~w90_plot->proc~plot_main proc~w90_transport w90_transport proc~w90_transport->proc~tran_main program~wannier wannier program~wannier->proc~w90_plot program~wannier->proc~w90_transport

Source Code

  subroutine hamiltonian_write_hr(ham_r, irvec, ndegen, nrpts, num_wann, timing_level, seedname, &
                                  timer, error, comm)
    !================================================!
    !
    !!  Write the Hamiltonian in the WF basis
    !
    !================================================!

    use w90_io, only: io_stopwatch_start, io_stopwatch_stop, io_date
    use w90_types, only: timer_list_type
    use w90_comms, only: w90_comm_type

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

    integer, intent(in) :: irvec(:, :)
    integer, intent(in) :: ndegen(:)
    integer, intent(in) :: nrpts
    integer, intent(in) :: num_wann
    integer, intent(in) :: timing_level

    complex(kind=dp), intent(in) :: ham_r(:, :, :)

    character(len=50), intent(in) :: seedname

    ! local variables
    integer :: i, j, irpt, file_unit, ierr
    character(len=33) :: header
    character(len=9) :: cdate, ctime

    if (timing_level > 1) call io_stopwatch_start('hamiltonian: write_hr', timer)

    ! write the  whole matrix with all the indices

    open (newunit=file_unit, file=trim(seedname)//'_hr.dat', form='formatted', status='unknown', &
          iostat=ierr)
    if (ierr /= 0) then
      call set_error_file(error, 'Error: hamiltonian_write_hr: problem opening file '//trim(seedname)//'_hr.dat', comm)
      return
    end if

    call io_date(cdate, ctime)
    header = 'written on '//cdate//' at '//ctime

    write (file_unit, *) header ! Date and time
    write (file_unit, *) num_wann
    write (file_unit, *) nrpts
    write (file_unit, '(15I5)') (ndegen(i), i=1, nrpts)
    do irpt = 1, nrpts
      do i = 1, num_wann
        do j = 1, num_wann
          write (file_unit, '(5I5,2F12.6)') irvec(:, irpt), j, i, &
            ham_r(j, i, irpt)
        end do
      end do
    end do

    close (file_unit)
    if (timing_level > 1) call io_stopwatch_stop('hamiltonian: write_hr', timer)
  end subroutine hamiltonian_write_hr