LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-09-2011, 09:05 AM   #1
physicslad78
LQ Newbie
 
Registered: Feb 2011
Posts: 2
Blog Entries: 1

Rep: Reputation: 0
Fortran Runtime error: bad real number in item 1 of list input


Hello Guys

i am new to Fortran and I am using the package Quantum espresso to get electron phonon coefficients for monolayer graphene. While applying one of the executables, I got the error:

"At line 356 of file q2r.f90 (Unit 51 "a2Fq2r.51")
Traceback not availabel: compile with -ftrace=frame or -ftrace=full. Fortran Runtime error: bad real number in item 1 of list input
 
Old 02-09-2011, 10:32 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Hi and welcome to LinuxQuestions!

This error is due to an incongruity between the input and what the code expects to find (usually in a read statement). Difficult to tell without looking at the source code and the input file. Please, can you post lines around 356th of file q2r.f90 and the first lines of the input file, a2Fq2r.51?
 
Old 02-14-2011, 08:44 AM   #3
physicslad78
LQ Newbie
 
Registered: Feb 2011
Posts: 2
Blog Entries: 1

Original Poster
Rep: Reputation: 0
Thanks very much for your reply: the lines around line 356 in the q2r.f90 file are:

REAL(DP) :: q(3,48), xq, resi
character(len=14) :: name

!
ALLOCATE (gaminp(3,3,nat,nat,48), gamout(nr1*nr2*nr3,3,3,nat,nat) )
ALLOCATE ( nc (nr1,nr2,nr3) )
write (6,*)
write (6,*) ' Preparing gamma for a2F '
write (6,*)
!
nr(1) = nr1
nr(2) = nr2
nr(3) = nr3

where line 356 is the "!" line between write and nr(1).

The first few lines in the file "a2Fq2r.51" file are:

0.005 -0.07259698305949841 0.0000022184568281107107
1

Dynamical Matrix in cartesian axes

q = ( 0.000000000 0.000000000 0.000000000 )

1 1
0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
1 2
-0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 -0.00000000 0.00000000 0.00000000 0.00000000
......

Of course the rest of the file are calculations for other points (i.e. other than the q=0, 0, 0 point).

Thanks for your help. will be waiting for a feedback
 
Old 02-14-2011, 04:23 PM   #4
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 727

Rep: Reputation: 74
Hi.

Here is a driver script that compiles a short Fortran code that, upon reading list-directed data, elicits the same error message as suggested by colucix:
Code:
#!/usr/bin/env bash

# @(#) s1	Demonstrate IO list error with Fortran.

FC=g95
FC=ifort
FC=gfortran

# Section 1, setup, pre-solution.
# Infrastructure details, environment, commands for forum posts. 
# Uncomment export command to test script as external user.
# export PATH="/usr/local/bin:/usr/bin:/bin"
set +o nounset
pe() { for i;do printf "%s" "$i";done; printf "\n"; }
pl() { pe;pe "-----" ;pe "$*"; }
C=$HOME/bin/context && [ -f $C ] && . $C specimen $FC
set -o nounset
pe

FILE=${1-data1}

# Section 2, display input file.
# Display sample of data file, with head & tail as a last resort.
pe " || start [ first:middle:last ]"
specimen $FILE \
|| { pe "(head/tail)"; head -n 5 $FILE; pe " ||"; tail -n 5 $FILE; }
pe " || end"

pl " Fortran code:"
cat p.f90

# Section 3, solution.
pl " Results, with $FC:"
rm -f a.out
SO=p.f90
$FC $SO
./a.out < $FILE

exit 0
producing:
Code:
% ./s1

Environment: LC_ALL = C, LANG = C
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
Distribution        : Debian GNU/Linux 5.0.7 (lenny) 
GNU bash 3.2.39
specimen (local) 1.17
gfortran GNU Fortran (Debian 4.3.2-1.1) 4.3.2

 || start [ first:middle:last ]
Whole: 5:0:5 of 1 lines in file "data1"
x 1.0
 || end

-----
 Fortran code:
      program main
      write(6,*) " Hello, world from fortran."
      read(*,*) a, i
      end

-----
 Results, with gfortran:
  Hello, world from fortran.
At line 3 of file p.f90 (unit = 5, file = 'stdin')
Fortran runtime error: Bad real number in item 1 of list input
The error message from gfortran (and g95) seem to fit best.

Best wishes ... cheers, makyo
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Bad Magic Number Error!!....URGENT gunjan_besu Linux - Newbie 1 09-03-2010 03:28 AM
pkgadd: ERROR: cannot start pkgserv daemon: Bad file number cghcgh Solaris / OpenSolaris 1 04-26-2010 07:25 AM
Fortran runtime error mkrems Programming 3 06-24-2008 04:42 PM
Hard Drive - Bad Inodes/superblocks - input/output error broknindarkagain Linux - Hardware 1 07-07-2006 04:41 PM
Problem in recovering deleted files (error : bad magic number) anamika123 Linux - Software 11 09-20-2004 05:55 AM


All times are GMT -5. The time now is 12:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration