Computer Programs in Seismology

Last updated May 12, 2023

Introduction

With the installation of a PDP 11/70 minicomputer in 1981 for use in seismic network analysis, a persistent effort was made to use that tool for research. Because of the uniqueness of a dedicated minicimputer for research at that time as well as a desire to do something for the world wide seismological community, a set of documented computer programs emerged. The programs developed actually reflect research interests of the department as well as a desire to look at data in the manner of other investigators. In doing so, the hope is that these tools will permit research to progress rapidly.

This programming effort led to the development of COMPUTER PROGRAMS IN SEISMOLOGY which continues to be distributed. The package contains its own graphics package, and is relatively easy to install.

Computer Programs in Seismology

These programs focus on the understanding and interpretation of seismic wave propagation in the crust and upper mantle of the Earth. Synthetic seismograph code is provided for sources and receivers at arbitrary positions in the plane layered media. Programs are provided for determination of crustal structure through the inversion of surface-wave dispersion and teleseismic P-wave receiver functions. Inversion of broadband recordings of regional earthquakes for source depth, focal mechanism and seismic moment is also provided. Finally, a new tool, gsac, is provided to permit interactive and script based manipulation of seismic traces. The entire package is well integrated in that the same Earth velocity model, waveform and graphics formats are used by all programs. A complete interactive graphics package is also provided.

Since this package of programs continues to develop and be refined  to keep current with increasing volumes of digital might wish to  return to this page every few months.

Citation

The reference to this set of codes is as follows:

Herrmann, R. B. (2013) Computer programs in seismology: An evolving tool for instruction and research, Seism. Res. Lettr. 84, 1081-1088, doi:10.1785/0220110096

Platforms

The present code requires the use of the gcc/gfortran compilers that are available for all platforms. Interactive graphics requires X11 graphics.

PC Versions Currently support for PC's running windows requires the CYGWIN environment (http://www.cygwin.com). The source codes and installation procedure are the same as for the UNIX/LINUX/OSX versions. NOTE: This has not been tested for a long time

UNIX/LINUX/OSX Versions Source codes and install scripts are available. C and FORTRAN compilers are required - gcc and gfortran are available for free. Programs are distributed as gzip'd tar files (.tgz). Documentation in PostScript is provided. NOTE: I have only recently tested using LINUX Mint which should be similar to Ubuntu.

Ubuntu Linux and Mint

You can use the program download page, or open a terminal window and enter the following commands:

   sudo apt-get install make
   sudo apt-get install gcc
   sudo apt-get install gfortran
   sudo apt-get install xorg-dev
   sudo apt-get install libncurses5-dev
   sudo apt-get install gawk

The following programs are useful:

   sudo apt-get install gv
   sudo apt-get install ImageMagick

First beware of ImageMAgick 7.1.1-8. See the discussion below under MacOS. Note that there may be permission problems in creating PNG files from EPS files with ImageMagick. To be able do this,

   As superuser,  edit /etc/ImageMagick-6/policy.xml 
   
   e.g., sudo vi /etc/ImageMagick-6/policy.xml 
   or sudo xed /etc/ImageMagick-6/policy.xml
          
   Change  the lines
   
   <policy domain="coder" rights="none" pattern="PS" />
   <policy domain="coder" rights="none" pattern="EPS" />
   <policy domain="coder" rights="none" pattern="PDF" />
   <policy domain="coder" rights="none" pattern="XPS" />
          
   to this:
          
   <policy domain="coder" rights="read|write" pattern="PS" />
   <policy domain="coder" rights="read|write" pattern="EPS" />
   <policy domain="coder" rights="read|write" pattern="PDF" />
   <policy domain="coder" rights="read|write" pattern="XPS" />

RHEL 6.3 Linux, CENTOS (perhaps Fedora)

You can use the Add/Remove Softare tab, or open a terminal window and enter the following commands:

   yum install gfortran
   yum install libX11-devel
   yum install ncurses-devel

the following programs are useful:

   yum install gv
   yum install ImageMagick

OpenSUSE 13.1

Applications -> SystemLizard Button -> Computer -> Install/Remove Softares , or invoke /sbin/YaST2 directly

   gcc
   gcc-fortran
   xorg-x11-devel
   ncurses-devel
   ImageMagick
   gv
   java
   make
   perl

LINUX distribution under VirtualBox

This document shows how to install VirtualBox on your Windows, Mac or Linux system, and then install a version of LINUX with required compilers, and finally Computer Programs in Seismology. CPS_VirtualBoxInstall.pdf. The advantage of this approach is that the computer disk does not have to be partitioned in the presence of a Windows operating system, and that all compilers are easily obtained.

