From cb0b432041516e601b21e8e5e4500b63514915d1 Mon Sep 17 00:00:00 2001 From: kmdunseath <73846968+kmdunseath@users.noreply.github.com> Date: Thu, 1 Jun 2023 15:52:11 +0200 Subject: [PATCH] Added file src/msspec/spec/fortran/eig/common/save_eigenvalues.f which writes the eigenvalues to a fortran stream file called eigenvalues.dat, facilitating reading by a python script. Added call to save_eigenvalues in src/msspec/spec/fortran/eig/common/eig_mat_ms.f --- .../spec/fortran/eig/common/eig_mat_ms.f | 4 ++ .../fortran/eig/common/save_eigenvalues.f | 37 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/msspec/spec/fortran/eig/common/save_eigenvalues.f diff --git a/src/msspec/spec/fortran/eig/common/eig_mat_ms.f b/src/msspec/spec/fortran/eig/common/eig_mat_ms.f index 03ee7e7..06896f2 100644 --- a/src/msspec/spec/fortran/eig/common/eig_mat_ms.f +++ b/src/msspec/spec/fortran/eig/common/eig_mat_ms.f @@ -178,6 +178,10 @@ CKMD WRITE(IUO1,*) ' ' CKMD WRITE(IUO1,*) ' ---> WORK(1),INFO =',WORK(1),INFO CKMD WRITE(IUO1,*) ' ' CKMD ENDIF +C +CKMD Save eigenvalues to unformatted stream file eigenvalues.dat +C + call save_eigenvalues(w, jlin, e_kin) C N_EIG=0 C diff --git a/src/msspec/spec/fortran/eig/common/save_eigenvalues.f b/src/msspec/spec/fortran/eig/common/save_eigenvalues.f new file mode 100644 index 0000000..0824c4b --- /dev/null +++ b/src/msspec/spec/fortran/eig/common/save_eigenvalues.f @@ -0,0 +1,37 @@ +c +c======================================================================= +c + subroutine save_eigenvalues (evalues, n, ke) +c + implicit none +c + integer, intent(in) :: n + real, intent(in) :: ke + complex*16, intent(in) :: evalues(n) +c +c Local variables +c + integer :: io + logical :: exists +c +c + inquire(file='eigenvalues.dat', exist=exists) +c + if (exists) then + open(newunit=io, file='eigenvalues.dat', status='old', + + form='unformatted', access='stream', action='write', + + position='append') + else + open(newunit=io, file='eigenvalues.dat', status='new', + + form='unformatted', access='stream', action='write') + end if +c + write(io) ke, n, evalues(1:n) +c + close(io) +c + return + end subroutine save_eigenvalues +c +c======================================================================= +c