subroutine gyrotropic_outprint_tensor(f_out_name, arrEf, arrEF1D, arrEfW, units, comment, symmetrize)
use w90_parameters, only: gyrotropic_nfreq, gyrotropic_freq_list, &
nfermi, fermi_energy_list
use w90_io, only: io_file_unit, seedname, stdout
character(len=30), intent(in) :: f_out_name
character(len=30), intent(in), optional :: units
character(len=120), intent(in), optional :: comment
real(kind=dp), dimension(:, :, :), intent(in), optional :: arrEf
real(kind=dp), dimension(:, :, :, :), intent(in), optional :: arrEfW
real(kind=dp), dimension(:), intent(in), optional :: arrEf1D
logical, optional, intent(in) :: symmetrize
character(len=120) :: file_name
integer :: i, file_unit
logical :: lsym
lsym = .true.
if (present(symmetrize)) then
if (.not. symmetrize) lsym = .false.
endif
file_name = trim(seedname)//"-gyrotropic-"//trim(f_out_name)//".dat"
file_name = trim(file_name)
file_unit = io_file_unit()
write (stdout, '(/,3x,a)') '* '//file_name
open (file_unit, FILE=file_name, STATUS='UNKNOWN', FORM='FORMATTED')
if (present(comment)) write (file_unit, *) "#"//trim(comment)
if (present(units)) write (file_unit, *) "# in units of [ "//trim(units)//" ] "
if (present(arrEf)) then
call gyrotropic_outprint_tensor_w(file_unit, 0.0_dp, arr33N=arrEf, symmetrize=lsym)
elseif (present(arrEfW)) then
do i = 1, gyrotropic_nfreq
call gyrotropic_outprint_tensor_w(file_unit, real(gyrotropic_freq_list(i)), arr33N=arrEfW(:, :, :, i), symmetrize=lsym)
enddo
elseif (present(arrEf1D)) then
call gyrotropic_outprint_tensor_w(file_unit, 0.0_dp, arrN=arrEf1D)
endif
close (file_unit)
end subroutine gyrotropic_outprint_tensor