Hi there, I am trying to write a code so that fortran could display the input data from an input file. i get no errors after compiling, for when I run i get : Could not print backtrace: libbacktrace could not find executable to open. I appreciate your help in this matter.
.
program main_prog
!> Include standard Fortran environment for IO
use iso_fortran_env, only : input_unit, error_unit
!> Won to obtain a command line arguments
use io_tools, only : read_argument
use scf_main, only : scf_prog
use print_matrix, only : write_vector, write_matrix
implicit none
integer, parameter :: wp = selected_real_kind(15)
character(len=:),allocatable :: input_file
!> Does the provided input file exist
logical :: exist
!> Unit for reading the input from
integer :: io_unit
!> Error status from opening file for IO
integer :: error
!> Error message from opening file for IO
character(len=256) :: message
!> System specific data
!> Number of atoms
integer :: nat
!> Number of electrons
integer :: nel
!> Atom coordinates of the system, all distances in bohr
real(wp), allocatable :: xyz(:,:)
!> Nuclear charges
real(wp), allocatable :: chrg(:)
!> Number of basis functions
integer :: nbf
!> Slater exponents of basis functions
real(wp),allocatable :: zeta(:)
!> This code snippet optionally opens a file or allows reading from STDIN
!> In case of no command line arguments, you read from the STDIN
if (command_argument_count() == 0) then
io_unit = input_unit
else
!> In case there are command line arguments we obtain the first one
call read_argument(1, input_file)
!> Check if the argument corresponds to an existing file
inquire(file=input_file, exist=exist)
!> The file does not exist, we will return with a meaningful error message
if (.not.exist) then
write(error_unit, '("ERROR:", 1x, a)') &
& "The input file '"//input_file//"' does not exist"
error stop 1
end if
!> If the file exist, we open it to a new unit an pass it to the scf
open(file= input_file , newunit=io_unit, status='old', &
& iomsg=message, iostat=error)
if (error /= 0) then
write(error_unit, '("ERROR:", 1x, a)') trim(message)
error stop 1
end if
end if
call scf_prog(io_unit)
! The first line with three integers
read (io_unit, *) nat, nel, nbf
! The second line with floating-point numbers
read(io_unit, *) xyz(:,:), xyz(:,:) , xyz(:,:) , chrg(:) , nbf
! The third line with floating-point numbers
read(io_unit, *) zeta(:)
!forth line
read(io_unit, *) xyz(:,:), xyz(:,:) , xyz(:,:) , chrg(:) , nbf
!fifth line
read(io_unit, *) zeta(:)
! Display the read values
write(*,*) nat, nel , nbf
write(*,*) xyz(:,:), xyz(:,:) , xyz(:,:) , chrg(:), nbf
write(*, *) zeta(:)
write(*,*) xyz(:,:), xyz(:,:) , xyz(:,:) , chrg(:), nbf
write(*, *) zeta(:)
!> If we have opened a file, we have to cleanup now, so we close it again
if (io_unit /= input_unit) then
close(io_unit)
end if
end program main_prog