Downloading & Compiling
The Receiver-Function Analysis
Computer Programs


Installing the receiver function codes

1st Download the codes.
2nd Unpack the codes: "zcat Rftn.Codes.Z | tar xvf -"
3rd Go into the Rftn.Codes directory and edit the "build.it.csh" script. You have to change the line "setenv SACLIB /geo/Sac/lib/sac.a" to point to the location of the SAC IO library.
4th Execute the script: "csh build.it.csh > buildLog.txt"

As the LLNL/community sacio library has evolved some people have had trouble with some of the SAC IO in these codes. Many people haven't had trouble, so you can get them to work. Try to comment out the call to inihdr in Subs/sacio.f to get around the problem. If you continue to have trouble, you can try my independent SAC library, isacio, that you can find on my home page (follow the isacio link). I never implemented the setkhv function for these, so it's not perfect, but it is independent of SAC community tinkering. I don't think that anything critical in these codes needs setkhv. I ran build.it.csh with this library and received no compilation problems on my Mac in June of 2006.

These codes are unsupported. The codes can be compiled on any unix/linux but make sure that you understand issues of byte-swapping between INTEL and IBM platforms. The example seismogram files are all in the IBM/SUN/APPLE byte order.

Iterative, time-domain deconvolution code

  • You get the iterative deconolution codes by with the other codes but it does not get built by the build.it.csh script. Go into the directory and type make. Watch out for the different scaling between iterdecon and pwaveqn. iterdecon will return a unit area function if you deconvolve something from itself, pwaveqn with return a unit amplitude signal (the "n" at the end is for normalized). The inversion codes use the pwaveqn convention, so you must account for the difference if you use iterdecon with the inversion codes.

Some things to watch our for

  • If you are having problems, check to see if you have other program routines with identical names to those used in this package located in your own search path that may be substituting for the routines in this package. For example, the rotate subroutine in pwaveq has the same name as the one in the SAC library.
  • Watch out for string-handling bugs in SAC2000 libraries - it may do strange things to many codes, not just these...
  • I revised sacio.f to compile under Mac OSX / Linux and removed old dependencies on FORTRAN header access. Please let me know if you have problems with this, I did it fast, and didn't do much detailed testing.

Output from build.it.csh on my Macintosh:

[motagua:~/Programs/Rftn.Codes] ammon% time csh build.it.csh

Making the bin directory

mkdir: ./bin: File exists

Building the library

f77 -g -c -o ask.o ask.f
f77 -g -c -o asktxt.o asktxt.f
f77 -g -c -o blank.o blank.f
f77 -g -c -o coef8.o coef8.f
f77 -g -c -o coefsh.o coefsh.f
f77 -g -c -o coord.o coord.f
f77 -g -c -o daymo.o daymo.f
f77 -g -c -o dfftr.o dfftr.f
f77 -g -c -o diffr.o diffr.f
f77 -g -c -o dot.o dot.f
f77 -g -c -o doy.o doy.f
f77 -g -c -o fft.o fft.f
f77 -g -c -o fsorce.o fsorce.f
f77 -g -c -o g1.o g1.f
f77 -g -c -o g2.o g2.f
f77 -g -c -o h12.o h12.f
f77 -g -c -o iask.o iask.f
f77 -g -c -o iniocm.o iniocm.f
f77 -g -c -o juli.o juli.f
f77 -g -c -o locast.o locast.f
f77 -g -c -o lpyr.o lpyr.f
f77 -g -c -o max.o max.f
f77 -g -c -o minmax.o minmax.f
f77 -g -c -o npowr2.o npowr2.f
f77 -g -c -o qrbd.o qrbd.f
f77 -g -c -o rdlyrs.o rdlyrs.f
f77 -g -c -o rotate.o rotate.f
f77 -g -c -o sacio.o sacio.f
f77 -g -c -o seisio.o seisio.f
f77 -g -c -o sinc.o sinc.f
f77 -g -c -o sit2.o sit2.f
f77 -g -c -o svdrs.o svdrs.f
f77 -g -c -o yesno.o yesno.f
f77 -g -c -o zero.o zero.f
ar cr subs.a ask.o asktxt.o blank.o coef8.o coefsh.o coord.o daymo.o dfftr.o diffr.o dot.o doy.o fft.o fsorce.o g1.o g2.o h12.o iask.o iniocm.o juli.o locast.o lpyr.o max.o minmax.o npowr2.o qrbd.o rdlyrs.o rotate.o sacio.o seisio.o sinc.o sit2.o svdrs.o yesno.o zero.o
ranlib subs.a
/bin/rm *.o

Compiling the deconvolution program

f77 -g -o ../../bin/pwaveqn pwaveqn.f ../Subs/subs.a /sac/lib/sac.a

Compiling the forward-modeling program

