What Is the Meaning of This Fortran Error Message?

  • Context: Fortran 
  • Thread starter Thread starter selmayda
  • Start date Start date
  • Tags Tags
    Fortran Program
Click For Summary

Discussion Overview

The discussion revolves around a Fortran error message encountered while running a program. Participants explore the meaning of the error and potential solutions related to code structure and syntax, focusing on the use of write statements and typecasting in Fortran.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant requests to see the entire program to better understand the context of the error.
  • Another suggests calculating the ratio of float(accept)/(accept+reject) before the write statement and assigning it to a variable for printing, avoiding typecasting issues.
  • A different participant identifies potential causes of the errors, specifically pointing out issues with line splitting in Fortran and recommending that each write statement be placed on its own line or properly use continuation characters.

Areas of Agreement / Disagreement

Participants have not reached a consensus on the exact cause of the error, with multiple suggestions and approaches being discussed.

Contextual Notes

There are unresolved issues regarding the structure of the write statements and the handling of typecasting in the code, which may depend on specific Fortran compiler requirements.

selmayda
Messages
9
Reaction score
0
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.
 
Technology news on Phys.org
It would be helpful to see the entire program.
 
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.
 
I'm reasoably sure that the errors are cause by these lines of code:
Code:
write(6, *) 'after warmups, accept ratio = ',
1 float( accept ) / (accept+reject)[/color]
write(46,*)
write(46,*) 'after warmups, accept ratio = ',
1 float(accept)/(accept+reject)[/color]

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 +.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
Replies
22
Views
5K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
6
Views
4K
  • · Replies 3 ·
Replies
3
Views
6K
  • · Replies 3 ·
Replies
3
Views
5K