C:\fortranVS-Model\0986\main.f95|37|Error: Array 'f' cannot have a deferred shape|
program main
integer, parameter :: n = 3, nsteps = 100
real, parameter :: a = 0.0, b =1.0
real :: x(0:n)
real :: d, hbar,W,omega0,omega,gamma1, E, delta
d=3.335641E-30
hbar=1.0546e-34
omega = 2.482/(6.24e18*hbar)
W = 1.25e10
omega0= 2.4743/(6.24e18*hbar)
delta=0.0
gamma1= 1E15
E=(1/hbar)*W;
x = (/1.0, 0.0, 0.0,0.0/)
h = (b - a)/nsteps
call rk4sys(n,h,x,nsteps)
end program main
subroutine xpsys(n,x,f)
complex, dimension (0:n) :: x, f
integer n
f(0)= (-(0., 1.))*d*x(1)*E - x(2)*E+gamma1*x(4) ! 00+
f(1)= ((0., -1.)*(x(2)*(delta)+ d*E*(x(0)- x(3)))-gamma1*x(2)/2)!11
f(2)= (0., 1.)*(x(2)*(delta)+ d*E*(x(0)- x(3)))-gamma1*x(2)/2!10
f(3)= (0., 1.)*d*(x(1)*E- x(2)*E)-gamma1*x(3)!01
end subroutine xpsys
subroutine rk4sys(n,h,x,nsteps)
complex(8) :: x(0:n), f(:,:)
real, allocatable :: y(:)
integer :: i, k, n
real :: h
print *,0,x
allocate (y(0:n), f(0:n,4))
out: do k = 1,nsteps
call xpsys(n,x,f(0,1))
in1: do i = 0,n
y(i) = x(i) + 0.5*h*f(i,1)
end do in1
call xpsys(n,y,f(0,2))
in2: do i = 0,n
y(i) = x(i) + 0.5*h*f(i,2)
end do in2
call xpsys(n,y,f(0,3))
in3: do i = 0,n
y(i) = x(i) + h*f(i,3)
end do in3
call xpsys(n,y,f(0,4))
in4: do i = 0,n
x(i) = x(i) + (h/6.0)* (f(i,1) + 2.0*(f(i,2) + f(i,3)) + f(i,4))
end do in4
print *, k, x
end do out
end subroutine rk4sys