From e2b88699e62dcad2ce51fe7eb2b95777fa4709aa Mon Sep 17 00:00:00 2001 From: calandra Date: Thu, 31 May 2012 16:18:52 +0000 Subject: [PATCH] Missing rewind in dfile_get_qlist. As the file was opened with option 'append' this causes the program to go to the end of the file and thus the first read option was giving EOF. MCB git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@9044 c92efa57-630b-4861-b058-cf58834340f0 --- PHonon/PH/dfile_autoname.f90 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/PHonon/PH/dfile_autoname.f90 b/PHonon/PH/dfile_autoname.f90 index 5a3bf9b00..a9e69d8e3 100644 --- a/PHonon/PH/dfile_autoname.f90 +++ b/PHonon/PH/dfile_autoname.f90 @@ -41,14 +41,14 @@ FUNCTION open_dfile_directory(basename, prefix) INTEGER :: open_dfile_directory INTEGER :: ios CHARACTER(len=256) :: filename -! LOGICAL :: exst + LOGICAL :: exst ! filename = dfile_directory_file(basename, prefix) - !print*, "opening dir:", TRIM(filename) +! print*, "opening dir:", TRIM(filename) open_dfile_directory = find_free_unit() ! -! INQUIRE( FILE = TRIM(filename), EXIST = exst ) - !IF(.not.exst) print*, "does not exist: >",TRIM(filename),"<" + INQUIRE( FILE = TRIM(filename), EXIST = exst ) + IF(.not.exst) print*, "does not exist: >",TRIM(filename),"<" #ifdef __XLF OPEN(UNIT = open_dfile_directory, & ACCESS= 'sequential', & @@ -63,6 +63,7 @@ FUNCTION open_dfile_directory(basename, prefix) #endif ! IF(ios/=0) CALL errore('open_dfile_directory','Cannot open: '//TRIM(filename),ABS(ios)) + write(6,*) 'ios=',ios ! RETURN !---------------------------------------------------------------------- @@ -226,6 +227,7 @@ SUBROUTINE dfile_get_qlist(xqs, nqs, name, prefix) ! iunit = open_dfile_directory(basename, prefix) ! + rewind(iunit) GET_Q_LOOP : & DO iq = 1,nqs READ(iunit,*,iostat=ios) xqs(:,iq)