I'm new to FORTRAN, and getting this error #6404.
my_file.f(11): error #6404: This name does not have a type, and must have an explicit type.
[POTENCIAL] d=POTENCIAL(1.0,1.0,1.0,1.0,1.4,1.4)
This is with the ifort compiler, and I hope it is not a compiler bug.
Any ideas where I'm wrong?
program iiuu
implicit none
REAL*8 d
d=POTENCIAL(1.0,1.0,1.0,1.0,1.4,1.4)
write(*,*) 'potential=', d
END program iiuu
FUNCTION POTENCIAL(R1,R2,R3,R4,R5,R6)
REAL*8 R1,R2,R3,R4,R5,R6,V2,V3,V4
DIMENSION R(6)
R(1)=R1
R(2)=R2
R(3)=R3
R(4)=R4
R(5)=R5
R(6)=R6
V2=V2BODY(R)
V3=V3BODY(R)
V4=V4BODY(R)
POTENCIAL=V2+V3+V4+VADD(R)
RETURN
END
FUNCTION V2BODY(R)
.....
.....
The likely cause of this error is that the processor attempted to parse the contents of the external input file that you provided to the ParaMonte routines. However, while doing do, it reached the end of file before completing the input file reading.
Most errors in Fortran routines can be identified by the information provided in Fortran runtime messages, which begin with the prefix "FOR". The Fortran compiler cannot identify all possible errors.
Floating-Point Exceptions and Fortran In general, a message results if any one of the invalid, division-by-zero, or overflow exceptions have occurred. Inexact exceptions do not generate messages because they occur so frequently in real programs.
If you wish execution of your program to cease, you can insert a stop statement.
No, it is not a compiler bug. Here's an edit of your code which has at least a chance of compiling:
program iiuu
implicit none
REAL*8 d
d=POTENCIAL(1.0d0,1.0d0,1.0d0,1.0d0,1.4d0,1.4d0)
write(*,*) 'potential=', d
contains
real*8 FUNCTION POTENCIAL(R1,R2,R3,R4,R5,R6)
REAL*8 R1,R2,R3,R4,R5,R6,V2,V3,V4
real*8, DIMENSION(6) :: R
R(1)=R1
R(2)=R2
R(3)=R3
R(4)=R4
R(5)=R5
R(6)=R6
V2=V2BODY(R)
V3=V3BODY(R)
V4=V4BODY(R)
POTENCIAL=V2+V3+V4+VADD(R)
END function potencial
END program iiuu
potencial
function did not have a return type (which is the original error message you came across)return
statement was not necessary)modules
and use
them, or use contains
statement, like in the example above1.0
is single-precision. Use 1.d0
to tell the compiler it's a double precision numberpotencial
function?I got it to work. Just changed it to correct data type representation. The rest still the same.
program iiuu
IMPLICIT none
REAL*8 d, POTENCIAL
d=POTENCIAL(1.0d0,1.0d0,1.0d0,1.0d0,1.4d0,1.4d0)
write(*,*) 'potential=', d
END program iiuu
FUNCTION POTENCIAL(R1,R2,R3,R4,R5,R6)
IMPLICIT REAL*8(A-H,O-Z)
DIMENSION R(6)
R(1)=R1
R(2)=R2
......
......
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With