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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error compiling a FORTRAN90 program

Status
Not open for further replies.

luisjromero

Technical User
Aug 1, 2012
2
MX
Hello, I'm a mexican chemistry student, and I just came here hoping someone could help me.

My professor assigned to me an extra task, make to run a fortran program, he told me I could ask anyone in the university but I better check out on the web.

Well, the program, theoretically must launch data for a three dimensional plot, it is known as Potential Energy Surface (maybe some of you heard about that), and then I should use gnuplot to plot it... My professor got that program when he read an article, the author of the article mentioned that he used a FORTRAN 90 compiler.

My professor told me that the program surely won't run on gfortran compiler for GNU/Linux, he told me it is like a FORTRAN77 compiler. He told me I should look up for a FORTRAN 90 compiler. Anyway I tryed to running it on the gfortran compiler in Ubuntu 11.10 but it launch just this:
Well, can someone say me if I need necessarily the FORTRAN 90 compiler, or if I can't run the program in the gfortran compiler because there's an error in the code?

Anyway I'll leave a link for the file pescci.f
That's the program I'm talking about. If you have a FORTRAN 90 compiler, could you try to running and say me what's wrong or what I need to do to make it run?

If you need an extra info, just say me please

Thanking you in anticipation...
 
gfortran is (at least) Fortran 95 compiler, don't worry about f90.

No main (program) unit (implicit or explicit) in the file pescci.f. In other words, it's not an executable program, it's a collection of subroutines and data...
 
Simply write to your subroutines a main program, e.g:
pescci_main.f
Code:
      program pescci_main
      implicit double precision (a-h,o-z)
      parameter (n2=5000)
      common /indy/iind(n2),jind(n2),kind(n2),ipar(n2),maxi,maxi2      
      call prepot
      write(*,*) '* Some data from common block:'
      write(*,*) 'maxi  = ', maxi
      write(*,*) 'maxi2 = ', maxi2
      end
then compile with gfortran the source files pescci_main.f and pescci.f into an executable pescci_main and then run the executable
Code:
$ gfortran pescci_main.f pescci.f -o pescci_main 

$ pescci_main 
  Using CCI H3 PES of 8/15/01
  S. L. Mielke, B. C. Garrett, and K. A. Peterson, J. Chem. Phys., in press.
 * Some data from common block:
 maxi  =           71
 maxi2 =          748
It works, but you must know what data you want to plot ...
 
Thanks, both replies were helpful, I don't know about FORTRAN, it's very helpful to know that's just a subroutine and I need a main program. I will check out the article, surely it explain exactly which data I need from the common block. Thank you so much to both. If I need an extra help, probably you see me here again.
 
luisjromero said:
which data I need from the common block

Note that the subroutine has alternate entry point:
Code:
subroutine prepot
...
return

[COLOR=red]entry pot(rvp, evp, nt)[/color]
...
return
end
I called it with
Code:
call prepot
because it was simler for me, but maybe you need to call it with
Code:
pot(rvp, evp, nt)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top