hamiltonian_write_hr Subroutine

public subroutine hamiltonian_write_hr()

Uses

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

Write the Hamiltonian in the WF basis

Arguments

None

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_file_unit io_file_unit proc~hamiltonian_write_hr->proc~io_file_unit

Contents

Source Code


Source Code

  subroutine hamiltonian_write_hr()
    !============================================!
    !!  Write the Hamiltonian in the WF basis
    !============================================!

    use w90_io, only: io_error, io_stopwatch, io_file_unit, &
      seedname, io_date
    use w90_parameters, only: num_wann, timing_level

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

    if (hr_written) return

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

    ! write the  whole matrix with all the indices

    file_unit = io_file_unit()
    open (file_unit, file=trim(seedname)//'_hr.dat', form='formatted', &
          status='unknown', err=101)

    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)

    hr_written = .true.

    if (timing_level > 1) call io_stopwatch('hamiltonian: write_hr', 2)

    return

101 call io_error('Error: hamiltonian_write_hr: problem opening file '//trim(seedname)//'_hr.dat')

  end subroutine hamiltonian_write_hr