242 illegal operation on direct access file


I am using ABINIT, built with openmpi and pgf90 and pgcc.
When I attempt to use some of the funtionality in parallel i get the following error:

PGFIO-F-242/unformatted write/unit=10/illegal operation on direct access file.
File name = tddft_1_TDEXCIT unformatted, direct access record = 840046
In source file tddft.F90, at line number 1152

which on looking at the source i find the offending code to be:

          write(tmp_unit2, rec=(iexcit-1)*nexcit_win+jexcit ) &
&                 omega_tddft_casida(iocc1,iunocc1,isppol1,iocc2,iunocc2,isppol2,1), &
&                 omega_tddft_casida(iocc1,iunocc1,isppol1,iocc2,iunocc2,isppol2,2), &
&                 iexcit, jexcit

the file is created:

 open(tmp_unit2, file=fname_tdexcit,form='unformatted', recl=recl, &
&      access='DIRECT')

Any suggestions as to what the problem might be?


Hi Connor,

This error means that value of rec is negative for some reason. What are the values of “iexcit”, “nexcit_win”, and “jexcit”? Could one of them have overflowed?

  • Mat

Hi Mat,

the problem was that iexcit and jexcit are both zero on occasion zero with nexcit_win positve. Not entirely sure why that is happening, the code runs fine on one node (on which it doesn’t write to the file) and if I remove the write statement the same data is produced, which replicates that of the reference data I am using.

Anyway, thanks for your help (again)!