conv_write_spn Subroutine

public subroutine conv_write_spn()

Uses

  • proc~~conv_write_spn~~UsesGraph proc~conv_write_spn conv_write_spn module~w90_parameters w90_parameters proc~conv_write_spn->module~w90_parameters module~w90_io w90_io proc~conv_write_spn->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 unformatted spn file

Arguments

None

Calls

proc~~conv_write_spn~~CallsGraph proc~conv_write_spn conv_write_spn proc~io_file_unit io_file_unit proc~conv_write_spn->proc~io_file_unit

Called by

proc~~conv_write_spn~~CalledByGraph proc~conv_write_spn conv_write_spn program~w90spn2spn w90spn2spn program~w90spn2spn->proc~conv_write_spn

Contents

Source Code


Source Code

  subroutine conv_write_spn()
    !=======================================!
    !! Write unformatted spn file
    !=======================================!

    use w90_io, only: io_file_unit, io_date, seedname
    use w90_parameters, only: num_bands, num_kpts

    implicit none

    integer :: spn_unit, m, n, ik, counter, s, ierr
    complex(kind=dp), allocatable :: spn_temp(:, :)

    write (stdout, '(3a)') 'Writing information to unformatted file ', trim(seedname), '.spn :'

    spn_unit = io_file_unit()
    open (unit=spn_unit, file=trim(seedname)//'.spn', form='unformatted')

    allocate (spn_temp(3, (num_bands*(num_bands + 1))/2), stat=ierr)
    if (ierr /= 0) call io_error('Error in allocating spm_temp in conv_write_spn')

    write (spn_unit) header
    write (spn_unit) num_bands, num_kpts

    do ik = 1, num_kpts
      counter = 0
      do m = 1, num_bands
        do n = 1, m
          counter = counter + 1
          do s = 1, 3
            spn_temp(s, counter) = spn_o(n, m, ik, s)
          end do
        end do
      end do
      write (spn_unit) ((spn_temp(s, m), s=1, 3), m=1, ((num_bands*(num_bands + 1))/2))
    end do

    close (spn_unit)

    write (stdout, '(1x,a)') 'write done.'

  end subroutine conv_write_spn