How to call FORTRAN from Python

From InterSciWiki
Jump to: navigation, search


DRW FORTRAN into Python Projects

HOWTO convert a commandline FORTRAN program to a GUI Python program by Harry Mangalam, UCI

Harry, may I post this on my instructional/research wiki? Its just what I need, some of my students too... - Show quoted text -

On Thu, Jul 31, 2008 at 11:07 AM, Harry Mangalam <> wrote:

   >From the intro at CaR (Computers and Research) talk:
   Despite many reports of its demise, FORTRAN remains quite alive. For
   straight numerical computation, FORTRAN compilers are among the best
   available and there are a number of Open Source FORTRAN compilers
   available - F77, GNU FORTRAN, G95 are the ones that roll off the tip
   of my brain immediately. The Intel FORTRAN compiler for Linux,
   MacOSX, and Windows is also free for academic use and is very fast on
   Intel hardware.
   However, despite its advantages for numerical code, it's not a
   particularly attractive program for dealing with humans. Handling
   commandline options, interfacing with GUI widget sets, and connecting
   with relational databases are among those things it's not
   particularly suited for.
   In order to make existing FORTRAN programs more amenable to current
   uses, I've written a HOWTO on wrapping a FORTRAN program with Python,
   to use Python's interoperations with other programming languages, and
   other abilities to make for a more usable experience. It requires
   almost no modification of the existing FORTRAN code besides
   converting the main function into a callable subroutine (generally a
   1 line modification). The FORTRAN code continues to run as fast as it
   ever did but using Python, you can easily add many features to the
   FORTRAN that would otherwise be quite difficult.
   The HOWTO is currently hosted here:
   Thanks to Vladimir Mandelshtam for allowing his code to be used as the
   basis for this HOWTO.
   -- Harry Mangalam - Research Computing, NACS, E2148, Engineering Gateway,
   UC Irvine 92697  949 824-0084(o), 949 285-4487(c)

This is what I did so far

Doug White to Harry M

Login under your real name and edit as you please and create other pages as you please thanks, Doug White