yuedu
yuedu

Reputation: 9

Fortran "Error: The shapes of the array expressions do not conform."

I know someone has asked a similar question. It said that the error maybe come from trying to assign an array to a scalar. I checked my program again and again as it said but I really don't find any wrong with my program.

The specific error message is:

D:\src\fortran\Kramers\kramers.f90(54) : Error: The shapes of the array expressions do not conform. [Y2] y2(1)=sqrt(2.0d0*T)*[h*omega(2)-h1*omega(3)+h1*h*omega(4)-h1*h1*omega(6)+& ----------------^
D:\src\fortran\Kramers\kramers.f90(65) : Error: The shapes of the array expressions do not conform. [Y2] y2(2)=sqrt(2.0d0*T)*[omega(1)-h*omega(2)+h*h*omega(3)-h1*h*omega(4)+h1*h1*omega(6)+& ----------------^
Error executing df.exe.

kramers.obj - 2 error(s), 0 warning(s)

This is the part of my program which causes the error:

real*8 :: y(2),y2(2),omega(10),V4

real*8 :: h,h1,T,ngt

real*8,external :: V,V1,V2,V3

y2(1) = sqrt(2.0d0*T)*[h*omega(2) - h1*omega(3) + h1*h*omega(4) - h1*h1*omega(6) + &
    (-h1*h*omega(4) + 2.0d0*h1*h1*omega(6))*V2(y(1)) - h1*h1*y(2)*omega(10)*V3(y(1))]

y2(2) = sqrt(2.0d0*T)*[omega(1) - h*omega(2) + h*h*omega(3) - h1*h*omega(4) + h1*h1*omega(6) + &
    (-h*h*omega(3) + 2*h1*h*omega(4) - 3*h1*h1*omega(6))*V2(y(1)) + &
    (-h1*h*y(2)*omega(5) + h1*h1*y(2)*omega(7) + h1*h1*y(2)*omega(8) + h1*h1*y(2)*omega(10))*V3(y(1)) + &
    h1*h1*V2(y(1))*V2(y(1))*omega(6) + h1*h1*V1(y(1))*V3(y(1))*omega(8) - 0.5d0*h1*h1*V4*y(2)*y(2)] - h1*h*T*V3(y(1))*ngt

Upvotes: 0

Views: 1878

Answers (1)

You use square brackets [] which denote an array constructor. You have to use normal ones ().

Upvotes: 4

Related Questions