MacOS

These notes apply to the installation on April 23, 2023 under the latest MacOS Version Ventura 13.2.1.  The test machine was a MacBook Air with the M2 Apple Silicon chip.

  1. Determine the version of the operating system: Top menu bar AppleLogo -> About This Mac will give the version, e.g., OSX Version 13.2.1It also gives processor.
  2. Install xcode on your Mac, since you will need command line tools. Click on AppStore and then search for Xcode. You will need your password to download from the Apple Store.
    When Xcode in installed, the Icon in AppStore will now exhibit
    1. "Open", so open it and
    2. Agree (password again).
  3. Install Xquartz to get X11 graphic support. You can get this at http://www.xquartz.org/ . This will also set up the links required to compile X11 programs. When the download is complete,
    1. Install
    2. Open
    3. Agree (enter password)
    4. Install
Next we need the compilers and other software. We will get these using both homebrew and macports
  1. Install MacPorts http://www.macports.org/install.php. Select the version for your operating system, e.g. if running Ventura 13.2.1, macOS Ventura v13
    Clicking on the install will place a package in your downloads. Just click, icons will appear, and then click on the MacPorts...pkg icon. Answer the questions and enter your password.
    MacPorts gives libraries and LINUX like tools that will be useful for productivity. I have bzip2, gawk, ghostscript, gv, ImageMagick, ncurses, xfig and xv among others:
    sudo port install gv
    sudo port install xv
    sudo port install ImageMagick
                  
  2. Install homegrew brew.sh. The web page gives a command for ionstalling homebrew. As of April 27, 2023, this command is
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
    Now install the following packages:
    brew install wget
    brew install gcc
    brew install xfig
    brew install gawk
    brew install ghostscript
    brew install ffmpeg
    brew install gmt
    brew install graphicsmagick
    brew install --cask mactex
    

    The reason for downloading from the two sources is that a program may be missing from one but is in the other. The other, less obvious reason, is that distribution may not work as desired. For example, I use the ImageMagick convert program to convert the Computer Programs in Seismology (CPS) EPS files to PNG for display on the web. The CPS program plotnps -EPS determines the boundingbox, but places it at the end, by placing the line %%BoundingBox: (atend) at the top of the EPS file and then placing at the second last line, for example %%BoundingBox: 47 45 585 321. I found that the Imagemagick 7.1.1-8 downloaded from homebrew did not recognize this but that the ImageMagick 6.9.11-60 downloaded from MacPorts did recognize this. The effect was that the 7.1.1-8 version yielded a cropped image, which was not desired. Note: homebrew does have a link to download a Version 6 of ImageMagick.

    Not all packages are required to compile CPS. I have selected the items in order to be productive:

    All of these instalations will create an entry in the .zprofile in the login directory to point to the location of these executables

  3. Carefully enter the following command to point to the downloaded gcc instead of to the one installed. If the installed compiler is not Version 12, then ls /opt/homebrew/bin to see what has been installed.
    sudo ln -s /opt/homebrew/bin/gcc-12 /opt/homebrew/bin/gcc
    
    You could also have installed the compiler using MacPorts. You may have to do something like
    cd /usr/local/bin
    sudo ln -s /opt/local/bin/gcc-mp-11 gcc
    sudo ln -s /opt/local/bin/gfortran-mp-11 gfortran

    ( the mp-11 means MacPosts gcc6 was installed. This how MacPorts keeps distinguishes the different versions)

  4. Define the correct PATH so that the shell can find the sources. Carefully edit the .zprofile n your login directory to add lines at the end such as
    OPATH=$PATH
    PATH=:.:$HOME/bin:$HOME/PROGRAMS.330/bin:$OPATH  
         (This assumes that you installed CPS in your login directory)
    
  5. You are now ready to compile CPS. If PROGRAMS.330 is in your login directory, then
    cd PROGRAMS.330
    ./Setup OSX40
    ./C 2>&1 C.txt
    
    The file C.txt provides a record fo the compile. To test the compile resutls, do
    ls bin/* | wc
    
    If you do not see on the order of 150 programs, then examine the C.txt to determine what failed. This is the file to send to the Email address below if there are problems.

Support

to the package, please Email herrmarb@slu.edu.

You can find more information about the Center, seismology, and many other earthquake-related topics by visiting the Center's homepage, or by contacting Dr. Robert Herrmann.

Last changed 27 April 2023