f77 -g -c -o respknt.o respknt.f
f77 -g -c -o kntfun.o kntfun.f
f77 -g -c -o rcvrfn.o rcvrfn.f
f77 -g -c -o ifmat.o ifmat.f
f77 -g -c -o abm.o abm.f
f77 -g -o ../../bin/respknt respknt.o kntfun.o rcvrfn.o ifmat.o abm.o ../Subs/subs.a /sac/lib/sac.a
/bin/rm *.o

Compiling the common utilities

f77 -g -c -o icmod.o icmod.f
f77 -g -o ../../bin/icmod icmod.f \
../Subs/subs.a /sac/lib/sac.a
f77 -g -o ../../bin/stacksac stacksac.f /sac/lib/sac.a ../Subs/subs.a
f77 -g -c -o modtable.o modtable.f
f77 -g -o ../../bin/modtable modtable.f
f77 -g -o ../../bin/manyvplot manyvplot.f \
../Subs/subs.a /sac/lib/sac.a
f77 -g -o ../../bin/vplot vplot.f ../Subs/subs.a /sac/lib/sac.a
f77 -g -o ../../bin/ppstime ppstime.f ../Subs/subs.a /sac/lib/sac.a

Compiling the inversion programs

f77 -g -c -o manyinv.o manyinv.f
f77 -g -c -o jinv.o jinv.f
f77 -g -c -o getmodl.o getmodl.f
f77 -g -c -o getseis.o getseis.f
f77 -g -c -o jsoln.o jsoln.f
f77 -g -c -o wrtsoln.o wrtsoln.f
f77 -g -c -o putsyn.o putsyn.f
f77 -g -c -o putpartl.o putpartl.f
f77 -g -c -o sacin.o sacin.f
f77 -g -c -o sacout.o sacout.f
f77 -g -c -o rftn_partials.o rftn_partials.f
f77 -g -c -o putseis.o putseis.f
f77 -g -c -o bufilter.o bufilter.f
f77 -g -c -o putsvalues.o putsvalues.f
f77 -g -c -o pratio_utils.o pratio_utils.f
f77 -g manyinv.o jinv.o getmodl.o getseis.o jsoln.o wrtsoln.o putsyn.o putpartl.o sacin.o sacout.o rftn_partials.o putseis.o bufilter.o putsvalues.o pratio_utils.o -o ../bin/manyinv ../RForward/Subs/subs.a /sac/lib/sac.a
f77 -g -c -o snglinv.o snglinv.f
f77 -g snglinv.o jinv.o getmodl.o getseis.o jsoln.o wrtsoln.o putsyn.o putpartl.o sacin.o sacout.o rftn_partials.o putseis.o bufilter.o putsvalues.o pratio_utils.o -o ../bin/snglinv ../RForward/Subs/subs.a /sac/lib/sac.a
f77 -g -c -o smthinv.o smthinv.f
f77 -g smthinv.o jinv.o getmodl.o getseis.o jsoln.o wrtsoln.o putsyn.o putpartl.o sacin.o sacout.o rftn_partials.o putseis.o bufilter.o putsvalues.o pratio_utils.o -o ../bin/smthinv ../RForward/Subs/subs.a /sac/lib/sac.a
/bin/rm *.o

Executables are in the directory ./bin

14.040u 5.210s 0:31.35 61.4% 0+0k 97+117io 0pf+0w

[motagua:~/Programs/Rftn.Codes] ammon% ls -all ./bin
total 10160
drwxr-xr-x 16 ammon staff 544 Aug 7 10:00 .
drwxr-xr-x 9 ammon staff 306 Jul 30 10:36 ..
-rwxr-xr-x 1 ammon staff 12292 Jul 10 10:08 .DS_Store
-rw------- 1 ammon staff 38 Feb 26 09:33 .gdb_history
drwxr-xr-x 9 ammon staff 306 Feb 26 09:46 TestDir
-rwxr-xr-x 1 ammon staff 208072 Aug 7 10:00 icmod
-rwxr-xr-x 1 ammon staff 764128 Aug 7 10:00 manyinv
-rwxr-xr-x 1 ammon staff 396860 Aug 7 10:00 manyvplot
-rwxr-xr-x 1 ammon staff 195088 Aug 7 10:00 modtable
-rwxr-xr-x 1 ammon staff 358732 Aug 7 10:00 ppstime
-rwxr-xr-x 1 ammon staff 461272 Aug 7 10:00 pwaveqn
-rwxr-xr-x 1 ammon staff 495272 Aug 7 10:00 respknt
-rwxr-xr-x 1 ammon staff 756164 Aug 7 10:00 smthinv
-rwxr-xr-x 1 ammon staff 761064 Aug 7 10:00 snglinv
-rwxr-xr-x 1 ammon staff 411632 Aug 7 10:00 stacksac
-rwxr-xr-x 1 ammon staff 358680 Aug 7 10:00 vplot


Overview | Data Prep | Source Equalization | Creating a Model
Computing the Response | Inverting a Waveform | References
Back to Ammon's Home

Prepared: July 1997 - Charles J. Ammon, Saint Louis University
Modified: August 2003 - Charles J. Ammon, Penn State
Modified: June 2006 - Charles J. Ammon, Penn State