Skip to content
Snippets Groups Projects
Commit bb468edd authored by Philipp Rüssmann's avatar Philipp Rüssmann
Browse files

Apply 2 suggestion(s) to 1 file(s)

parent ed54d996
No related branches found
No related tags found
No related merge requests found
......@@ -956,107 +956,6 @@ contains
write (p_un) mtx
close (unit=p_un)
End Subroutine write_int8_mtx
Subroutine write_int8_3d(filename, mtx)
Implicit None
character(len=*), intent(in) :: filename
integer(1), intent(in) :: mtx(:,:,:)
character(len=*), parameter :: var_type = "<i1"
integer(4) :: header_len, s_mtx(3), i, j
s_mtx = shape(mtx)
header_len = len(dict_str(var_type, s_mtx))
open (unit=p_un, file=filename, form="unformatted", &
access="stream")
write (p_un) magic_num, magic_str, major, minor
write (p_un) header_len
write (p_un) dict_str(var_type, s_mtx)
write (p_un) mtx
close (unit=p_un)
End Subroutine write_int8_3d
Subroutine write_int8_vec(filename, vec)
Implicit None
character(len=*), intent(in) :: filename
integer(1), intent(in) :: vec(:)
character(len=*), parameter :: var_type = "<i1"
integer(4) :: header_len, s_vec(1), i
s_vec = shape(vec)
header_len = len(dict_str(var_type, s_vec))
open (unit=p_un, file=filename, form="unformatted", &
access="stream")
write (p_un) magic_num, magic_str, major, minor
write (p_un) header_len
write (p_un) dict_str(var_type, s_vec)
write (p_un) vec
close (unit=p_un)
End Subroutine write_int8_vec
function dict_str(var_type, var_shape) result(str)
implicit none
character(len=*), intent(in) :: var_type
integer(4), intent(in) :: var_shape(:)
character(len=:), allocatable :: str
integer(4) :: cnt
cnt = len("{'descr': '")
cnt = cnt + len(var_type)
cnt = cnt + len("', 'fortran_order': True, 'shape': (")
cnt = cnt + len(shape_str(var_shape))
cnt = cnt + len(",), }")
do while (mod(cnt + 10, 16) /= 0)
cnt = cnt + 1
enddo
allocate (character(cnt) :: str)
str = "{'descr': '"//var_type// &
"', 'fortran_order': True, 'shape': ("// &
shape_str(var_shape)//"), }"
do while (mod(len(str) + 11, 16) /= 0)
str = str//" "
enddo
str = str//achar(10)
end function dict_str
function shape_str(var_shape) result(fin_str)
implicit none
integer(4), intent(in) :: var_shape(:)
character(len=:), allocatable :: str, small_str, fin_str
integer(4) :: i, length, start, halt
length = 14*size(var_shape)
allocate (character(length) :: str)
allocate (character(14) :: small_str)
str = " "
do i = 1, size(var_shape)
start = (i - 1)*length + 1
halt = i*length + 1
write (small_str, "(I13,A)") var_shape(i), ","
str = trim(str)//adjustl(small_str)
enddo
fin_str = trim(str)
end function shape_str
end module m_npy
module mod_write_gflle
......@@ -1064,6 +963,14 @@ module mod_write_gflle
contains
!-------------------------------------------------------------------------------
!> Summary: Write gflle file out in npy format
!> Author: Philipp Rüßmann
!> Category: writeout
!> Deprecated: False
!> Creates one file per atom and energy, otherwise file can be very large which
!> might be problematic in post-processing
!-------------------------------------------------------------------------------
subroutine write_gflle_to_npy(lmmaxd, ielast, nqdos, i1, gflle)
use mod_datatypes, only: dp
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment