From bb468edd208fa1f9d3d232814f628b2ccfe64a89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20R=C3=BCssmann?= <p.ruessmann@fz-juelich.de> Date: Mon, 25 Jul 2022 07:22:58 +0000 Subject: [PATCH] Apply 2 suggestion(s) to 1 file(s) --- source/KKRhost/write_gflle_npy.f90 | 109 +++-------------------------- 1 file changed, 8 insertions(+), 101 deletions(-) diff --git a/source/KKRhost/write_gflle_npy.f90 b/source/KKRhost/write_gflle_npy.f90 index 91f4ce59a..e12d0bd6a 100644 --- a/source/KKRhost/write_gflle_npy.f90 +++ b/source/KKRhost/write_gflle_npy.f90 @@ -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 -- GitLab