Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

namelist problem

559 views
Skip to first unread message

rudra

unread,
Nov 20, 2009, 4:46:08 AM11/20/09
to
Hello friends,
I was trying to compile my code having a namelist exiting with an
error:

gfortran -c -O3 -static -fopenmp param.f90
param.f90:78.66:

namelist / alloy_spec / z_a,x,z_b,y,nscf,c_b,c_a,fil!,latt
1
Error: Unexpected NAMELIST statement at (1)
param.f90:80.29:

read(8,NML=alloy_spec)
1
Error: Symbol 'alloy_spec' at (1) must be a NAMELIST group name
make: *** [param.o] Error 1

and the corresponding code snippet is:

CONTAINS

subroutine more()
use kinds

!This is the default to be used for calculation
!with Na_{50}Mg_{50}....firts 2 metal in PT
z_a=11; x=.5;z_b=12;y=.5;c_a=10;c_b=10;nscf=10
fil="Default calculation with NaMg!! Be sure you want this"

!User Specified value for the calculation
namelist / alloy_spec / z_a,x,z_b,y,nscf,c_b,c_a,fil!,latt
open(8,file='alloy_spec.in

')
read(8,NML=alloy_spec)
close(8)


but if I just comment out the line
z_a=11; x=.5;z_b=12;y=.5;c_a=10;c_b=10;nscf=10
fil="Default calculation with NaMg!! Be sure you want this"

and make the namelist the first executable statement, then it works
fine. I saw the std(section 5.6) and there is nothing as such.
what is the problem?

rudra

unread,
Nov 20, 2009, 4:51:18 AM11/20/09
to

James Van Buskirk

unread,
Nov 20, 2009, 4:53:23 AM11/20/09
to
"rudra" <bnrj....@gmail.com> wrote in message
news:2c3f2196-5888-48cf...@a32g2000yqm.googlegroups.com...

> I was trying to compile my code having a namelist exiting with an
> error:

> gfortran -c -O3 -static -fopenmp param.f90
> param.f90:78.66:

> namelist / alloy_spec / z_a,x,z_b,y,nscf,c_b,c_a,fil!,latt

> Error: Unexpected NAMELIST statement at (1)

> but if I just comment out the line


> z_a=11; x=.5;z_b=12;y=.5;c_a=10;c_b=10;nscf=10
> fil="Default calculation with NaMg!! Be sure you want this"

> and make the namelist the first executable statement, then it works
> fine. I saw the std(section 5.6) and there is nothing as such.
> what is the problem?

NAMELIST statements are specification statements, not executable
statements. Group them with the other specification statements.

--
write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
6.0134700243160014d-154/),(/'x'/)); end


Richard Maine

unread,
Nov 20, 2009, 6:21:46 AM11/20/09
to
James Van Buskirk <not_...@comcast.net> wrote:

> "rudra" <bnrj....@gmail.com> wrote in message
> news:2c3f2196-5888-48cf...@a32g2000yqm.googlegroups.com...

> > and make the namelist the first executable statement, then it works


> > fine. I saw the std(section 5.6) and there is nothing as such.
> > what is the problem?
>
> NAMELIST statements are specification statements, not executable
> statements. Group them with the other specification statements.

And possibly to clarify, no you did not make the namelist statement "the
first executable statement." It is never an executable statement. You
made it the last specification statement.

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain

rudra

unread,
Nov 20, 2009, 1:35:52 PM11/20/09
to
ok...i got it! confusion was more because some other compiler don't
follow this restriction and was compiling it well enough even if I do
not comment out the lines.
thanks

robin

unread,
Nov 21, 2009, 1:27:02 AM11/21/09
to
Haveyouthoughtofputtingspacesinyourcode?
Makesiteasiertoread.

"rudra" <bnrj....@gmail.com> wrote in message
news:2c3f2196-5888-48cf...@a32g2000yqm.googlegroups.com...

yur...@gmail.com

unread,
Apr 19, 2016, 3:43:04 PM4/19/16
to
пятница, 20 ноября 2009 г., 14:21:46 UTC+3 пользователь Richard Maine написал:
You helped me very much, thank's
0 new messages