Writing the main run_XXXX program

If you want to make an executable from your module, you will have to write a main program for it.

If your module is called XXXX, then the main program should be called run_XXXX.foo.

Typically, in a production module, this main program will have only a tonto initialization call, and then a call to a read routine or a main routine. For example, the run_mol.foo program looks like this:

program run_mol
! $Id: run-xxxx.html,v 1.2 2003/02/19 07:49:44 reaper Exp $

   use TYPES
   use SYSTEM
   use MOL_MAIN ,ONLY:main_

#  include "macros"

   implicit none

   MOL* :: m

   tonto.initialize
   m.main

end 

Alternatively, you can write a main program to perform a particular task. For example, the following main program run_realmat.foo solves for the eigenvalues and eigenvectors of the unit 2x2 matrix

program run_realmat
! $Id: run-xxxx.html,v 1.2 2003/02/19 07:49:44 reaper Exp $
  use TYPES
  use REALVEC
  use REALMAT

# include "macros"

  implicit none
  
  REALMAT* :: matrix
  REALMAT* :: eigenvectors
  REALVEC* :: eigenvalues

  matrix.create(2,2)
  eigenvectors.create(2,2)
  eigenvalues.create(2)

  matrix = ONE

  matrix.solve_eigenproblem(eigenvalues,eigenvectors)

  write(*,*) eigenvalues

end 

You must remember to USE those modules from which you call routines. Here we must at least use the REALVEC and REALMAT modules, since we use the create routines in REALVEC and REALMAT, and we use the solve_eigenproblem routine in REALMAT.

You can find examples of other one-off programs in the chapter called Examples of simple TONTO programs>.