Dear all, I am having a problem in the following code. The error is
In file mcmc.f90:23
function aloglike(alpha,beta)
1
Error: Unclassifiable statement at (1)
In file mcmc.f90:68
end function aloglike
1
Error: Expecting END PROGRAM statement at (1)
Can some one suggest me in this issue.
Here is my code:
module mcmc
implicit none
real::aloglike
end module mcmc
program metropoli
use mcmc
implicit none
interface
subroutine sub1(aout,bout)
use mcmc
implicit none
real, intent(out)::aout, bout
end subroutine sub1
end interface
function aloglike(alpha,beta)
real::alpha, beta, loglike
real :: dist1,dist2,prob1,prob2
integer :: t,i,j,k,l
real, dimension(1:625):: x
real, dimension(1:625):: y
integer, dimension(1:625):: inftime
!alpha = 0.5
!beta = 2.0
open(10, file = 'epidemic.txt', form = 'formatted')
do l = 1,625
read(10,*,end = 200) x(l), y(l), inftime(l)
enddo
200 continue
loglike = 0.0
do t=1,10
do i=1,625
if(inftime(i)==0 .or. t < (inftime(i)-1)) then
dist1 = 0.0
do j = 1, 625
if(t >= inftime(j) .and. inftime(j)/=0)then
dist1 = dist1 + sqrt((x(i) - x(j))**2 + (y(i) - y(j))**2)**(-beta)
endif
enddo
prob1 = 1 - exp(-alpha * dist1)
loglike = loglike + log(1 - prob1)
endif
if(inftime(i) .eq. (t+1)) then
dist2 = 0.0
do k=1, 625
if(t >= inftime(k) .and. inftime(k)/=0) then
dist2 = dist2 + sqrt((x(i) - x(k))**2 + (y(i) - y(k))**2)**(-beta)
endif
enddo
prob2 = 1 - exp(-alpha * dist2)
loglike = loglike + log(prob2)
endif
enddo
enddo
aloglike = loglike
print *,aloglike
end function aloglike
end program metropoli