MLOC Source Code

MLOC Source Code

The original coding of the hypocentroidal decomposition algorithm (mostly in the module mlocinv.f90) followed the presentation in Jordan and Sverdrup (1981) extremely closely, to the extent of naming variables as nearly the same as possible and including equation numbers from the paper in comments. The published paper, however, contains a few (minor) typographic errors in equations. The code was based on a corrected version.

MLOC was originally written in Fortran 77 but nearly all code has been updated to use structures and features from Fortran 90/95 that improve legibility and robustness. There are multiple user-controlled levels of warnings for errors and debugging. The code is extensively commented, and a full understanding of the functionality of mloc requires at least occasional reference to the source code. Some rarely-needed options are only accessible by editing the code and re-compiling. The code is divided into multiple packages with related functionality. Most variables that are used beyond a given program unit are declared in a master include file ( This file also contains a large number of named common blocks and most communication between program units occurs through them.

Aside from the code base borrowed from Ken Creager’s LOC program for the initial coding of mloc, the major bits of source code that have been adapted from other people’s work are:

  • Code from Johannes Schweitzer’s HYPOSAT program for calculating travel times in the custom crustal models (Schweitzer, 2001)
  • Code from Ray Buland’s software implementing the tau-p travel time calculations (Buland and Chapman, 1983)
  • Code from Bob Engdahl’s location program (Engdahl et al., 1998) for various odious tasks, such as ellipticity corrections and bounce-point corrections
  • A few routines from Numerical Recipes (Press et al., 1986)
  • The code to calculate Sn, the robust estimator of spread, from Croux and Rousseeuw (1992)

Source Code Modules

A list of all the source code modules in the current release of mloc and a note about their functionality can be found here.

Version History

The version history is updated with each new release. Early development of mloc was undocumented. Version documentation began in early 2005 with v4.1. The version scheme was expanded to three fields with v9.1.1 in October 2009. The versioning scheme is major.minor.patch or sometimes major.minor.feature, i.e., the third field increments when a significant bug has been patched or a significant feature has been added (or occasionally, removed). For lesser changes the release date is updated but the version number stays the same. The version number and release date are hard-coded in the main program and always listed in the .summary output file.

Current Release

  • mloc v10.4.7, release date 7/14/2019, upload date 7/27/2019

Utility Programs

Source codes for utility programs needed in support of mloc can downloaded here.

Makefile and Compilers

This is a basic makefile for mloc, for use with the open source Fortran compiler “gfortran”. It will make an executable called “mloc_g”. The pathnames assume that the makefile resides in a folder at the same level as one holding the source files, named “mloc_src”. This can be changed with the variable SRCDIR in the makefile. The makefile includes a “clean” command.

The code has been successfully compiled using the open source gfortran compiler, as well as commercial Fortran compilers from Absoft and Intel.

Last Updated on