Home>
    real*8 function f1(x,y,z,i)
              implicit none
              integer :: i
              integer,parameter :: n=14610
              real*8 :: x,y,z,xj(n),yj(n),zj(n),r,rm,rj
              real*8,parameter :: gs=40.3396d0,gj=3.8603d-2
              r=sqrt(x*x+y*y+z*z)
              rm=sqrt((xj(i)-x)*(xj(i)-x)+(yj(i)-y)*(yj(i)-y)+
   &(zj(i)-z)*(zj(i)-z))
              rj=sqrt(xj(i)*xj(i)+yj(i)*yj(i)+zj(i)*zj(i))
              f1=-gs*x/(r*r*r)+gj((xj(i)-x)/(rm*rm*rm)-xj(i)/(rj*rj*rj))
              return
      end function f1


I created a function subprogram like this,

f1=-gs*x/(r*r*r)+gj((xj(i)-x)/(rm*rm*rm)-xj(i)/(rj*rj*rj))
(1)
unclassifiable statement at (1) f90


And an error is displayed.
The compiler is gfortran.
I've never created a function subprogram so far, and compared them, but I'm having trouble understanding where the cause of the error is.
I think I've learned how to embed an array in a function. Isn't this way bad?