********>Bugfix 17:
Author: Ross Walker
Date: 08/03/2004

Programs: ptraj

Description: When writing restrt files ptraj failed to close the open
             file handle before opening the next file. If you were 
             writing a large number of restrt files this could lead
             to you exceeding the maximum number of open files allowed
             on your machine. At this point all further writes would fail.
             This patch adds the code to close the file correctly before
             opening the next.

Fix:  apply the following patch to amber8/src/ptraj/ptraj.c

------------------------------------------------------------------------------
*** ptraj.c	2004-01-06 01:19:18.000000000 -0800
--- ptraj.c	2004-08-06 22:37:07.000000000 -0700
***************
*** 3403,3415 ****
        sprintf(buffer, "%s", outInfo->filename);
  
      if ( openFile(&outInfo->file, buffer, "w") ) {
  
        dumpAmberRestart(outInfo->file, atoms, X, Y, Z, NULL, NULL, NULL, 
  		       (outInfo->isBox ? box : NULL));
! 
      } else { 
        fprintf(stdout, "WARNING in ptrajOutputCoordinates(): Could not open\n");
        fprintf(stdout, "output coordinate file %s, not dumping to output file.\n",
  	      buffer);
      }
    
--- 3403,3416 ----
        sprintf(buffer, "%s", outInfo->filename);
  
      if ( openFile(&outInfo->file, buffer, "w") ) {
  
        dumpAmberRestart(outInfo->file, atoms, X, Y, Z, NULL, NULL, NULL, 
  		       (outInfo->isBox ? box : NULL));
!       safe_fclose(outInfo->file);
!       outInfo->file = NULL;
      } else { 
        fprintf(stdout, "WARNING in ptrajOutputCoordinates(): Could not open\n");
        fprintf(stdout, "output coordinate file %s, not dumping to output file.\n",
  	      buffer);
      }

------------------------------------------------------------------------------

Temporary workarounds: break your run up into smaller chunks so that you don't
exceed the maximum open file limit.