
log(my_feffit.log, screen_echo = 3) 

macro plot_path 1 "color=black"
 ff2chi($1,  group=p$1)
 fftf(real = p$1.chi)
 plot( p$1.r,  -p$1.chir_mag, $2)
end macro

macro plot_fit
 newplot( data.r, data.chir_mag,xmin=0.,xmax=7)
 ff2chi(1-6, group=fit) 
 fftf(real =  fit.chi)
 plot(fit.r, fit.chir_mag)
# plot(fit.r, abs(data.chir_mag-fit.chir_mag),xmax=6)
end macro

macro show_fit
  feffit(chi = data.chi, k=data.k,group = fit, 1, 
	restraint = restr,  do_bkg=false)
  print 'fit took ', &fit_iteration, ' iterations' 
  show  s02, e0, dr, rf, rc, restr, chi_square, r_factor, n_idp
end macro
read_data(../data/cu_chi.dat, group = data, type=chi)

guess  s02   = 1.
guess  e0    = 1.
guess  ss2   = 0.002
guess  dr    = 0.001

path(index  = 1, 
     feff   = ../feff/feffcu01.dat, 
     label  = "Cu metal first neighbor", 
     s02    = s02, 
     sigma2 = ss2,
     delr   = dr, 
     e0     = e0)

kmin = 2, kmax=18, kweight=2, dk1 = 1, dk2=1
rmin = 1.5, rmax =3.4
rmax_out = 10

ff2chi(1, group=init) 


fftf(real = data.chi)

rf = 2.55+ dr

dx  = 1.d-5
rc = 2.53
restr = (rc - rf)/dx

rc = 2.52
show_fit

##
rc = 2.55
show_fit

##
rc = 2.58
show_fit










