2003-12-10 22:57:07 +08:00
|
|
|
!
|
|
|
|
! Copyright (C) 2001-2003 PWSCF group
|
|
|
|
! This file is distributed under the terms of the
|
|
|
|
! GNU General Public License. See the file `License'
|
|
|
|
! in the root directory of the present distribution,
|
|
|
|
! or http://www.gnu.org/copyleft/gpl.txt .
|
|
|
|
!
|
|
|
|
!----------------------------------------------------------------------------
|
|
|
|
SUBROUTINE close_files()
|
|
|
|
!----------------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
! ... Close all files and synchronize processes for a new scf calculation.
|
|
|
|
!
|
2004-04-01 01:06:39 +08:00
|
|
|
USE ldaU, ONLY : lda_plus_u
|
|
|
|
USE io_files, ONLY : prefix, iunwfc, iunigk, iunat
|
2004-03-24 17:36:50 +08:00
|
|
|
USE mp_global, ONLY : intra_image_comm
|
|
|
|
USE mp, ONLY : mp_barrier
|
2003-12-10 22:57:07 +08:00
|
|
|
!
|
|
|
|
IMPLICIT NONE
|
|
|
|
!
|
2004-08-23 14:51:19 +08:00
|
|
|
LOGICAL :: opnd
|
2003-12-10 22:57:07 +08:00
|
|
|
!
|
|
|
|
! ... iunwfc contains wavefunctions and is kept open during
|
|
|
|
! ... the execution - close and save the file
|
|
|
|
!
|
2004-08-23 14:51:19 +08:00
|
|
|
INQUIRE( UNIT = iunwfc, OPENED = opnd )
|
|
|
|
IF ( opnd ) CLOSE( UNIT = iunwfc, STATUS = 'KEEP' )
|
2003-12-10 22:57:07 +08:00
|
|
|
!
|
|
|
|
! ... iunigk is kept open during the execution - close and remove
|
|
|
|
!
|
2004-08-23 14:51:19 +08:00
|
|
|
INQUIRE( UNIT = iunigk, OPENED = opnd )
|
|
|
|
IF ( opnd ) CLOSE( UNIT = iunigk, STATUS = 'DELETE' )
|
2003-12-10 22:57:07 +08:00
|
|
|
!
|
2004-04-01 01:06:39 +08:00
|
|
|
! ... iunat contains the orthogonalized wfcs
|
2004-08-23 14:51:19 +08:00
|
|
|
!
|
|
|
|
IF ( lda_plus_u ) THEN
|
|
|
|
!
|
|
|
|
INQUIRE( UNIT = iunat, OPENED = opnd )
|
|
|
|
IF ( opnd ) CLOSE( UNIT = iunat, STATUS = 'KEEP' )
|
|
|
|
!
|
|
|
|
END IF
|
2004-04-01 01:06:39 +08:00
|
|
|
!
|
2004-03-24 17:36:50 +08:00
|
|
|
CALL mp_barrier( intra_image_comm )
|
2003-12-10 22:57:07 +08:00
|
|
|
!
|
2004-08-23 14:51:19 +08:00
|
|
|
#if defined (__T3E)
|
2003-12-10 22:57:07 +08:00
|
|
|
!
|
|
|
|
! ... set streambuffers off
|
|
|
|
!
|
|
|
|
CALL set_d_stream( 0 )
|
|
|
|
#endif
|
|
|
|
!
|
|
|
|
RETURN
|
|
|
|
!
|
|
|
|
END SUBROUTINE close_files
|