Preliminary remarks

HamPath is distributed under the GNU Lesser General Public License. It is developed to work on UNIX system (Mac or Linux) but you can find here, instructions to install HamPath on Windows system.


One of the following compilers is required to use HamPath: gfortran, ifort or g95.

Tapenade is used for Automatic Differentiation. Tapenade version 3.8 is contained is the HamPath package. However, it is possible for the user to install its own version.

HamPath can be used in a fortran stand alone version or interfaced with MatlabOctave or Python. GnuPlot can be used to plot results if you use the fortran stand alone version.


HamPath (Version 3.0.7, July 2019) – HamPath user guide (version 3).



  • Unpack in your installation directory (~/install_dir for example)
  • Go into the newly extracted folder (~/install_dir/hampath3XY)
  • Launch the in a terminal
  • Enter the absolute path of Tapenade install folder if asked (~/install_dir/tapenade)
  • Choose how you want to install HamPath:

    0) Fortran stand-alone: install Hampath without interface.
    1) Matlab, via mex-files: install Hampath with a Matlab interface (make sure your mex-files are well-configured).
    2) Matlab or Octave, via text files: install HamPath with a Matlab or Octave interface with no mex command.
    3) Python, via f2py tool: install HamPath with a Python interface which needs numpy, scipy and matplotlib librairies and f2py extension tool.

  • HamPath will detect your configuration and allow you to change it if you want to (for example, you can change the detected f2py command if it works with a 2.X version of Python to a f2py working with a 3.X version of python)
  • HamPath is installed


When the installation is complete then you can try to launch a first example. Create and go into the directory you want to place your first example (we recommend to use a different directory from HamPath directory) and type in the terminal:

>> hampathCommand -example simple_shooting

 where hampathCommand is the name you gave to the executable hampath command.

See the user guide for some explanation about this example and try

>> hampathCommand -example

to get the list of the available examples. You should use one of these examples as model to create your own problem definition.


2019-07-25 : update to version 3.0.7

  • Possibility to call exphv without the iarc argument in sfun.

2019-03-07 : update to version 3.0.6

  • The Tapenade version 3.8 has been added to the HamPath package.

2018-05-24 : update to version 3.0.5

  • Introduction of a maximal homotopic parameter step-size.
  • Correction of a minor bug in the Matlab/Octave version: ssolve may return ysol as row vector instead of a column vector.

2017-08-28 : update to version 3.0.4

  • Initial corrector step during homotopy is more accurate now.
  • Debug of exphv routine which can be called in mfun routine during monitoring.
  • Debug of homotopy method when a continuation changing at least two parameters from the par vector is performed.

2017-01-19: update to version 3.0.3.

  • Add possibility to use radau for homotopy.
  • Final corrector step during homotopy is more accurate now.

2016-10-21: update to version 3.0.2.

  • Bug fixed when using radau integrator.
  • Correction of minor bugs.

2016-09-07: update to version 3.0.1.

  • HamPath prints a message when a subroutine in afun.f90 has the same signature than hfun but the output variable is an array which dimension is strictly greater than 1, i.e. a matrix for example.
  • Bug fixed for the comparison test of version between the current version on the web and the local version of HamPath.
  • Correction of minor bugs with the Python interface.

2016-09-01: new version 3.0.0.

  • efun.f90 is replaced by sfun.f90: now the user has to code the shooting function.
  • It is now possible to have only sfun.f90 to use HamPath (hfun.f90 is not required).
  • Automatic scaling has been removed.
  • The command MesErrMsgIdAndTxt has been replaced to handle different interfaces: Matlab, Octave, Fortran, Python.
  • Fixed-step (implicit with modified Newton and explicit) integrators added.
  • The radau integrator (variable step-size and implicit scheme) has been added: see Hairer’s page.
  • The user has the possibility to write a function (in mfun.f90 file) which is called at each accepted step during the homotopy for monitoring. This implemented function can be used to stop the homotopy process if something unexpected occurs.
  • The auxiliary functions (as the control) must be written in afun.f90 file.
  • Modification of parfun.f90 file to fun.f90 for consistency with the names of the files.
  • Some options has been added for the user.
  • Some modifications to handle Tapenade updates.
  • A corrector step has been added to the homotopy method.
  • Correction of minor bugs.

2014, July. Bug fix on version 2.0.0. New version 2.1.1. Bug on automatic scaling during numerical integration is out.