How to optimize writing a file in a double loop in Fortran -
i wrote fortran code that, in addition other things, writes xyz coordinates file. @ each cycle, coordinates written after previous ones, without overwriting them. code seems work slow (there millions of coordinates per cycle). there way optimize it?
this sketch of code:
! open new file outside loops filexyz='xyz.dat' open (unit=10, file=filexyz, form='formatted', status='new') close(10) 42 ii=1,numfiles !first loop ! ... other things of general program 20 j=1,this !second loop ! ... other things ! write file here because here have coordinates open (unit=11, file=filexyz, status='old', form='formatted', action='write', position='append') write (11,*) x(0,j), y(1,j), x(2,j) close (11) 20 continue 42 continue
Comments
Post a Comment