From df81711c1e234b725b2694da397706eeef354e13 Mon Sep 17 00:00:00 2001 From: paulatto Date: Sat, 22 Aug 2009 10:24:56 +0000 Subject: [PATCH] Inserted iuntmp=90 to be used for closing and deleting files at the end of calculation (previously unit=4 was hardcoded and could possibly conflict with other parts of code) LP git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@5857 c92efa57-630b-4861-b058-cf58834340f0 --- Modules/io_files.f90 | 2 ++ PW/stop_run.f90 | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Modules/io_files.f90 b/Modules/io_files.f90 index 7b8d5c489..55f1ee337 100644 --- a/Modules/io_files.f90 +++ b/Modules/io_files.f90 @@ -104,6 +104,8 @@ MODULE io_files INTEGER :: iunbfgs = 30 ! unit for the bfgs restart file INTEGER :: iunatsicwfc = 31 ! unit for sic wfc ! + INTEGER :: iuntmp = 90 ! temporary unit, when used must be closed ASAP + ! INTEGER :: nwordwfc = 2 ! length of record in wavefunction file INTEGER :: nwordatwfc = 2 ! length of record in atomic wfc file INTEGER :: nwordwann = 2 ! length of record in sic wfc file diff --git a/PW/stop_run.f90 b/PW/stop_run.f90 index c85a05f62..a3521a320 100644 --- a/PW/stop_run.f90 +++ b/PW/stop_run.f90 @@ -17,7 +17,8 @@ SUBROUTINE stop_run( flag ) USE mp_global, ONLY : nimage USE control_flags, ONLY : lpath, twfcollect, lconstrain, & lcoarsegrained, io_level, llondon - USE io_files, ONLY : iunwfc, iunigk, iunefield, iunefieldm, iunefieldp + USE io_files, ONLY : iunwfc, iunigk, iunefield, iunefieldm,& + iunefieldp, iuntmp USE buffers, ONLY : close_buffer USE path_variables, ONLY : path_deallocation USE path_io_routines, ONLY : io_path_stop @@ -65,22 +66,22 @@ SUBROUTINE stop_run( flag ) END IF ! IF (flag .and. .not. lpath) THEN - CALL seqopn( 4, 'restart', 'UNFORMATTED', exst ) - CLOSE( UNIT = 4, STATUS = 'DELETE' ) + CALL seqopn( iuntmp, 'restart', 'UNFORMATTED', exst ) + CLOSE( UNIT = iuntmp, STATUS = 'DELETE' ) ENDIF IF ( flag .AND. ionode ) THEN ! ! ... all other files must be reopened and removed ! - CALL seqopn( 4, 'update', 'FORMATTED', exst ) - CLOSE( UNIT = 4, STATUS = 'DELETE' ) + CALL seqopn( iuntmp, 'update', 'FORMATTED', exst ) + CLOSE( UNIT = iuntmp, STATUS = 'DELETE' ) ! - CALL seqopn( 4, 'para', 'FORMATTED', exst ) - CLOSE( UNIT = 4, STATUS = 'DELETE' ) + CALL seqopn( iuntmp, 'para', 'FORMATTED', exst ) + CLOSE( UNIT = iuntmp, STATUS = 'DELETE' ) ! - CALL seqopn( 4, 'BLOCK', 'FORMATTED', exst ) - CLOSE( UNIT = 4, STATUS = 'DELETE' ) + CALL seqopn( iuntmp, 'BLOCK', 'FORMATTED', exst ) + CLOSE( UNIT = iuntmp, STATUS = 'DELETE' ) ! END IF !