problem with a fortran program


by selmayda
Tags: fortran, program
selmayda
selmayda is offline
#1
Nov23-12, 08:55 AM
P: 9
Hi;
I am trying to run a program which includes;

call AB
write(6,*) 'finished AB'
c---------
call ABp(Vup,gup)
call ABp(Vdn,gdn)
write(6,*) 'finished ABp'
c------------------------------------------------------------------
c do warmup sweeps
c-----

accept = 1
reject = 0

do 410 i = 1, iwarm
call sweep(i)
if (mod(i,10).eq.0) then
write(6,*) 'warmup sweep = ',i
endif
410 continue
write(6, *) 'after warmups, accept ratio = ',
1 float( accept ) / (accept+reject)
write(46,*)
write(46,*) 'after warmups, accept ratio = ',
1 float(accept)/(accept+reject)
c--------------------------------------------------------------------------

but I see an error message ;
multi0.f: In program `multi':
multi0.f:97:
write(6,*) 'accept ratio ='
1
multi0.f:98: (continued):
1 float(accept) / (accept+reject)
2
Invalid radix specifier `float' at (2) for typeless constant at (1)
multi0.f:98:
1 float(accept) / (accept+reject)
1 2
Concatenation operator at (1) must operate on two subexpressions of character type, but the subexpression at (2) is not of character type
mv: cannot stat `a.out': No such file or directory
c----------------------------------------------------------------------

what is the meaning of this message?

thanks.
Phys.Org News Partner Science news on Phys.org
Better thermal-imaging lens from waste sulfur
Hackathon team's GoogolPlex gives Siri extra powers
Bright points in Sun's atmosphere mark patterns deep in its interior
SteamKing
SteamKing is online now
#2
Nov23-12, 11:24 AM
HW Helper
Thanks
P: 5,541
It would be helpful to see the entire program.
gsal
gsal is offline
#3
Nov23-12, 02:21 PM
P: 838
You may want to make your calculation of float(accept)/(accept+reject) previous to the write statement, assign the results to a single variable and print out such variable without any typecasting or anything.

Mark44
Mark44 is online now
#4
Nov23-12, 06:59 PM
Mentor
P: 20,970

problem with a fortran program


I'm reasoably sure that the errors are cause by these lines of code:
write(6, *) 'after warmups, accept ratio = ',
1 float( accept ) / (accept+reject)
write(46,*)
write(46,*) 'after warmups, accept ratio = ',
1 float(accept)/(accept+reject)
Fortran is very picky about splitting lines of code. Either put each write statement on its own line for the entire statement, or use the continuation character, & or +.


Register to reply

Related Discussions
help with a FORTRAN program Programming & Computer Science 0
need help about FORTRAN program Mechanical Engineering 7
help with fortran program Programming & Computer Science 6
running a Fortran 77 program in a C++ enviorment/program Programming & Computer Science 2
problem in fortran program Programming & Computer Science 0