cart2int_NH3/tab2genetic.f

65 lines
1.8 KiB
FortranFixed
Raw Permalink 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'
2024-10-22 15:47:06 +02:00
integer, parameter :: infile=100,enfile=101
2024-10-21 14:01:28 +02:00
character(len=2048) line
real*8 cart(3,4),qint(maxnin)
2024-10-22 15:47:06 +02:00
real*8 energies(4)
2024-10-21 14:01:28 +02:00
! 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
2024-10-22 15:47:06 +02:00
integer j,k
2024-10-21 14:01:28 +02:00
call getarg(0,binary)
2024-10-22 15:47:06 +02:00
if (iargc().lt.2) then
write(uerr,ofmt) 'ERROR: Missing madatory argument.'
2024-10-21 14:01:28 +02:00
write(uerr,ofmt) trim(binary)
2024-10-22 15:47:06 +02:00
> // ' CART_FILENAME EN_FILENAME'
2024-10-21 14:01:28 +02:00
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')
2024-10-22 15:47:06 +02:00
call getarg(2,infile_name)
write(uerr,ofmt) ' Energy file: '//trim(infile_name)
open(enfile,file=trim(infile_name),status='old',action='read')
2024-10-21 14:01:28 +02:00
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)
2024-10-22 15:47:06 +02:00
do
read(enfile,lfmt,err=400,end=404) line
read(line,*,err=400,end=400) tmp,energies
exit
400 cycle
enddo
! order: E, xs,ys,xb,yb,a,b
do k=1,4
write(uout,'(F15.8,6F20.6)')
> energies(k),
> (qint(pat_index(j)), j=2,5),
> qint(pat_index(1)),
> qint(pat_index(6))
enddo
2024-10-21 14:01:28 +02:00
403 cycle
404 exit
405 write(uerr,*) 'WARNING: MALFORMED LINE: "'
> //trim(line)//'"'
enddo
close(infile)
2024-10-22 15:47:06 +02:00
close(enfile)
2024-10-21 14:01:28 +02:00
end program