! !------------------------------------------------------------- subroutine readigk ( ipool, recn, npw0, igk0 ) !------------------------------------------------------------- ! ! open igk files as direct access, read, ad close again ! ! Feliciano Giustino, UC Berkeley ! !------------------------------------------------------------- ! use io_files, only : prefix, iunigk, tmp_dir use wvfct, only : npwx #ifdef __PARA use mp_global,only : nproc, nproc_pool, me_pool, mpime use para, only : nprocp, mypool use mp_global,only : npool #endif ! implicit none integer :: npw0, igk0 (npwx), recn, ipool ! number of planewaves ! igk's ! kpoint number ! poolfile to be read (not used in serial case) character (len=3) :: nd_nmbr0 ! node number for shuffle ! integer :: itmp, lrigk, unf_recl character (len=256) :: tempfile ! ! the following is for pgi on opteron, I should test the rigth numbers ! on other machines/compilers ! #if defined(__PGI)||defined(__AIX) # define INT_DIRECT_IO_FACTOR 4 #endif ! ! filename ! tempfile = trim(tmp_dir) // trim(prefix) // '.igk' ! #ifdef __PARA call set_ndnmbr (ipool, me_pool, nprocp, npool, nd_nmbr0) if (ipool.ne.1.or.me_pool.ne.0) tempfile = trim(tempfile) // nd_nmbr0 #endif ! ! record lenght: 1+1+npwx+1 ! first and last byte is rec len, second is npw, 3dh to npwx-rh is igk ! lrigk = npwx + 3 unf_recl = INT_DIRECT_IO_FACTOR * lrigk ! ! open, read, and close ! open (iunigk, file = tempfile, form = 'unformatted', & access = 'direct', recl = unf_recl) read (iunigk, rec = recn) itmp, npw0, igk0, itmp close (iunigk, status = 'keep') ! ! return end subroutine readigk !------------------------------------------------------------- !