Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

where is problem in this code?

hamid_mosaddeghi
Principiante
927Visualizzazioni
I have output file and need simple code for read data that highlited and list in new file as xy (two colume for excel)

MOSADDEGHI CASE 1: 2019 Water density=0.9986
ENERGY UNITS=kjoule/mol
200 2.000000E-01 38
-7.905859E+04 3.010087E+02 -9.421393E+04 1.741921E+04 -1.116331E+05
0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -8.037317E+04
0.000000E+00 3.425443E+04 -3.975877E+05 1.116268E+05 0.000000E+00
0.000000E+00 3.202153E+05 0.000000E+00 6.048000E+04 0.000000E+00
0.000000E+00 0.000000E+00 9.000000E+01 9.000000E+01 9.000000E+01
0.000000E+00 -3.562117E-01 0.000000E+00 0.000000E+00 -4.113168E-01
-8.834648E-02 -3.593858E-02 -8.834648E-02 1.376611E-01 -2.073464E-01
-3.593858E-02 -2.073464E-01 -7.949794E-01
400 4.000000E-01 38
-7.897667E+04 2.990632E+02 -9.403406E+04 1.768077E+04 -1.117148E+05
0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -7.918380E+04
0.000000E+00 3.073616E+04 -4.011339E+05 1.117082E+05 0.000000E+00
0.000000E+00 3.201619E+05 0.000000E+00 6.048000E+04 0.000000E+00
0.000000E+00 0.000000E+00 9.000000E+01 9.000000E+01 9.000000E+01
0.000000E+00 -5.612462E-02 0.000000E+00 0.000000E+00 8.705193E-01
1.079355E-01 1.559906E-01 1.079355E-01 -3.729550E-01 -5.621051E-02
1.559906E-01 -5.621051E-02 -6.659382E-01
...

original file for readattached.

I use this command for this purpose but I get error why?

##################

1.program read_data

2. implicit none

3. integer stepno, arrsiz

4. real steptime, datum

5. real, allocatable :: array(:)

6. integer iunit

7.

8. open(newunit=iunit,file='STATIS',status='old')

9. read(iunit,'()')

10. read(iunit,'()')

11. do

12. read(iunit,'(i10,f14.0,i10)',end=10) &

13. stepno,steptime,arrsiz

14. allocate(array(arrsiz))

15. read(iunit,'(5f14.0)') array

16. datum = array(36)

17. write(*,'(2(a,es14.6e2))') 'Step time =', &

18. steptime,', datum =',datum

19. deallocate(array)

20. end do

21.10 continue

22.end program read_data

######################################

after compile it (tensor.f90) with ifort I get this error:

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

tensor.f90(8): error #6640: This input/output keyword is invalid. [NEWUNIT]

open(newunit=iunit,file='STATIS',status='old')

--------^

tensor.f90(8): error #6332: A UNIT= specifier is required for this I/O operation.

open(newunit=iunit,file='STATIS',status='old')

---^

tensor.f90(12): error #6323: This label is not defined in this scoping unit. [10]

read(iunit,'(i10,f14.0,i10)',end=10) &

----------------------------------------^

compilation aborted for tensor.f90 (code 1)

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



thanks for attention.

0 Kudos
1 Soluzione
Steven_L_Intel1
Dipendente
927Visualizzazioni
NEWUNIT is a Fortran 2008 feature supported in version 12 (Intel Fortran Composer XE 2011).

Visualizza soluzione nel messaggio originale

3 Risposte
TimP
Collaboratore onorario III
927Visualizzazioni
ifort -V would tell you whether you have the 2011 version of ifort which should support this.
hamid_mosaddeghi
Principiante
927Visualizzazioni

I used:

Intel Fortran Compiler Professional for applications running on IA-32, Version 11.1 Build 20091130 Package ID: l_cprof_p_11.1.064

Copyright (C) 1985-2009 Intel Corporation. All rights reserved.

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

don't work with this version of ifort?

Steven_L_Intel1
Dipendente
928Visualizzazioni
NEWUNIT is a Fortran 2008 feature supported in version 12 (Intel Fortran Composer XE 2011).
Rispondere