title: Writing to files with MPI
body: <p>I'm writing to a file as follows. The order does not necessarily matter (though it would be nice if I could get it ordered by K, as would be inherently in serial code)</p>
  
  <pre><code>            CALL MPI_BARRIER(MPI_COMM_WORLD, IERR)
              OPEN(EIGENVALUES_UP_IO, FILE=EIGENVALUES_UP_PATH, ACCESS='APPEND')
              WRITE(EIGENVALUES_UP_IO, *) K * 0.0001_DP * PI, (EIGENVALUES(J), J = 1, ATOM_COUNT)
              CLOSE(EIGENVALUES_UP_IO)
  </code></pre>
  
  <p>I'm aware this is likely to be the worst option.</p>
  
  <p>I've taken a look at MPI_FILE_WRITE_AT etc. but I'm not sure they (directly) take data in the form that I have?</p>
  
  <p>The file must be in the same format as this, which comes out as a line per K, with ATOM_COUNT + 1 columns. The values are REAL(8)</p>
  
  <p>I've hunted over and over, and can't find any simple references on achieving this. Any help? :)</p>
  
  <p>Similar code in C (assuming it's basically the same as FORTRAN) is just as useful</p>
  
  <p>Thanks!</p>