plot_u_matrices Subroutine

private subroutine plot_u_matrices()

Uses

  • proc~~plot_u_matrices~~UsesGraph proc~plot_u_matrices plot_u_matrices module~w90_parameters w90_parameters proc~plot_u_matrices->module~w90_parameters module~w90_io w90_io proc~plot_u_matrices->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

Plot u_matrix and u_matrix_opt to textfiles in readable format

Arguments

None

Calls

proc~~plot_u_matrices~~CallsGraph proc~plot_u_matrices plot_u_matrices proc~io_date io_date proc~plot_u_matrices->proc~io_date proc~io_file_unit io_file_unit proc~plot_u_matrices->proc~io_file_unit

Contents

Source Code


Source Code

  subroutine plot_u_matrices
    !============================================!
    !                                            !
    !! Plot u_matrix and u_matrix_opt to textfiles in readable format
    !                                            !
    !============================================!

    use w90_parameters, only: num_bands, num_kpts, num_wann, have_disentangled, &
      kpt_latt, u_matrix, u_matrix_opt
    use w90_io, only: io_error, stdout, io_file_unit, seedname, &
      io_time, io_stopwatch, io_date

    implicit none
    integer             :: matunit
    integer             :: i, j, nkp
    character(len=33)  :: header
    character(len=9)   :: cdate, ctime

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

    matunit = io_file_unit()
    open (matunit, file=trim(seedname)//'_u.mat', form='formatted')

    write (matunit, *) header
    write (matunit, *) num_kpts, num_wann, num_wann

    do nkp = 1, num_kpts
      write (matunit, *)
      write (matunit, '(f15.10,sp,f15.10,sp,f15.10)') kpt_latt(:, nkp)
      write (matunit, '(f15.10,sp,f15.10)') ((u_matrix(i, j, nkp), i=1, num_wann), j=1, num_wann)
    end do
    close (matunit)

    if (have_disentangled) then
      matunit = io_file_unit()
      open (matunit, file=trim(seedname)//'_u_dis.mat', form='formatted')
      write (matunit, *) header
      write (matunit, *) num_kpts, num_wann, num_bands
      do nkp = 1, num_kpts
        write (matunit, *)
        write (matunit, '(f15.10,sp,f15.10,sp,f15.10)') kpt_latt(:, nkp)
        write (matunit, '(f15.10,sp,f15.10)') ((u_matrix_opt(i, j, nkp), i=1, num_bands), j=1, num_wann)
      end do
      close (matunit)
    endif

  end subroutine plot_u_matrices