Good afternoon or other time of day again,
I don't know how to add message to the thread (I use online mail service), so will write additions here, sorry, may be somebody will correct me.
The chi_square definition in FEFFIT manual is chi_square=N_idp/N_data*sum((dat-model)^2/epsilon_k^2), and to this sum IFEFFIT adds restraint^2 (as of source code). But with 0 restraint I didn't get the right value. If there is 2*N_data, I get the right order, but not exactly the same value (0.6 and 0.8 for instance). chi_reduced=chi_square/(N_idp-N_param) by definition, and it is exact. (N_idp=18, N_param=4 in my case, eps_k=3.6e-3 from FT high-frequency compared with mu0 calculation in real spectrum. I'm not sure about small values, but the test is generated oxygen sphere without noise, so only systematic errors. I will correct it anyhow, but can it be a problem I'm not sure)
I found that I need to set Rmin and Rmax for N_idp calculus even if I fit in k space, but it doesn't help.
The adding of real part of fit chi (that exists, I don't know why) with 0 data made things only worse.
I try to find maths in source code, but it is big, and I can not find all definitions and understand quickly what is the beginning and what is the chain of calls I need. Are files in feffit and lib directories used together? That seems that the fit vector that is LS-fitted is (dat-model)/weight and restraint components, but what of weight. In fitnls.f file there are

weight(id) = sigdtk(id) * sigdtk(id) / sigwgt(id)              !in k space case. Is it epsilon_k**2 if user-defined epsilon_k? what is this normalization?
weight(id) = sqrt ( nptfit(id) * weight(id) / xinfo(id))       !nptfit=N_data without 2 from kmin to kmax? xinfo=N_idp ifeffit variable?
                                                !We sum chi_square in m_fit points, is it the same? in fft file there was 2*N_data even in k space?

So can I think that weight=sqrt(N_data/N_idp)*epsilon_k, or not? I didn't get the chi_square right with this formula. Also, dat-model is multiplied by window, but I make Hanning window with dk=0 and it doesn't help.

It is the main question I wish to find the answer now, because need to make this calculus to publish, for results in my compounds to be confident. I thought of suggesting that chi_square is different only by norm and restraint is added to chi_square and to calculate and renormalize errors and A parameter in restraint for calculation. But it can be a problem if is not proportional, and I'm not sure if A renormalization can help...

The question of extending the method can wait a while.

I will be very thankful if somebody could help...


Thanks sincerely,
O.V. Kashurnikova,
XAFS group of the MEPhI, Moscow (Moscow Engeneering-Physics Institute)