lundi 30 janvier 2017

gfortan error: Unclassifiable statement at (1) - Else if statement

I am a new Fortran user, trying to run a code that was given to me, with little instruction. When I try to compile, I get "Error: Unclassifiable statement at (1)" at every else if statement in the code. The same error does not occur for the initial if statement nor for the final else statement. Does anyone have any suggestions? Could it be to do with the line length at each of the else if statements?

      program main

  IMPLICIT REAL*8(A-H, O-Z)
  character fname1*30
c*******************************************
c***** input file: input_fslip
c*****             seismo_bellslip_100yr.dat
c***** output file: tapered_slip.dat
c*******************************************
c***** Define constants
  dimension bound(5,4),deficit(5),akb(4)

  open(1,file='input_fslip')
  rewind 1
  open(2,file='seismo_100yr.dat')
  rewind 2
  open(9,file='tapered_slip.dat')
  rewind 9

  do i=1,4
   read(1,*) (bound(j,i),j=1,5)
  end do
  read(1,*) (deficit(j),j=1,5)
cccc      read(1,*) exp_rate
  do i=1,4
   akb(i)=(bound(4,i)-bound(2,i))/(bound(3,i)-bound(1,i))
  end do

  do i=1,999999999
   read(2,*,end=900) alat,alon,depth,slipn,slipe
cccc segment D
  if(alat.le.((alon-bound(1,1))*akb(1)+bound(2,1)-bound(5,1))) then
     slipn_new = slipn * deficit(1)/100.0
     slipe_new = slipe * deficit(1)/100.0
cccc transition zone between D and C
  else if(alat.gt.((alon-bound(1,1))*akb(1)+bound(2,1)-bound(5,1)).
 *     and.alat.le.((alon-bound(1,1))*akb(1)+bound(2,1)+bound(5,1))) then
     aa=alat-((alon-bound(1,1))*akb(1)+bound(2,1)-bound(5,1))
     bb=((alon-bound(1,1))*akb(1)+bound(2,1)+bound(5,1))-alat
     ddefic=(deficit(2)*aa+deficit(1)*bb)/(aa+bb)
     slipn_new = slipn * ddefic/100.0
     slipe_new = slipe * ddefic/100.0
cccc segment C
  else if(alat.gt.((alon-bound(1,1))*akb(1)+bound(2,1)+bound(5,1)).
 *     and.alat.le.((alon-bound(1,2))*akb(2)+bound(2,2)-bound(5,2))) then
     slipn_new = slipn * deficit(2)/100.0
     slipe_new = slipe * deficit(2)/100.0

The code continues beyond here and there are several more else if statements, but I felt it unnecessary to include them, as they have similar structure. Let me know if I can provide any more info.

Thanks!

Aucun commentaire:

Enregistrer un commentaire