NLSL
lfun.f90 File Reference

This seems to be the central hub, which is called by the L-M optimization, and which calls the functions that generate the simulated spectrum. More...

Go to the source code of this file.

Functions/Subroutines

subroutine lfun (m, n, x, fvec, fjac, ldfjac, iflag)
 Subroutine for interfacing EPRLL spectral calculations with the MINPACK version of the Levenberg-Marquardt nonlinear least squares algorithm for fitting experimental spectra. The function performed function determined by the IFLAG argument. MOMDLS subroutine to calculate a spectrum or series of spectra, each of which consists of one or more spectral components, or "sites". More...
 
logical function hltchk (ierr, isite, ispec, iflag)
 Check whether a user halt (control-C) or other error has occurred during the spectral calculation and set the iflag error flag for LMNLS accordingly. Returns .true. for fatal errors or user halts, and .false. otherwise. More...
 

Detailed Description

This seems to be the central hub, which is called by the L-M optimization, and which calls the functions that generate the simulated spectrum.

Definition in file lfun.f90.

Function/Subroutine Documentation

logical function hltchk ( integer  ierr,
integer  isite,
integer  ispec,
integer  iflag 
)

Check whether a user halt (control-C) or other error has occurred during the spectral calculation and set the iflag error flag for LMNLS accordingly. Returns .true. for fatal errors or user halts, and .false. otherwise.

Definition at line 615 of file lfun.f90.

subroutine lfun ( integer  m,
integer  n,
double precision, dimension(n)  x,
double precision, dimension(m)  fvec,
double precision, dimension(ldfjac,n+nsite+nspc)  fjac,
integer  ldfjac,
integer  iflag 
)

Subroutine for interfacing EPRLL spectral calculations with the MINPACK version of the Levenberg-Marquardt nonlinear least squares algorithm for fitting experimental spectra. The function performed function determined by the IFLAG argument. MOMDLS subroutine to calculate a spectrum or series of spectra, each of which consists of one or more spectral components, or "sites".

Parameters
iflag

IFLAG=0 (Printing of iterates)

IFLAG=1 (Evaluation of residuals function)

For a function evaluation, this routine takes the input vector X of search parameters, loads them into the fparm parameter arrays in /parcom/ (using additional indices available in /parcom/) and then performs spectral calculations by calling the MOMDLS subroutine.

The experimental data to which the calculations are to be compared is contained in the common block /expdat/. LFUN optionally shifts the calculated spectra to minimize the squared differences between calculation and data, and then automatically determines a least- squares scale factor (or set of scale factors for multiple sites/spectra) which are returned in the vector sfac in common /mspctr/. The The unscaled spectra are returned in the matrix spectr in common /mspctr/. Each column of spectr corresponds to a single site; multiple spectra are stored sequentially in the columns of spectr.

The residuals (differences between calculation and data after shifting and scaling) are scaled by the standard deviation of the estimated noise in each experimental spectrum, and returned to MINPACK through the fvec argument.

IFLAG=2 (Jacobian evaluation)

For evaluation of the Jacobian, the routine uses the forward-differences approximation to calculate the partial derivative of the spectrum with respect to each of the parameters being varied. The routine assumes that the individual spectra calculated at the point in parameter space where the Jacobian is being evaluated are contained in in the spectr matrix, and the appropriate scaling factors in the sfac array (both in common /mspctr/ ). The Jacobian matrix is returned in the fjac argument.

IFLAG=3 Fit is terminating. Output most recent set of parameter values and exit.

Definition at line 68 of file lfun.f90.

Here is the call graph for this function:

Here is the caller graph for this function: