(완료)fotran subroutine 관련 질문입니다.
포트란77 쓰고 있구요.
포트란 시작한지 7일도 안 된 초보입니다.
프로그램 맨 처음 부터 서브루틴까지 짠 것을 올려 드리면...
PROGRAM gfm_dd
IMPLICIT double precision (A-H,O-Z)
dimension R(3000),Dr(3000),G0(3000,3000),G2(3000,3000),Psi0(3000)
dimension Dpsi0(3000),Ddpsi0(3000),psi2(3000),dpsi2(3000)
dimension ddpsi2(3000),X(3000)
dimension Va(3000),Vb(3000),Vc(3000),Vd(3000),f(3000),g(3000)
Open(7,file='datain',status='unknown')
open(8,file='dataout',status='unknown')
Read(7,*) rmatch,rmax,nxin,nxout,lambda,gamm,small,m1,m2,w
b=(w**4-(2.d0*w**2)*(m1**2+m2**2)+(m1**2-m2**2)**2)/(4.d0*w**2)
*******initial 'b'*******
Nx=nxin+nxout
Drin=rmatch/dfloat(nxin)
Drout=(rmax-rmatch)/dfloat(nxout)
*******Seperate Range*******
Do 700 i=1,nx
If(i.le.nxin)then
Dr(i)=nrin
Else
Dr(i)=drout
Endif
700 continue
*******Designate 'dr'*******
R(1)=drin
Do 800 i=2,nxin
R(i)=R(i-1)+drin
800 continue
R(nxin+1)=R(nxin)+drout
Do 900 i=2,nxout
R(nxin+i)=R(nxin+i-1)+drout
900 continue
*******Designate 'r'*******
k=1
*******'k' is for counting.*******
Do 950 i=1,nxin
X(i)=sqrt(-b*R(i))
950 continue
Do 960 i=nxin+1,nx
X(i)=exp(-b*R(i))
960 continue
*******Designate 'x'*******
Subroutine potential(A,B,C,D,n,ef,dgi,bi,lam,ga)
dimension A(3000),B(3000),C(3000),D(3000),ef(3000),dgi(3000)
Do 970 i=1,n
A(i)=-bi*lam*ef(i)
B(i)=-(2**(3.d0/2.d0))*bi*ga*lam*dgi(i)
C(i)=-bi*lam*(ef(i)-2*ga*dgi(i))
D(i)=-(2**(3.d0/2.d0))*bi*ga*lam*dgi(i)
1400 continue
return
end
.
.
.
.
.
.생략
다음과 같이 서브루틴을 만들고 컴파일 해 보았더니.
다음과 같은 오류가 났습니다.
gfm_dd.f: In program `gfm_dd':
gfm_dd.f:9:
Open(7,file='datain',status='unknown')
1
gfm_dd.f:59: (continued):
Subroutine potential(A,B,C,D,n,ef,dgi,bi,lam,ga)
2
Statement at (2) invalid in context established by statement at (1)
gfm_dd.f:9:
Open(7,file='datain',status='unknown')
1
gfm_dd.f:60: (continued):
dimension A(3000),B(3000),C(3000),D(3000),ef(3000),dgi(3000)
2
Statement at (2) invalid in context established by statement at (1)
gfm_dd.f:62:
A(i)=-bi*lam*ef(i)
^
Invalid declaration of or reference to symbol `a' at (^) [initially seen at (^)]
gfm_dd.f:13:
b=(w**4-(2.d0*w**2)*(m1**2+m2**2)+(m1**2-m2**2)**2)/(4.d0*w**2)
1
gfm_dd.f:63: (continued):
B(i)=-(2**(3.d0/2.d0))*bi*ga*lam*dgi(i)
2
Invalid declaration of or reference to symbol `b' at (2) [initially seen at (1)]
gfm_dd.f:64:
C(i)=-bi*lam*(ef(i)-2*ga*dgi(i))
^
Invalid declaration of or reference to symbol `c' at (^) [initially seen at (^)]
gfm_dd.f:65:
D(i)=-(2**(3.d0/2.d0))*bi*ga*lam*dgi(i)
^
Invalid declaration of or reference to symbol `d' at (^) [initially seen at (^)]
gfm_dd.f:61:
Do 970 i=1,n
1
gfm_dd.f:68: (continued):
end
2
Statement at (2) invalid in context established by statement at (1)
gfm_dd.f:61:
Do 970 i=1,n
1
gfm_dd.f:76: (continued):
Do 1000 i=1,nx
2
Attempt to modify variable `i' at (2) while it serves as DO-loop iterator at (1)
gfm_dd.f:81:
무엇이 문제 인지 고수님들의 현답 기다리겠습니다.
전체 프로그램 파일과 오류 전체를 원하시면 댓글 달아 주시면 다시 올려 드리겠습니다.
그럼 다시한번 고수님들의 현답기다리겠습니다.
우선 960 continue 밑에
우선
960 continue
밑에end
를 넣어야 하고potential
서브루틴에서1400 continue
를970 continue
로 바꿔야 합니다.그리고 fotran이 아니고 fortran입니다. ^^
--
feel the gravity
feel the gravity
감사합니다.^^
친절한 답변 감사합니다.^^
댓글 달기