IFEFFIT

IFEFFIT is a program for EXAFS refinement, based on theoretical scattering amplitueds and phase shifts calculated by FEFF.

Current version: 1.2.5
Location: /away/bio/Ifeffit/ifeffit-1.2.5  (mirror in /biohome/hsiao/Ifeffit/ifeffit-1.2.5)
Executable: /away/bio/Ifeffit/ifeffit-1.2.5/bin/ifeffit (link in /away/bio/Bin/Linux/ifeffit)
Homepage: http://cars9.uchicago.edu/ifeffit
Documentation: file:///away/bio/Ifeffit/ifeffit-1.2.5/doc/refman.pdf
Tutorial: file:///away/bio/Ifeffit/ifeffit-1.2.5/doc/tutor.pdf

How to do an interpolation.


How to run IFEFFIT

Ifeffit is an interactive program.
You start it by typing ifeffit
and you end it by typing quit.

IFEFFIT seems to be limited to a maximum number of 256 paths.

  1. Start with a set of coordinates.
    Put these into the file feff.inp, set the potentials, set the title, and change the parameters (NLEG, RPATH, and CRITERIA) (cf. the FEFF page). This can be done by the program turbo2feff.
    Run feff (feff82).

  2. To run ifeffit in batch mode:
    Make an ifeffit input file. The program feff2iff makes this automatically if you do not want to change the paths.
    Start the program by
    ifeffit -x input_file
    A sample batch file is found below.
    This is all that is needed in batch mode.

  3. If you have several metals, you need to run FEFF for each metal in a separate directory, making slight changes in the feff.inp and spring.inp files (see FEFF page).
    feff2iff will manage this situation also.
    However, note that you manually have to change the set s02 =    0.9  line to 0.9/(#metals).

  4. To run ifeffit interactively:
    Start the program by typing:
    ifeffit

  5. Read in the EXAFS raw data:
    read_data(inter_nen.chi,type=raw,group=init)

  6. Fourier transform the data from k to R space. This requires the variables kmin, kmax, dk, and kweight (refman p. 71):
    kmin=2,kmax=13,dk=2,kweight=3
    fftf(init.2)

  7. Define fixed and fitted variables for you EXAFS fit.
    set s02 = 0.9
    guess e0 = 2.
    guess sigN  = 0.0
    guess delrN = 0.0

  8. Read in the paths and possibly set more variables. The proper values of degen are found in files.dat, but if you do not change the degeneracy, you can ignore this keyword. Finally, the degeneracy is also where you set or fit the coordination number:
    path(1,feff=feff0001.dat,s02=s02,e0=e0,sigma2=sigN,delr=delrN,degen=4)
    path(2,feff=feff0002.dat,s02=s02,e0=e0,sigma2=sigN,delr=delrN,degen=2)

    These rows can fairly simply be constructed with xemacs rectangle (ctrl-x rk and ry) commands using the following template and the rows in files.dat.
    path( 3,feff=feff0003.dat,s02=s02,e0=e0,sigma2=sigm,delr= 0.0 ,degen=12)
    or

    path( 3,feff=feff0003.dat,s02=s02,e0=e0,sigma2=sigm,delr= 0.0 )



  9. Sum the paths to generate Chi(k) (refman p. 70).
    ff2chi(1-2,group=ff)

  10. Fourier transform the paths from k to R space (refman p. 71).
    fftf(ff.chi)

  11. Peform the EXAFS fit (refman p. 68). For this, rmin and rmax must be defined.
    rmin=1.0,rmax=2.5
    feffit(chi=init.2,1-2,group=fit,kweight=3)

    The default is to do the fit in R space. This is changed by
    fit_space=k

  12. Plot the result of the fit
    newplot(init.r,init.chir_mag,xmax=7)
    plot(fit.r,fit.chir_mag,xmax=7)

    If you have problems with the plot, write
    export PGPLOT_DIR=/away/bio/Pgplot

  13. Print out the result
    show kmin, kmax, rmin, rmax
    show @variables
    show chi_square, chi_reduced, r_factor
    show n_idp, &fit_iteration

    The actual r can now be found by summing r effective in files.dat with delr (mind the sign).

  14. Stop the program
    quit


Sample input file

1. A short one (with one path):

read_data(inter_nen.chi,type=raw,group=init)

kmin=2,kmax=13,dk=2,kweight=3
fftf(init.2)

set s02 = 0.9
guess e0 = 2.
guess sigN  = 0.0
guess delrN = 0.0

path(1,feff=feff0001.dat,s02=s02,e0=e0,sigma2=sigN,delr=delrN)

ff2chi(1,group=ff)

fftf(ff.chi)

rmin=1.0,rmax=2.5
feffit(chi=init.2,1,group=fit,kweight=3)

newplot(device="/cps",init.r,init.chir_mag,xmax=7,file="exafs.ps")
plot(device="/cps",fit.r,fit.chir_mag,xmax=7)
#plot(charfont=2,device="/cps",title="Title")
plot(charfont=2,device="/cps",xlabel="R(\A)",ylabel="FT Magnitude")
newplot(init.r,init.chir_mag,xmax=7)
plot(fit.r,fit.chir_mag,xmax=7)

show kmin, kmax, rmin, rmax
show @variables
show chi_square, chi_reduced, r_factor
show n_idp, &fit_iteration

quit


2. One with two paths:


log(exafs.log)
read_data(./inter_nen.chi,type=raw,group=init)
kmin=2,kmax=13,dk=2,kweight=3
fftf(init.2)

set s02 = 0.9
guess e0 = 2.
guess sigN = 0.0
guess delrN = 0.0
guess sigM = 0.0

set dN10 =4.4e-05
path(1,feff=Feff/feff0001.dat,
         s02=s02,e0=e0,sigma2=sigN,delr=dN10,degen=1)

set dN11 =  -0.000481

path(2,feff=Feff/feff0001.dat,
         s02=s02,e0=e0,sigma2=sigN,delr=dN11,degen=1)

set dN13 =  -0.000045

path(3,feff=Feff/feff0002.dat,
         s02=s02,e0=e0,sigma2=sigN,delr=dN13,degen=1)

set dN12 =  -0.000194

path(4,feff=Feff/feff0002.dat,
         s02=s02,e0=e0,sigma2=sigN,delr=dN12,degen=1)

set dN9 =   -0.000105

path(5,feff=Feff/feff0003.dat,
         s02=s02,e0=e0,sigma2=sigN,delr=dN9,degen=1)

set dN7 =   -0.000243

path(6,feff=Feff/feff0003.dat,
         s02=s02,e0=e0,sigma2=sigN,delr=dN7,degen=1)

set dC2 =   -0.000014

path(7,feff=Feff/feff0004.dat,
         s02=s02,e0=e0,sigma2=sigC,delr=dC2,degen=1)

set dC8 =    0.000038

path(8,feff=Feff/feff0005.dat,
         s02=s02,e0=e0,sigma2=sigC,delr=dC8,degen=1)

set dC16 =   0.000012

path(9,feff=Feff/feff0005.dat,
         s02=s02,e0=e0,sigma2=sigC,delr=dC16,degen=1)

set dC25 =  -0.000134

path(10,feff=Feff/feff0005.dat,
         s02=s02,e0=e0,sigma2=sigC,delr=dC25,degen=1)

set dC19 =  -0.000031

path(11,feff=Feff/feff0006.dat,
         s02=s02,e0=e0,sigma2=sigC,delr=dC19,degen=1)

set dC22 =   0.000060

path(12,feff=Feff/feff0006.dat,
         s02=s02,e0=e0,sigma2=sigC,delr=dC22,degen=1)

set dM1 =    0.000029

path(13,feff=Feff/feff0007.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM1)

set dM2 =   -0.000086

path(14,feff=Feff/feff0008.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM2)

set dM3 =   -0.000067

path(15,feff=Feff/feff0009.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM3)

set dM4 =    0.000033

path(16,feff=Feff/feff0010.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM4)

set dM5 =   -0.000065

path(17,feff=Feff/feff0011.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM5)

set dM6 =   -0.000108

path(18,feff=Feff/feff0012.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM6)

set dM7 =   -0.000001

path(19,feff=Feff/feff0013.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM7)

set dM8 =   -0.000142

path(20,feff=Feff/feff0014.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM8)

set dM9 =   -0.000022

path(21,feff=Feff/feff0015.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM9)

set dM10 =   0.000029

path(22,feff=Feff/feff0016.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM10)

set dM11 =  -0.000042

path(23,feff=Feff/feff0017.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM11)

set dM12 =  -0.000029

path(24,feff=Feff/feff0018.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM12)

set dM13 =  -0.000056

path(25,feff=Feff/feff0019.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM13)

set dM14 =  -0.000177

path(26,feff=Feff/feff0020.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM14)

set dM15 =  -0.000107

path(27,feff=Feff/feff0021.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM15)

set dM16 =  -0.000106

path(28,feff=Feff/feff0022.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM16)

set dM17 =  -0.000061

path(29,feff=Feff/feff0023.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM17)

set dM18 =  -0.000113

path(30,feff=Feff/feff0024.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM18)

set dM19 =  -0.000123

path(31,feff=Feff/feff0025.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM19)

set dM20 =  -0.000150

path(32,feff=Feff/feff0026.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM20)

set dM21 =  -0.000088

path(33,feff=Feff/feff0027.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM21)

set dM22 =  -0.000151

path(34,feff=Feff/feff0028.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM22)

set dM23 =  -0.000185

path(35,feff=Feff/feff0029.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM23)

set dM24 =   0.000009

path(36,feff=Feff/feff0030.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM24)

set dM25 =   0.000038

path(37,feff=Feff/feff0031.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM25)

set dM26 =   0.000139

path(38,feff=Feff/feff0032.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM26)

set dM27 =   0.000011

path(39,feff=Feff/feff0033.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM27)

set dM28 =  -0.000025

path(40,feff=Feff/feff0034.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM28)

set dM29 =  -0.000116

path(41,feff=Feff/feff0035.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM29)

set dM30 =  -0.000108

path(42,feff=Feff/feff0036.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM30)

set dM31 =  -0.000028

path(43,feff=Feff/feff0037.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM31)

set dM32 =  -0.000028

path(44,feff=Feff/feff0038.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM32)

set dM33 =  -0.000119

path(45,feff=Feff/feff0039.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM33)

set dM34 =   0.000013

path(46,feff=Feff/feff0040.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM34)

set dM35 =  -0.000109

path(47,feff=Feff/feff0041.dat,
            s02=s02,e0=e0,sigma2=sigM,delr=dM35)

ff2chi(1-47,group=ff)
fftf(ff.chi)
rmin=1.0,rmax=5
feffit(chi=init.2,1-47,group=fit,kweight=3)

newplot(device="/cps",init.r,init.chir_mag,xmax=7,file="exafs.ps")
plot(device="/cps",fit.r,fit.chir_mag,xmax=7)
#plot(charfont=2,device="/cps",title="Title")
plot(charfont=2,device="/cps",xlabel="R(\A)",ylabel="FT Magnitude")
newplot(device="/cps",file="exafsk.ps",init.1,init.2*init.1^3,xmax=kmax)
plot(device="/cps",fit.k,fit.chi*fit.k^3,xmax=kmax)
plot(device="/cps",charfont=2,xlabel="\fik \fr(\A\u-1\d)",ylabel="\fik\fr\u3\d\gx(\fik\fr)")
newplot(init.r,init.chir_mag,xmax=7)

plot(fit.r,fit.chir_mag,xmax=7)
plot(charfont=2,xlabel="R'(\A)",ylabel="FT Magnitude")

show kmin, kmax, rmin, rmax
show @variables
show chi_square, chi_reduced, r_factor
show n_idp, &fit_iteration

log(close)


Sample output file

   reading  feff0001.dat
   feffit fitting   1 data sets
   fitting ...
   estimating uncertainties ...
 done.
  wrote plot file exafs.ps
  wrote plot file exafs.ps
  wrote plot file exafs.ps
 kmin           =       2.000000000
 kmax           =      13.000000000
 rmin           =       1.000000000
 rmax           =       2.500000000
 e0             =      2.64519883 +/-      1.54033911
 sign           =      0.00375450 +/-      0.00082159
 delrn          =     -0.05027239 +/-      0.01058476
 chi_square     =    6967.027397356
 chi_reduced    =     958.902695550
 r_factor       =       0.060976813


How to interpolate the raw data file

IFEFFIT requires the k-interval to be 0.05 Å-1 for the data, so one may need to do an interpolation. This is done in the following way :

ifeffit
read_data(file="
old_file.chi",type=raw,group=init)
new.k=range(0,ceil(init.1),0.05)
new.chi=interp(init.1,init.2,new.k)
write_data(file="interpolated_file.chi",new.k,new.chi)
quit


Plotting (Pgplot)

Set:
export PGPLOT_DIR=/away/bio/Pgplot
(This probably applies only to the older versions)

If you have problems to plot from within ifeffit, i.e. if you get the following message:
PGPLOT /xw: Couldn't find program "pgxwin_server" in the directory named
PGPLOT /xw: in your PGPLOT_DIR environment variable, or in any directory
PGPLOT /xw: listed in your PATH environment variable.
Ensure that you have /away/bio/Bin/Linux in your path.
The pgplot program is in /away/bio/Pgplot/pgxwin_server

To make a R vs FT plot:
newplot(device="/cps",init.r,init.chir_mag,xmax=7,file="exafs.ps")
plot(device="/cps",fit.r,fit.chir_mag,xmax=7)
plot(charfont=2,device="/cps",xlabel="R(\A)",ylabel="FT Magnitude")


To make a k vs k^3 X(k) plot:
plot(charfont=2,device="/cps",xlabel="R'(\A)",ylabel="FT Magnitude")
newplot(device="/cps",file="exafsk.ps",init.1,init.2*init.1^3,xmax=15)
plot(device="/cps",fit.k,fit.chi*fit.k^3,xmax=15)

Plotting commands are described in chapter 5 of the IFEFFIT Reference Manual.

Notes on installation

Successful installation of 1.2.11c 22/2-19
22/2-19

sudo apt-get install libx11-dev
sudo apt-get install libncurses5-dev

Change the file PGPLOT_install (already done):
Old:   make FCOMPL=$fcompl FFLAGC='-O2 -fPIC' libpgplot_iff.a
New: make FCOMPL=$fcompl FFLAGC='-O2 -fPIC -fno-range-check' libpgplot_iff.a

./PGPLOT_install --system=linux --with-fortran=gfortran --prefix=/temp4/bio/PGPLOT

./configure --with-fortran=gfortran --prefix /temp4/bio/Ifeffit/ifeffit-1.2.11c --with-pgplot=/temp4/bio/PGPLOT/share/ifeffit/pgplot

This gives
===  could not find TERMCAP Libraries : 'make' will fail.
===
===  Please set TERMCAP_LIB in src/cmdline/Makefile or use the
===  --termcap-link argument before running make

edited by hand src/cmdline/Makefile and set the line:
TERMCAP_LIB = -L/lib/x86_64-linux-gnu/ -lncurses

Found this location by
locate ncurses




Then run:
make
make install

Successful, but pgplot does not work when running it

Successful installation of 1.2.11c 18/2-11

On ubuntu, you first need to install the following packages (root):
If you use gfortran, you also need to change the file PGPLOT_install:
Old:   make FCOMPL=$fcompl FFLAGC='-O2 -fPIC' libpgplot_iff.a
New: make FCOMPL=$fcompl FFLAGC='-O2 -fPIC -fno-range-check' libpgplot_iff.a

Then, you do the following:
  1. ./PGPLOT_install --system=linux --with-fortran=gfortran --prefix=/away/bio/PGPLOT
  2. ./configure --with-fortran=gfortran --prefix /away/bio/Ifeffit/ifeffit-1.2.11c --with-pgplot=/away/bio/PGPLOT/share/ifeffit/pgplot
  3. make
  4. make install


Failed installation of 1.2.11c 2/6-09

Old installation:

Ideally, the installation consist of copying the files to the mashine, installing pgplot and then:
./configure
make
make install


On docenten, the make command failed with the message:
/usr/bin/ld: warning: i386 architecture of input file `/sw/pkg/bio/Ifeffit/ifeffit-1.2.5/src/pgstub/libnopgplot.a(pgstub.o)' is incompatible with i386:x86-64 output
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status