[Pw_forum] small bug in restart.f90

Fernando Reboredo reboredo1 at llnl.gov
Sat Dec 11 04:52:23 CET 2004


The problem appears when pwscf is run in an ibm_aix cluster in restart mode without a "*.save" file. 
symptoms: after successfully exiting electron and after the first call to move_ions seqopn tries to use a unit already open and stops.

I trace the problem back to the restart module subroutine readfile_new. Specifically at this section of the code

  !
  ! ... end of declarations
  !
  !
  !  read configuration from .save file
  !
  ierr = 0
  filename = trim( prefix )//'.save'
  WRITE( stdout, '(/,5x,"Reading file ",a14)') filename
  !
  if( ionode ) THEN
    call seqopn (ndr, filename, 'unformatted', exst)
  write(*,*) 'Inside ions'

    if ( .not. exst ) then
       close (unit = ndr, status = 'delete')
       ierr = 1
    endif
    rewind ndr
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

The error apears with in an ibm_aix (I do not know if in other machines as well) tries to rewind a file that does not exist or has been just deleted.
In that case the rewind command opens a unit and creates a file fort.$ndr in the working directory. That file remains open until it causes the CRASH when the restart information is saved.
The solution is
    if ( .not. exst ) then
       close (unit = ndr, status = 'delete')
       ierr = 1
    else
       rewind ndr
    endif

I have been using the code for a month now. Nicely done!.
Regards to all
Fernando Reboredo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quantum-espresso.org/pipermail/users/attachments/20041210/664edf33/attachment.html>


More information about the users mailing list