Adapted trexio file for full path

This commit is contained in:
Anthony Scemama 2024-03-05 15:37:09 +01:00
parent b108b69726
commit 590463063f
2 changed files with 17 additions and 5 deletions

View File

@ -2,6 +2,6 @@ program export_trexio_prog
implicit none
read_wf = .True.
SOFT_TOUCH read_wf
call export_trexio(.False.)
call export_trexio(.False.,.False.)
end

View File

@ -1,18 +1,28 @@
subroutine export_trexio(update)
subroutine export_trexio(update,full_path)
use trexio
implicit none
BEGIN_DOC
! Exports the wave function in TREXIO format
END_DOC
logical, intent(in) :: update
logical, intent(in) :: update, full_path
integer(trexio_t) :: f(N_states) ! TREXIO file handle
integer(trexio_exit_code) :: rc
integer :: k
integer :: k, iunit
double precision, allocatable :: factor(:)
character*(256) :: filenames(N_states)
character*(256) :: filenames(N_states), fp
character :: rw
integer, external :: getunitandopen
if (full_path) then
fp = trexio_filename
call system('realpath '//trim(fp)//' > '//trim(fp)//'.tmp')
iunit = getunitandopen(trim(fp)//'.tmp','r')
read(iunit,'(A)') trexio_filename
close(iunit, status='delete')
endif
filenames(1) = trexio_filename
do k=2,N_states
write(filenames(k),'(A,I3.3)') trim(trexio_filename)//'.', k-1
@ -49,6 +59,8 @@ subroutine export_trexio(update)
enddo
call ezfio_set_trexio_trexio_file(trexio_filename)
! ------------------------------------------------------------------------------
! Electrons