tran_get_ht Subroutine

private subroutine tran_get_ht()

Uses

  • proc~~tran_get_ht~~UsesGraph proc~tran_get_ht tran_get_ht module~w90_constants w90_constants proc~tran_get_ht->module~w90_constants module~w90_parameters w90_parameters proc~tran_get_ht->module~w90_parameters module~w90_io w90_io proc~tran_get_ht->module~w90_io module~w90_parameters->module~w90_constants module~w90_parameters->module~w90_io module~w90_io->module~w90_constants

Arguments

None

Calls

proc~~tran_get_ht~~CallsGraph proc~tran_get_ht tran_get_ht proc~io_date io_date proc~tran_get_ht->proc~io_date proc~io_file_unit io_file_unit proc~tran_get_ht->proc~io_file_unit

Called by

proc~~tran_get_ht~~CalledByGraph proc~tran_get_ht tran_get_ht proc~tran_main tran_main proc~tran_main->proc~tran_get_ht program~wannier wannier program~wannier->proc~tran_main proc~wannier_run wannier_run proc~wannier_run->proc~tran_main

Contents

Source Code


Source Code

  subroutine tran_get_ht()
    !==================================================================!
    !  construct h00 and h01
    !==================================================================!
    !
    use w90_constants, only: dp
    use w90_io, only: io_error, io_stopwatch, seedname, io_date, &
      io_file_unit
    use w90_parameters, only: num_wann, tran_num_bb, tran_write_ht, &
      nfermi, fermi_energy_list, timing_level
    !
    implicit none
    !
    integer :: ierr, file_unit
    integer :: i, j, n1, im, jm
    character(len=9)   :: cdate, ctime
    !
    if (timing_level > 1) call io_stopwatch('tran: get_ht', 1)
    !
    if (nfermi > 1) call io_error("Error in tran_get_ht: nfermi>1. " &
                                  //"Set the fermi level using the input parameter 'fermi_evel'")
    !
    !
    tran_num_bb = num_pl*num_wann
    !
    allocate (hB0(tran_num_bb, tran_num_bb), stat=ierr)
    if (ierr /= 0) call io_error('Error in allocating hB0 in tran_get_ht')
    allocate (hB1(tran_num_bb, tran_num_bb), stat=ierr)
    if (ierr /= 0) call io_error('Error in allocating hB1 in tran_get_ht')
    !
    hB0 = 0.0_dp
    hB1 = 0.0_dp
    !
    ! h00
    do j = 0, num_pl - 1
      do i = 0, num_pl - 1
        n1 = i - j
        im = i*num_wann
        jm = j*num_wann
        hB0(jm + 1:jm + num_wann, im + 1:im + num_wann) = hr_one_dim(:, :, n1)
      end do
    end do

    ! h01
    do j = 1, num_pl
      do i = 0, j - 1
        n1 = i - (j - 1) + num_pl
        im = i*num_wann
        jm = (j - 1)*num_wann
        hB1(jm + 1:jm + num_wann, im + 1:im + num_wann) = hr_one_dim(:, :, n1)
      end do
    end do

    ! shift by fermi_energy
    do i = 1, tran_num_bb
      hB0(i, i) = hB0(i, i) - fermi_energy_list(1)
    end do

    if (tran_write_ht) then

      file_unit = io_file_unit()
      open (file_unit, file=trim(seedname)//'_htB.dat', status='unknown', form='formatted', action='write')

      call io_date(cdate, ctime)
      write (file_unit, *) 'written on '//cdate//' at '//ctime ! Date and time
      write (file_unit, '(I6)') tran_num_bb
      write (file_unit, '(6F12.6)') ((hB0(j, i), j=1, tran_num_bb), i=1, tran_num_bb)
      write (file_unit, '(I6)') tran_num_bb
      write (file_unit, '(6F12.6)') ((hB1(j, i), j=1, tran_num_bb), i=1, tran_num_bb)

      close (file_unit)

    end if

    if (timing_level > 1) call io_stopwatch('tran: get_ht', 2)

    return

  end subroutine tran_get_ht