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

running intel fortran on a macOS BigSur (version 11.7.6)

metzgeriana
Beginner
1,502 Views

I have been working on atom-in-molecule polarizabilities using CNDOP, a program much modified  from CNINDO (CNINDO was first written about 1970 by Paul Dobosch in the group of John A. Pople). I am using a Mac laptop (MacOS Big Sur  version 11.7.6).

Intel keeps improving its Fortran. It used to have a messy library call for the run-time Fortran program library. Instead, to provide automatic access from the FORTRAN compiler to the library, I installed oneAPI HPB Toolkit (version 2023.1) inter-oneapi-ifort-runtime-2023.1.0.43547, and then installed ifort (version of March 2023).

A simple numbering program num.FOR was written to

(i) access a short data set, called CNI.txt with alphanumeric text written by Microsoft Word, with margins set between columns 1 and 72 (old Hollerith “IBM” card convention) and FORTRAN commands entered between  column 7 and 72, and statement numbers entered between column 1 on 5, and comment cards designated as a comment by a “C” in column 1.

(ii)  copy the lines of CNI.txt one at time and place them into file FOR.06, but append “CNI” in columns 73,74, and 75, and line numbers right-justified in columns 76 to 80.

BEG 1 = = = = = FORTRAN program num.FOR

C234567          

      CHARACTER*1 A(72)

      LINPUT=05                                                         

      OPEN (UNIT=5,FILE='desktop/CNI.txt',STATUS='OLD')        

      LOUTPT=06                                                       

      OPEN (UNIT=6,FILE='desktop/FOR.06',STATUS='REPLACE')

      DO 4 I=1,500

         READ (LINPUT,1) (A(K),K=1,72)

    1    FORMAT (72A1)

         WRITE (LOUTPT,2) I

    2    FORMAT (' READING LINE NUMBER',I5)

         WRITE (LOUTPT,3) (A(K),K=1,72),I

    3    FORMAT (72A1,'CNI',I5)

    4 CONTINUE

    5 STOP

      END

END 1 = = = = = FORTRAN program num.FOR

The  input data (file CNI.txt) are:

BEG  2  = = = = = data file CNI.txt

             BLOCK DATA

             COMMON/ORB/ORB(9)

             COMMON/PERTBL/EL(18)

             COMMON /OPTION/OPTION,OPNCLO,HUCKEL,CNDO,I NDO,CLOSED,OPEN

             INTEGER OPTION,OPNCLO,HUCKEL,CNDO,INDO,CLOSED,OPEN

             INTEGER ORB,EL

             DATA CNDO/'CNDO'/

             DATA INDO/'INDO’/

             DATA OPEN/’OPEN'/

             DATA CLOSED/’CLSD'/

             DATA ORB/’  S’,'  PX','  PY','  PZ',' DZ2',' DXZ’,’ DYZ','DX-Y',

           1' DXY’/

C234567

             DATA EL/’  H’,’  HE’,’  LI’,’  BE’,’   B’,’   C’,’   N’,’   O’,

  •    ’   F’,’  NE’,’  NA’,’  MG’,’  AL’,’  SI’,’   P’,’   S’,

     2      ’  CL’,’  AR’/

             END

C           PROGRAM CNINDO

             IMPLICIT REAL*8(A-H,O-Z)

             COMMON/ARRAYS/ABC(19200)

             COMMON/INFO/NATOMS,CHARGE,MULTIP,AN(39),C(35,3),N

             COMMON /PERTBL/EL(18)

             COMMON /ORB/ORB(9)

             COMMON/GAB/XYZ(2000)

             COMMON/INFO1/CZ(35),U(80),ULIM(35),LLIM(35),NELECS,OCCA,OCCB

             COMMON /OPTION/OPTION,OPNCLO,HUCKEL,CNDO,INDO,CLOSED,OPEN

             COMMON /AUXINT/A(17),B(17)

             INTEGER OPTION,OPNCLO,HUCKEL,CNDO,INDO,CLOSED,OPEN

             INTEGER ORB,EL,AN,CHARGE,CZ,U,ULIM,OCCA,OCCB

C          INPUT IS READ IN THE  FOLLOWING ORDER

C     (1) AN IDENTIFICATION CARD WH!CH 1s PRINTED AT THE BEGINNING OF THE RUN

C     (2) OPTION (WAVE FUNCTION OPTION) AND OPNCLO(OPEN OR CLOSED SHELL)

C          THE FORMAT IS A4,1X,A4 AND THE KEY WORDS ARE·-

  1.            FOR THE WAVEVUNCTON (A4)    CNDO    INOO
  2.             FOR THE OPEN-CLOSED OPTION (A6)     OPEN  CLSD 

C      (3) NATOMS, CHARGW, MULTI    FORMAT (3I4) 

C     (4) ATOMIC NUMBER, X COORDINATE, Y COORDINATE, Z COORDINATE - 1 CARD/ATOM

