Dear all, greeting.. Could you please let me know how can I resolve the below error as? forrtl: severe (59): list-directed I/O syntax error I have 2 large files that I need to combine them together (file #2 should be appended to the file #1). I did it and everything seems fine BUT when I want to compile it the above error happens. I would be highly appreciated if let me know how to get rid of it. Thanks in advance

0 |

5/10/2016 11:08:36 AM

On Tuesday, May 10, 2016 at 12:08:38 PM UTC+1, maji...@gmail.com wrote: > Dear all, > > greeting.. > > Could you please let me know how can I resolve the below error as? > > forrtl: severe (59): list-directed I/O syntax error > > I have 2 large files that I need to combine them together (file #2 should be appended to the file #1). I did it and everything seems fine BUT when I want to compile it the above error happens. > > I would be highly appreciated if let me know how to get rid of it. > > Thanks in advance FAQ Rule #0 : Show the code you have written, or at least as much as demonstrates the problem. For example show the declaration of the variables you use for reading and writing the data (integer, character etc.) Show the "open" statements for the two files. Show the read and write statements. Hopefully you will have opened file#1 using position='append' then all you need to do is read file#2 and write to file#1 Once we see the code we should be better able to help you. Les

0 |

5/10/2016 11:50:04 AM

On Tuesday, May 10, 2016 at 8:50:07 PM UTC+9, Les Neilson wrote: > On Tuesday, May 10, 2016 at 12:08:38 PM UTC+1, maji...@gmail.com wrote: > > Dear all, > > > > greeting.. > > > > Could you please let me know how can I resolve the below error as? > > > > forrtl: severe (59): list-directed I/O syntax error > > > > I have 2 large files that I need to combine them together (file #2 should be appended to the file #1). I did it and everything seems fine BUT when I want to compile it the above error happens. > > > > I would be highly appreciated if let me know how to get rid of it. > > > > Thanks in advance > > FAQ Rule #0 : > Show the code you have written, or at least as much as demonstrates the problem. > For example show the declaration of the variables you use for reading and writing the data (integer, character etc.) > Show the "open" statements for the two files. > Show the read and write statements. > > Hopefully you will have opened file#1 using position='append' then all you need to do is read file#2 and write to file#1 > > Once we see the code we should be better able to help you. > > Les Dear Les, Thank you for reply. I have 2 large files with same format as below (#1 with 120000 and #2 with 80000 steps) ITEM: TIMESTEP 0 ! this is my steps which changes ITEM: NUMBER OF ATOMS 6464 ITEM: BOX BOUNDS pp pp pp -15 15 -15 15 -115 115 ITEM: ATOMS id element type x y z vx vy vz fx fy fz 1 C 1 4.5 0 -115 0 0 0 0 0 0 2 C 1 4.3001 1.3264 -115 0 0 0 0 0 0 3 C 1 3.7181 2.5349 -115 0 0 0 0 0 0 4 C 1 2.8057 3.5182 -115 0 0 0 0 0 0 5 C 1 1.644 4.1889 -115 0 0 0 0 0 0 6 C 1 0.3363 4.4874 -115 0 0 0 0 0 0 ....... here is my code nsteps=501 ! natoms=6034 ! length=170.0 ! !################################################################################################! ALLOCATE(pp(nsteps),atomtype(natoms),atomnumber(natoms),XXX(nsteps,natoms,1:3),VVV(nsteps,natoms,1:3),FFF(nsteps,natoms,1:3)) pp=0 OPEN (10,FILE="wat.dat") DO istep=1,nsteps READ(10,*) header1 READ(10,*) stepnumber READ(10,*) header2 READ(10,*) nnatoms READ(10,*) header3 READ(10,*) irubbish1,box1 READ(10,*) irubbish2,box2 READ(10,*) irubbish3,box3 READ(10,*) header4 DO iatom=1,natoms READ(10,*) atomnumber(iatom), atomtype(iatom),mmm,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) END DO END DO CLOSE(10) kkk=1 nnn=3 lll=2 OPEN (20,FILE="wat-00.dat") DO istep=1,nsteps WRITE(20,'(A14)') "ITEM: TIMESTEP" WRITE(20,'(I7)') (stepnumber+280000)+((istep)*500) WRITE(20,'(A21)') "ITEM: NUMBER OF ATOMS" WRITE(20,'(I4)') nnatoms WRITE(20,'(A25)') "ITEM: BOX BOUNDS pp pp pp" WRITE(20,'(I4,1X,I4)') irubbish1,box1 WRITE(20,'(I4,1X,I4)') irubbish2,box2 WRITE(20,'(I4,1X,I4)') irubbish3,box3 WRITE(20,'(A51)') "ITEM: ATOMS id element type x y z vx vy vz fx fy fz"! !! THE FORMATS NEED TO BE MODIFIED ANT TIME YOU USE NEW LAMMPS OUTPUT 1 FORMAT (I1," ",A2,I1," ", F9.4," ",F9.4," ",F9.4," ",I1," ",I1," ",I1," ",I1," ",I1," ",I1) 10 FORMAT (I2," ",A2,I1," ", F9.4," ",F9.4," ",F9.4," ",I1," ",I1," ",I1," ",I1," ",I1," ",I1) 100 FORMAT (I3," ",A2,I1," ", F9.4," ",F9.4," ",F9.4," ",I1," ",I1," ",I1," ",I1," ",I1," ",I1) 1000 FORMAT (I4," ",A2,I1," ", F9.4," ",F9.4," ",F9.4," ",I1," ",I1," ",I1," ",I1," ",I1," ",I1) 10000 FORMAT (I5," ",A2,I1," ", F9.4," ",F9.4," ",F9.4," ",I1," ",I1," ",I1," ",I1," ",I1," ",I1) 2 FORMAT (I1," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) 20 FORMAT (I2," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) 200 FORMAT (I3," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) 2000 FORMAT (I4," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) 20000 FORMAT (I5," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) 3 FORMAT (I1," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) 30 FORMAT (I2," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) 300 FORMAT (I3," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) 3000 FORMAT (I4," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) 30000 FORMAT (I5," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) DO iatom=1,natoms IF (atomtype(iatom) .EQ. "C ") THEN IF ( iatom .LE. 9 ) WRITE (20,1) atomnumber(iatom),atomtype(iatom),kkk,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) IF ( (iatom .GE. 10 ) .AND. ( iatom .LE. 99 ) ) WRITE (20,10) atomnumber(iatom),atomtype(iatom),kkk,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) IF ( (iatom .GE. 100 ) .AND. ( iatom .LE. 999 ) ) WRITE (20,100) atomnumber(iatom),atomtype(iatom),kkk,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) IF ( (iatom .GE. 1000 ) .AND. ( iatom .LE. 9999 ) ) WRITE (20,1000) atomnumber(iatom),atomtype(iatom),kkk,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) IF ( (iatom .GE. 10000 ) .AND. ( iatom .LE. 99999 ) ) WRITE (20,10000) atomnumber(iatom),atomtype(iatom),kkk,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) ELSE IF (atomtype(iatom) .EQ. "OW ") THEN IF ( iatom .LE. 9 ) WRITE (20,2) atomnumber(iatom),atomtype(iatom),nnn,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) IF ( (iatom .GE. 10 ) .AND. ( iatom .LE. 99 ) ) WRITE (20,20) atomnumber(iatom),atomtype(iatom),nnn,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) IF ( (iatom .GE. 100 ) .AND. ( iatom .LE. 999 ) ) WRITE (20,200) atomnumber(iatom),atomtype(iatom),nnn,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) IF ( (iatom .GE. 1000 ) .AND. ( iatom .LE. 9999 ) ) WRITE (20,2000) atomnumber(iatom),atomtype(iatom),nnn,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) IF ( (iatom .GE. 10000 ) .AND. ( iatom .LE. 99999 ) ) WRITE (20,20000) atomnumber(iatom),atomtype(iatom),nnn,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) ELSE IF (atomtype(iatom) .EQ. "HW ") THEN IF ( iatom .LE. 9 ) WRITE (20,3) atomnumber(iatom),atomtype(iatom),lll,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) IF ( (iatom .GE. 10 ) .AND. ( iatom .LE. 99 ) ) WRITE (20,30) atomnumber(iatom),atomtype(iatom),lll,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) IF ( (iatom .GE. 100 ) .AND. ( iatom .LE. 999 ) ) WRITE (20,300) atomnumber(iatom),atomtype(iatom),lll,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) IF ( (iatom .GE. 1000 ) .AND. ( iatom .LE. 9999 ) ) WRITE (20,3000) atomnumber(iatom),atomtype(iatom),lll,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) IF ( (iatom .GE. 10000 ) .AND. ( iatom .LE. 99999 ) ) WRITE (20,30000) atomnumber(iatom),atomtype(iatom),lll,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) END IF END DO END DO CLOSE(20) END PROGRAM density Actually I used the above code to change the steps of the file #2 in a sequence order to file #1. (imagine that 0 step in #2 should be changed to the last steps in #1 +500) (the steps changes with increment of 500) Finally through "cat file#2 >> file#1" command I append the file #1 to the end of file #2. the appended file makes error.

0 |

5/10/2016 12:09:06 PM

On Tuesday, May 10, 2016 at 1:09:08 PM UTC+1, maji...@gmail.com wrote: > On Tuesday, May 10, 2016 at 8:50:07 PM UTC+9, Les Neilson wrote: > > On Tuesday, May 10, 2016 at 12:08:38 PM UTC+1, maji...@gmail.com wrote: > > > Dear all, > > > > > > greeting.. > > > > > > Could you please let me know how can I resolve the below error as? > > > > > > forrtl: severe (59): list-directed I/O syntax error > > > > > > I have 2 large files that I need to combine them together (file #2 should be appended to the file #1). I did it and everything seems fine BUT when I want to compile it the above error happens. > > > > > > I would be highly appreciated if let me know how to get rid of it. > > > > > > Thanks in advance > > > > FAQ Rule #0 : > > Show the code you have written, or at least as much as demonstrates the problem. > > For example show the declaration of the variables you use for reading and writing the data (integer, character etc.) > > Show the "open" statements for the two files. > > Show the read and write statements. > > > > Hopefully you will have opened file#1 using position='append' then all you need to do is read file#2 and write to file#1 > > > > Once we see the code we should be better able to help you. > > > > Les > > Dear Les, > > Thank you for reply. > > I have 2 large files with same format as below (#1 with 120000 and #2 with 80000 steps) > > ITEM: TIMESTEP > 0 ! this is my steps which changes > ITEM: NUMBER OF ATOMS > 6464 > ITEM: BOX BOUNDS pp pp pp > -15 15 > -15 15 > -115 115 > ITEM: ATOMS id element type x y z vx vy vz fx fy fz > 1 C 1 4.5 0 -115 0 0 0 0 0 0 > 2 C 1 4.3001 1.3264 -115 0 0 0 0 0 0 > 3 C 1 3.7181 2.5349 -115 0 0 0 0 0 0 > 4 C 1 2.8057 3.5182 -115 0 0 0 0 0 0 > 5 C 1 1.644 4.1889 -115 0 0 0 0 0 0 > 6 C 1 0.3363 4.4874 -115 0 0 0 0 0 0 > ...... > > > here is my code > > > > nsteps=501 ! > natoms=6034 ! > length=170.0 ! > !################################################################################################! > > ALLOCATE(pp(nsteps),atomtype(natoms),atomnumber(natoms),XXX(nsteps,natoms,1:3),VVV(nsteps,natoms,1:3),FFF(nsteps,natoms,1:3)) > pp=0 > > > OPEN (10,FILE="wat.dat") > > DO istep=1,nsteps > > READ(10,*) header1 > READ(10,*) stepnumber > READ(10,*) header2 > READ(10,*) nnatoms > READ(10,*) header3 > READ(10,*) irubbish1,box1 > READ(10,*) irubbish2,box2 > READ(10,*) irubbish3,box3 > READ(10,*) header4 > > > DO iatom=1,natoms > READ(10,*) atomnumber(iatom), atomtype(iatom),mmm,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > > END DO > END DO > CLOSE(10) > > > kkk=1 > nnn=3 > lll=2 > > OPEN (20,FILE="wat-00.dat") > > DO istep=1,nsteps > > WRITE(20,'(A14)') "ITEM: TIMESTEP" > WRITE(20,'(I7)') (stepnumber+280000)+((istep)*500) > WRITE(20,'(A21)') "ITEM: NUMBER OF ATOMS" > WRITE(20,'(I4)') nnatoms > WRITE(20,'(A25)') "ITEM: BOX BOUNDS pp pp pp" > WRITE(20,'(I4,1X,I4)') irubbish1,box1 > WRITE(20,'(I4,1X,I4)') irubbish2,box2 > WRITE(20,'(I4,1X,I4)') irubbish3,box3 > WRITE(20,'(A51)') "ITEM: ATOMS id element type x y z vx vy vz fx fy fz"! > > > !! THE FORMATS NEED TO BE MODIFIED ANT TIME YOU USE NEW LAMMPS OUTPUT > > 1 FORMAT (I1," ",A2,I1," ", F9.4," ",F9.4," ",F9.4," ",I1," ",I1," ",I1," ",I1," ",I1," ",I1) > 10 FORMAT (I2," ",A2,I1," ", F9.4," ",F9.4," ",F9.4," ",I1," ",I1," ",I1," ",I1," ",I1," ",I1) > 100 FORMAT (I3," ",A2,I1," ", F9.4," ",F9.4," ",F9.4," ",I1," ",I1," ",I1," ",I1," ",I1," ",I1) > 1000 FORMAT (I4," ",A2,I1," ", F9.4," ",F9.4," ",F9.4," ",I1," ",I1," ",I1," ",I1," ",I1," ",I1) > 10000 FORMAT (I5," ",A2,I1," ", F9.4," ",F9.4," ",F9.4," ",I1," ",I1," ",I1," ",I1," ",I1," ",I1) > > 2 FORMAT (I1," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) > 20 FORMAT (I2," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) > 200 FORMAT (I3," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) > 2000 FORMAT (I4," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) > 20000 FORMAT (I5," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) > > > 3 FORMAT (I1," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) > 30 FORMAT (I2," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) > 300 FORMAT (I3," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) > 3000 FORMAT (I4," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) > 30000 FORMAT (I5," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) > > > > > > DO iatom=1,natoms > > IF (atomtype(iatom) .EQ. "C ") THEN > > IF ( iatom .LE. 9 ) WRITE (20,1) atomnumber(iatom),atomtype(iatom),kkk,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > IF ( (iatom .GE. 10 ) .AND. ( iatom .LE. 99 ) ) WRITE (20,10) atomnumber(iatom),atomtype(iatom),kkk,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > IF ( (iatom .GE. 100 ) .AND. ( iatom .LE. 999 ) ) WRITE (20,100) atomnumber(iatom),atomtype(iatom),kkk,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > IF ( (iatom .GE. 1000 ) .AND. ( iatom .LE. 9999 ) ) WRITE (20,1000) atomnumber(iatom),atomtype(iatom),kkk,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > IF ( (iatom .GE. 10000 ) .AND. ( iatom .LE. 99999 ) ) WRITE (20,10000) atomnumber(iatom),atomtype(iatom),kkk,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > > ELSE IF (atomtype(iatom) .EQ. "OW ") THEN > > IF ( iatom .LE. 9 ) WRITE (20,2) atomnumber(iatom),atomtype(iatom),nnn,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > IF ( (iatom .GE. 10 ) .AND. ( iatom .LE. 99 ) ) WRITE (20,20) atomnumber(iatom),atomtype(iatom),nnn,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > IF ( (iatom .GE. 100 ) .AND. ( iatom .LE. 999 ) ) WRITE (20,200) atomnumber(iatom),atomtype(iatom),nnn,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > IF ( (iatom .GE. 1000 ) .AND. ( iatom .LE. 9999 ) ) WRITE (20,2000) atomnumber(iatom),atomtype(iatom),nnn,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > IF ( (iatom .GE. 10000 ) .AND. ( iatom .LE. 99999 ) ) WRITE (20,20000) atomnumber(iatom),atomtype(iatom),nnn,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > > ELSE IF (atomtype(iatom) .EQ. "HW ") THEN > > IF ( iatom .LE. 9 ) WRITE (20,3) atomnumber(iatom),atomtype(iatom),lll,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > IF ( (iatom .GE. 10 ) .AND. ( iatom .LE. 99 ) ) WRITE (20,30) atomnumber(iatom),atomtype(iatom),lll,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > IF ( (iatom .GE. 100 ) .AND. ( iatom .LE. 999 ) ) WRITE (20,300) atomnumber(iatom),atomtype(iatom),lll,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > IF ( (iatom .GE. 1000 ) .AND. ( iatom .LE. 9999 ) ) WRITE (20,3000) atomnumber(iatom),atomtype(iatom),lll,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > IF ( (iatom .GE. 10000 ) .AND. ( iatom .LE. 99999 ) ) WRITE (20,30000) atomnumber(iatom),atomtype(iatom),lll,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > END IF > > END DO > END DO > CLOSE(20) > > > END PROGRAM density > > > Actually I used the above code to change the steps of the file #2 in a sequence order to file #1. (imagine that 0 step in #2 should be changed to the last steps in #1 +500) (the steps changes with increment of 500) > > Finally through "cat file#2 >> file#1" command I append the file #1 to the end of file #2. > > the appended file makes error. The code you have posted does the following. Open file wat.dat read contents of wat.dat into memory. Open file wat-00.dat Write contents of memory to wat-00.dat OVERWRITING the current contents of wat00-dat! Please re-read my first reply. If you want to add the data from wat.dat to the end of wat-00.dat then you need to open wat-00.dat positioned ready to "append" to it. i.e. use position='append' in the open statement. Also look at using format "i0" which will eliminate the need for all except one of the separate formats. Les

0 |

5/10/2016 1:52:38 PM

On Tuesday, May 10, 2016 at 10:52:41 PM UTC+9, Les Neilson wrote: > On Tuesday, May 10, 2016 at 1:09:08 PM UTC+1, maji...@gmail.com wrote: > > On Tuesday, May 10, 2016 at 8:50:07 PM UTC+9, Les Neilson wrote: > > > On Tuesday, May 10, 2016 at 12:08:38 PM UTC+1, maji...@gmail.com wrote: > > > > Dear all, > > > > > > > > greeting.. > > > > > > > > Could you please let me know how can I resolve the below error as? > > > > > > > > forrtl: severe (59): list-directed I/O syntax error > > > > > > > > I have 2 large files that I need to combine them together (file #2 should be appended to the file #1). I did it and everything seems fine BUT when I want to compile it the above error happens. > > > > > > > > I would be highly appreciated if let me know how to get rid of it. > > > > > > > > Thanks in advance > > > > > > FAQ Rule #0 : > > > Show the code you have written, or at least as much as demonstrates the problem. > > > For example show the declaration of the variables you use for reading and writing the data (integer, character etc.) > > > Show the "open" statements for the two files. > > > Show the read and write statements. > > > > > > Hopefully you will have opened file#1 using position='append' then all you need to do is read file#2 and write to file#1 > > > > > > Once we see the code we should be better able to help you. > > > > > > Les > > > > Dear Les, > > > > Thank you for reply. > > > > I have 2 large files with same format as below (#1 with 120000 and #2 with 80000 steps) > > > > ITEM: TIMESTEP > > 0 ! this is my steps which changes > > ITEM: NUMBER OF ATOMS > > 6464 > > ITEM: BOX BOUNDS pp pp pp > > -15 15 > > -15 15 > > -115 115 > > ITEM: ATOMS id element type x y z vx vy vz fx fy fz > > 1 C 1 4.5 0 -115 0 0 0 0 0 0 > > 2 C 1 4.3001 1.3264 -115 0 0 0 0 0 0 > > 3 C 1 3.7181 2.5349 -115 0 0 0 0 0 0 > > 4 C 1 2.8057 3.5182 -115 0 0 0 0 0 0 > > 5 C 1 1.644 4.1889 -115 0 0 0 0 0 0 > > 6 C 1 0.3363 4.4874 -115 0 0 0 0 0 0 > > ...... > > > > > > here is my code > > > > > > > > nsteps=501 ! > > natoms=6034 ! > > length=170.0 ! > > !################################################################################################! > > > > ALLOCATE(pp(nsteps),atomtype(natoms),atomnumber(natoms),XXX(nsteps,natoms,1:3),VVV(nsteps,natoms,1:3),FFF(nsteps,natoms,1:3)) > > pp=0 > > > > > > OPEN (10,FILE="wat.dat") > > > > DO istep=1,nsteps > > > > READ(10,*) header1 > > READ(10,*) stepnumber > > READ(10,*) header2 > > READ(10,*) nnatoms > > READ(10,*) header3 > > READ(10,*) irubbish1,box1 > > READ(10,*) irubbish2,box2 > > READ(10,*) irubbish3,box3 > > READ(10,*) header4 > > > > > > DO iatom=1,natoms > > READ(10,*) atomnumber(iatom), atomtype(iatom),mmm,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > > > > END DO > > END DO > > CLOSE(10) > > > > > > kkk=1 > > nnn=3 > > lll=2 > > > > OPEN (20,FILE="wat-00.dat") > > > > DO istep=1,nsteps > > > > WRITE(20,'(A14)') "ITEM: TIMESTEP" > > WRITE(20,'(I7)') (stepnumber+280000)+((istep)*500) > > WRITE(20,'(A21)') "ITEM: NUMBER OF ATOMS" > > WRITE(20,'(I4)') nnatoms > > WRITE(20,'(A25)') "ITEM: BOX BOUNDS pp pp pp" > > WRITE(20,'(I4,1X,I4)') irubbish1,box1 > > WRITE(20,'(I4,1X,I4)') irubbish2,box2 > > WRITE(20,'(I4,1X,I4)') irubbish3,box3 > > WRITE(20,'(A51)') "ITEM: ATOMS id element type x y z vx vy vz fx fy fz"! > > > > > > !! THE FORMATS NEED TO BE MODIFIED ANT TIME YOU USE NEW LAMMPS OUTPUT > > > > 1 FORMAT (I1," ",A2,I1," ", F9.4," ",F9.4," ",F9.4," ",I1," ",I1," ",I1," ",I1," ",I1," ",I1) > > 10 FORMAT (I2," ",A2,I1," ", F9.4," ",F9.4," ",F9.4," ",I1," ",I1," ",I1," ",I1," ",I1," ",I1) > > 100 FORMAT (I3," ",A2,I1," ", F9.4," ",F9.4," ",F9.4," ",I1," ",I1," ",I1," ",I1," ",I1," ",I1) > > 1000 FORMAT (I4," ",A2,I1," ", F9.4," ",F9.4," ",F9.4," ",I1," ",I1," ",I1," ",I1," ",I1," ",I1) > > 10000 FORMAT (I5," ",A2,I1," ", F9.4," ",F9.4," ",F9.4," ",I1," ",I1," ",I1," ",I1," ",I1," ",I1) > > > > 2 FORMAT (I1," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) > > 20 FORMAT (I2," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) > > 200 FORMAT (I3," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) > > 2000 FORMAT (I4," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) > > 20000 FORMAT (I5," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) > > > > > > 3 FORMAT (I1," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) > > 30 FORMAT (I2," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) > > 300 FORMAT (I3," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) > > 3000 FORMAT (I4," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) > > 30000 FORMAT (I5," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) > > > > > > > > > > > > DO iatom=1,natoms > > > > IF (atomtype(iatom) .EQ. "C ") THEN > > > > IF ( iatom .LE. 9 ) WRITE (20,1) atomnumber(iatom),atomtype(iatom),kkk,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > > IF ( (iatom .GE. 10 ) .AND. ( iatom .LE. 99 ) ) WRITE (20,10) atomnumber(iatom),atomtype(iatom),kkk,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > > IF ( (iatom .GE. 100 ) .AND. ( iatom .LE. 999 ) ) WRITE (20,100) atomnumber(iatom),atomtype(iatom),kkk,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > > IF ( (iatom .GE. 1000 ) .AND. ( iatom .LE. 9999 ) ) WRITE (20,1000) atomnumber(iatom),atomtype(iatom),kkk,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > > IF ( (iatom .GE. 10000 ) .AND. ( iatom .LE. 99999 ) ) WRITE (20,10000) atomnumber(iatom),atomtype(iatom),kkk,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > > > > ELSE IF (atomtype(iatom) .EQ. "OW ") THEN > > > > IF ( iatom .LE. 9 ) WRITE (20,2) atomnumber(iatom),atomtype(iatom),nnn,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > > IF ( (iatom .GE. 10 ) .AND. ( iatom .LE. 99 ) ) WRITE (20,20) atomnumber(iatom),atomtype(iatom),nnn,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > > IF ( (iatom .GE. 100 ) .AND. ( iatom .LE. 999 ) ) WRITE (20,200) atomnumber(iatom),atomtype(iatom),nnn,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > > IF ( (iatom .GE. 1000 ) .AND. ( iatom .LE. 9999 ) ) WRITE (20,2000) atomnumber(iatom),atomtype(iatom),nnn,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > > IF ( (iatom .GE. 10000 ) .AND. ( iatom .LE. 99999 ) ) WRITE (20,20000) atomnumber(iatom),atomtype(iatom),nnn,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > > > > ELSE IF (atomtype(iatom) .EQ. "HW ") THEN > > > > IF ( iatom .LE. 9 ) WRITE (20,3) atomnumber(iatom),atomtype(iatom),lll,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > > IF ( (iatom .GE. 10 ) .AND. ( iatom .LE. 99 ) ) WRITE (20,30) atomnumber(iatom),atomtype(iatom),lll,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > > IF ( (iatom .GE. 100 ) .AND. ( iatom .LE. 999 ) ) WRITE (20,300) atomnumber(iatom),atomtype(iatom),lll,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > > IF ( (iatom .GE. 1000 ) .AND. ( iatom .LE. 9999 ) ) WRITE (20,3000) atomnumber(iatom),atomtype(iatom),lll,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > > IF ( (iatom .GE. 10000 ) .AND. ( iatom .LE. 99999 ) ) WRITE (20,30000) atomnumber(iatom),atomtype(iatom),lll,XXX(istep,iatom,1:3),VVV(istep,iatom,1:3),FFF(istep,iatom,1:3) > > END IF > > > > END DO > > END DO > > CLOSE(20) > > > > > > END PROGRAM density > > > > > > Actually I used the above code to change the steps of the file #2 in a sequence order to file #1. (imagine that 0 step in #2 should be changed to the last steps in #1 +500) (the steps changes with increment of 500) > > > > Finally through "cat file#2 >> file#1" command I append the file #1 to the end of file #2. > > > > the appended file makes error. > > The code you have posted does the following. > Open file wat.dat > read contents of wat.dat into memory. > Open file wat-00.dat > Write contents of memory to wat-00.dat OVERWRITING the current contents of wat00-dat! > > Please re-read my first reply. > If you want to add the data from wat.dat to the end of wat-00.dat then you need to open wat-00.dat positioned ready to "append" to it. i.e. use position='append' in the open statement. > Also look at using format "i0" which will eliminate the need for all except one of the separate formats. > > Les Dear Les, Many thanks for your help. The position="append" could resolve my problem.:)) Thanks in advance

0 |

5/10/2016 11:08:16 PM

On Tuesday, May 10, 2016 at 4:08:38 AM UTC-7, maji...@gmail.com wrote: > Could you please let me know how can I resolve the below error as? > forrtl: severe (59): list-directed I/O syntax error > I have 2 large files that I need to combine them together (file #2 should be > appended to the file #1). I did it and everything seems fine BUT when > I want to compile it the above error happens. This is a run-time error, so should not happen when you compile, but when you run. The error comes from reading data with list-directed READ (that is, with a * for format), when the data isn't appropriate. Reading alphabetic data into a numeric variable will usually do it. (Not always if the alphabetic data is D or E.) There are some easy off-by-one errors to make, such that you are reading things into the wrong variable.

0 |

5/10/2016 11:38:04 PM

(snip) > Many thanks for your help. The position="append" could resolve my problem.:)) Since you are using "cat file#2 >> file#1" to combine your files, position="append" will remove the need for cat, but in most cases won't fix the problem. There are some problems that occur when appending files that otherwise would be fine, related to the exact ending of one, and the beginning of the next. You have to be very careful when using list-directed read on CHARACTER data that isn't in quotes. (Well, apostrophes.) I am not sure what it does with blank lines, but it could even be that an extra blank line would get the count wrong. I suspect, though, that you will see the problem if you look at the file. After the append, look at the file at the point where the old and new meet. Does it look right? Otherwise, consider one of your FORMAT statements: 3 FORMAT (I1," ",A2,I2," ", F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F10.6," ",F14.6,F14.6,F14.6) Note that the A2 is right next to the I2. If the I2 is actually a two digit number, or negative, there is no space. It is really easy to get this wrong, but usually easy to see looking at the data.

0 |

5/11/2016 12:03:45 AM