Fix bug in spec (files not closed).

Some files were not closed in spec at the end of the program. This
caused some troubles in runing the phagen-spec cycle several times.

A function (CLOSE_ALL_FILES) was added in misc.f to force opened
units in the range [7,200] to be closed before exiting the main
subroutine.
This commit is contained in:
Sylvain Tricot 2020-09-28 15:09:47 +02:00
parent cd3fb05932
commit 0ee6c2d791
8 changed files with 38 additions and 6 deletions

View File

@ -385,7 +385,7 @@ class _MSCALCULATOR(Calculator):
'NPH_M' : 2000,
'NDIM_M' : 100000,
'N_TILT_M' : 11, # to change see extdir.f
'N_ORD_M' : 200,
'N_ORD_M' : 250,
'NPATH_M' : 500,
'NGR_M' : 10,})

View File

@ -5860,7 +5860,7 @@ c
endif
c
print 770
770 format( 1x,' generating t_l (for030) and',
770 format( 1x,' generating t_l (for030) and',
&' atomic cross section (for050)')
c
c construct log-linear x mesh
@ -14807,6 +14807,7 @@ c check = .true.
i = 1
!
write(6,*) 'Below is the bug!'
do
!
if ( r_real ( i ) > r_in ) then
@ -23986,3 +23987,13 @@ c
c---------------------------------
c
subroutine my_test()
logical ok
integer u
do 11 u=0,100
inquire(unit=u, opened=ok)
if (ok) then
print *,"unit ", u, " is opened"
endif
11 continue
end subroutine

View File

@ -0,0 +1,12 @@
SUBROUTINE CLOSE_ALL_FILES()
IMPLICIT NONE
LOGICAL Ok
INTEGER U
DO U=7,200
INQUIRE(UNIT=U, OPENED=Ok)
IF (Ok) THEN
CLOSE(U)
ENDIF
ENDDO
END SUBROUTINE CLOSE_ALL_FILES

View File

@ -16,5 +16,6 @@ CF2PY INTEGER, INTENT(IN,COPY) :: N_TILT_M_, N_ORD_M_, NPATH_M_, NGR_M_
& N_TILT_M_, N_ORD_M_, NPATH_M_, NGR_M_)
CALL DO_MAIN()
CALL CLOSE_ALL_FILES()
END SUBROUTINE RUN

View File

@ -1227,10 +1227,14 @@ c ENDIF
ENDIF
ENDIF
C
IF((ISOM.NE.0).OR.(NFICHLEC.EQ.1)) CLOSE(IUO1)
CST IF((ISOM.NE.0).OR.(NFICHLEC.EQ.1)) CLOSE(IUO1)
IF(ISOM.NE.0) CLOSE(IUO2)
CST STOP
return
CST REMOVE STOP and add GOTO
CST Next line added for test
GOTO 999
C
1 WRITE(IUO1,60)
STOP
@ -1553,7 +1557,7 @@ C
&ATOMS >>>>>>>>>>',/,10X,'<<<<<<<<<< ATOMS ',I4,' AND ',I4,'
&ARE IDENTICAL >>>>>>>>>>')
C
END
999 END
C
C=======================================================================
C

View File

@ -16,5 +16,7 @@ CF2PY INTEGER, INTENT(IN,COPY) :: N_TILT_M_, N_ORD_M_, NPATH_M_, NGR_M_
& N_TILT_M_, N_ORD_M_, NPATH_M_, NGR_M_)
CALL DO_MAIN()
CALL CLOSE_ALL_FILES()
end subroutine
END SUBROUTINE RUN

View File

@ -16,5 +16,6 @@ CF2PY INTEGER, INTENT(IN,COPY) :: N_TILT_M_, N_ORD_M_, NPATH_M_, NGR_M_
& N_TILT_M_, N_ORD_M_, NPATH_M_, NGR_M_)
CALL MAIN_PHD_NS_MI()
CALL CLOSE_ALL_FILES()
END SUBROUTINE RUN

View File

@ -16,5 +16,6 @@ CF2PY INTEGER, INTENT(IN,COPY) :: N_TILT_M_, N_ORD_M_, NPATH_M_, NGR_M_
& N_TILT_M_, N_ORD_M_, NPATH_M_, NGR_M_)
CALL DO_MAIN()
CALL CLOSE_ALL_FILES()
END SUBROUTINE RUN