C          FORMAT(l4,3(3X,F12.7)

C*****************************************************************************

           LINPUT=05                                                         

           OPEN (UNIT=LINPUT,FILE='desktop/cni.DAT',STATUS='OLD')        

            LOUTPT=06                                                        

            OPEN (UNIT=LOUTPT,FILE='desktop/FOR.06',STATUS='REPLACE')        

C--------CALL DATE AND TIME: DATE COMES AS YYYYMMDD;-----------------------

C         TIME COMES AS HHMMSS.SSS

             CALL DATE_AND_TIME (B(1),B(2),B(3),DATE_TIME)

             WRITE (LOUTPT,1) LINPUT,LOUTPT, B(1),B(2)           

          1 FORMAT (' CNINDO (QCPE 141- UPDATED 23 APR 2023)'/                          

           1' R.M.METZGER, UNIV. OF ALABAMA'/' ',65('-')/                    

           2' CARD READER  INPUT  ON FORTRAN LOGICAL LINPUT=',I3/            

          3' LINE PRINTER OUTPUT ON FORTRAN LOGICAL LOUTPT=',I3/            

          4' (PARTIAL ALPHA RUNS)'/' ',69('-')/' DATE (FORMAT:YYYYMMDD)=',  

          5 A8,' TIME (FORMAT:HHMMSS.SSS)=',A10/' ',69('-'))                 

             READ (5,20) (AN(I),I=1-20)

             WRITE (6,30) (AN(I0,i=1.20)

             READ (5,40) OPTION,OPNCLO

             WRITE (6,45) OPTION,OPNCLO

              READ (5,50) NATOMS,CHARGE,MULTIP

              WRITE (6,60) NATOMS,CHARGE,MULTIP

             DO 10 I =1,NATOMS

                   READ(5,70) AN(l),C(I,1),C(I,2),C(I,3)

                  WRITE(6,70) AN(l),C(l,I),C(I,2),C(I,3)

C              CONVERSION OF COORDINATES RROM ANGSTROMS TO ATOMIC UNITS

                 DO 9 J=1,3

         9      C(I,J)= C(I,J)/0.529167D0

       10 CONTINUE     

             IF (OPTION.EQ.CNDO) GO TO  6

     1     DO 5 I= 1,NATOMS

                 IF (AN(I).LE.9) GO TO  4

     2          WRITE (6,3)

     3          FORMAT(5X,46HTHIS PROGRAM DOES NOT DO INDO CALCULATIONS FOR,

       1         51H MOLECULES CONTAINING ELEMENTS HIGHER THAN FLUORINE)

                STOP

       4   CONTINUE

       5   CONTINUE

       6  CONTINUE

            CALL COEFFT

            CALL INTGRL 

           IF (OPNCLO.EQ.OPEN) GO TO 90

   80     CALL HUCKCL 

            CALL SCFCLO

            CALL CPRINT

           GO TO 100

     90  CALL HUCKOP

           CALL SCFOPN

            CALL OPRINT

    100 CONTINUE

     20 FORMAT(20A4)

     30 FORMAT(1H1,5X,20A4)

     40 FORMAT(A4,1X,A4)

     45 FORMAT(5X,A4,1X,A4)

     50 FORMAT(3I4)

     60 FORMAT(/5X,l4,’ATOMS   CHARGE=’,I4,  MULTIPLICITY’_MUU

    70 FORMAT(I4,3(3X,F12.7

          CALL EXIT

          STOP

         END

END 2 = = = = = = = of data set CNI.txt

The command lines in Terminal are:

BEG 3 = = = = =

ifort desktop/num.FOR -o desktop/num.exe

exec desktop/num.exe

END 3= = = = =

The results on Terminal are:

BEG 4 = = = = = entries in Terminal (in red: my input)

Last login: Tue May 16 07:10:48 on ttys000

robertmetzger@Roberts-MBP ~ % ifort desktop/num.FOR -o desktop/num.exe

robertmetzger@Roberts-MBP ~ % exec desktop/num.exe

forrtl: severe (24): end-of-file during read, unit 5, file /Users/robertmetzger/desktop/CNI.txt

Image              PC                Routine            Line        Source             

num.exe            00000001066D754B  for__io_return        Unknown  Unknown

num.exe            00000001066F8EAC  for_read_seq_fmt      Unknown  Unknown

num.exe            00000001066BFCB8  MAIN__                Unknown  Unknown

num.exe            00000001066BFB6E  main                  Unknown  Unknown

 

[Process completed]

END 4 = = = = = of entries in Terminal (in red: my input)

The output on FOR.06 is:

BEG 5 = = = = = = = output file FOR.06

READING LINE NUMBER    1

  BLOCK DATA

  COMMON/ORB/ORB(9)

  COMMON/PERTBL/EL(18)

  COMMON /OPTIONCNI    1

 READING LINE NUMBER    2

                                                                        CNI    2

 READING LINE NUMBER    3

       

        IMPLICIT REAL*8(A-H,O-Z)

      COMMON/ARRAYS/ABC(19200CNI    3

END 5 = = = = = = = of output file FOR.06

 

Clearly the FORTRAN instructions are not carried out correctly...... AM I MISSING SOME ESSENTIAL LIBRARY ROUTINES?

Why do  some lines of the input file CNI.txt reproduce on output file FOR.06, but without title “CNI” and line numbers past column 72?

Am I foolish to insist one command-line mode, instead of Micsrosoft Visual Basic mode?

 

HELP !!!!

 

 

 

0 Kudos
1 Reply
Ron_Green
Moderator
1,461 Views

please attach your files.  Cut and paste from a web post adds spaces, newlines, etc.  

0 Kudos
Reply