Hey,
Basically I am trying to split a file up which has things of the format
ITEM: TIMESTEP
32
ITEM: ATOMS
100
ITEM: BOX BOUNDS
0 0
0 -1
0 1
ITEM id type x y z
1 1 0 0 0.1
2 1 0 -0.1 0.2
....
And then repeats with similar headers and content.
So my fortran file was reading this in and was writing line by line to a new text file until it had read 100 items (for example) as shown by 100 atoms, and then start a new file.
I was using
READ(10,*) lineread
WRITE(unitwr,*) lineread
where lineread is a character variable of length 100. Now this was cutting things out as it was taking spaces as delimiters. So the entire line was not being read and written, just up to the first delimiter. So instead I tried
READ(10,'(A)') lineread
WRITE(unitwr,'(A)') lineread
But for some reason it wrote everything after a couple of runs, instead of the number of lines. Its like it read onto the next line and copied that too.
So is there a way to do an entire line read regardless of delimiters? I can't seem to find it.
Or would it be better to keep reading until it encounters ITEM: TIMESTEP, but again, got the problem with the delimiter.
Cheers
Jay
Basically I am trying to split a file up which has things of the format
ITEM: TIMESTEP
32
ITEM: ATOMS
100
ITEM: BOX BOUNDS
0 0
0 -1
0 1
ITEM id type x y z
1 1 0 0 0.1
2 1 0 -0.1 0.2
....
And then repeats with similar headers and content.
So my fortran file was reading this in and was writing line by line to a new text file until it had read 100 items (for example) as shown by 100 atoms, and then start a new file.
I was using
READ(10,*) lineread
WRITE(unitwr,*) lineread
where lineread is a character variable of length 100. Now this was cutting things out as it was taking spaces as delimiters. So the entire line was not being read and written, just up to the first delimiter. So instead I tried
READ(10,'(A)') lineread
WRITE(unitwr,'(A)') lineread
But for some reason it wrote everything after a couple of runs, instead of the number of lines. Its like it read onto the next line and copied that too.
So is there a way to do an entire line read regardless of delimiters? I can't seem to find it.
Or would it be better to keep reading until it encounters ITEM: TIMESTEP, but again, got the problem with the delimiter.
Cheers
Jay