Debug routine to dump the current supercell
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(inout) | :: | self | |||
character(len=*), | intent(in), | optional | :: | prefix |
subroutine sc_dump(self,prefix)
use mp, only: proc0
use optionals, only: get_option_with_default
implicit none
class(supercell_type), intent(inout) :: self
character(len=*), optional, intent(in) :: prefix
character(len=80) :: fname
complex, dimension(:,:), allocatable :: tmp
integer :: lun
!Make filename
write(fname,'(A,"sc_is_",I0,"_ik_",I0,".dat")') &
trim(get_option_with_default(prefix, '')), self%is_ind, self%ik_ind
!Allocate array and fetch data
allocate(tmp(self%ncol,self%nrow))
!Fetch data
call self%pull_rows_to_arr(tmp)
!Now we've fetched data we can write
if(proc0) then
!Write
open(newunit=lun,file=fname,status='replace',form="unformatted")
write(lun) tmp
close(lun)
endif
!Free memory
deallocate(tmp)
end subroutine sc_dump