cart2int_NH3/tab2genetic.f

49 lines
1.3 KiB
FortranFixed
Raw Normal View History

2024-10-21 14:01:28 +02:00
program tab2genetic
use iso_fortran_env, only: error_unit
implicit none
include 'nnparams.incl'
include 'JTmod.incl'
integer, parameter :: infile=100
character(len=2048) line
real*8 cart(3,4),qint(maxnin)
! useless crap written in table1
real*8 tmp
character(len=1024) binary,infile_name
character(len=3) lfmt,ofmt
parameter (lfmt='(A)',ofmt='(A)')
integer, parameter :: uerr=error_unit, uout=6
integer j
call getarg(0,binary)
if (iargc().lt.1) then
write(uerr,ofmt) 'ERROR: Missing first argument FILENAME.'
write(uerr,ofmt) trim(binary)
> // ' FILENAME'
stop
endif
call getarg(1,infile_name)
write(uerr,ofmt) ' Input file: '//trim(infile_name)
open(infile,file=trim(infile_name),status='old',action='read')
do
read(infile,lfmt,err=403,end=404) line
cart(:,1)=0
read(line,*,err=405,end=403) tmp, cart(1:3,2:4)
call cart2int(cart,qint)
! order: xs,ys,xb,yb,a,b
write(uout,'(6F20.6)') (qint(pat_index(j)), j=2,5),
> qint(pat_index(1)), qint(pat_index(6))
403 cycle
404 exit
405 write(uerr,*) 'WARNING: MALFORMED LINE: "'
> //trim(line)//'"'
enddo
close(infile)
end program