Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem in FORTRAN compiling

Status
Not open for further replies.

NNNM

Civil/Environmental
Joined
Dec 5, 2011
Messages
1
Location
AU
Hello,

Anybody familiar with compiling FORTRAN? I got problem when I tried to compile the code that I wrote . Below is my code :

This is the Hartman Function
c Bound: X(j)=[0,1], j=1,2,...,6
c Global Optimum:-3.322368011415515,
c (0.201,0.150,0.477,0.275,0.311,0.657)
c //////// nml implicit real*8 (a-h,o-z)
dimension x(nopt),a2(4,6),c2(4),p2(4,6),a3(4,3),c3(4),p3(4,3)
call scein(nopt)
call sceua(nopt)
c
c Open input 6D
open(unit=5,file='input.dat',status='old')
Read(5,*)a2
Read(5,*)c2
Read(5,*)p2
c
c open input Data for Hartman function coefficient (3-D)
open(unit=5,file='input2.dat',status='old')
Read(5,*)a3
Read(5,*)c3
Read(5,*)p3
c
if (nopt .gt. 6) then
write (*,*) ' ???? CHECK THE INPUT FILE ???? '
stop
end if
c
functn = 0.0
do 50 i = 1, 4
u = 0.0
do 40 j = 1, nopt
if (nopt .eq. 3) then
a2(i,j) = a3(i,j)
p2(i,j) = p3(i,j)
end if
u = u + a2(i,j) * (x(j) - p2(i,j))**2
40 continue
if (nopt .eq. 3) c2(i) = c3(i)
functn = functn - c2(i) * exp(-u)
50 continue
c
c
stop
end


After I compiled this code, I got this message
"2038-S:"Hartman.for", line 9: nopt can not be specified in a specification expression"

Any idea why this code gave me such kind of error?


Thanks,

Leni


 
The string 'nopt' appears to be an undeclared parametric constant.


Mike Halloran
Pembroke Pines, FL, USA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top