Copyright © 2004–2016 by A. Miyoshi
BEx1D reference manual - bx1fitPlls
[Top]

BEx1D reference manual - bx1fitPlls

Synopsis Description Input Output Program limits Notes

Synopsis

bx1fitPlls basefilename

Description

  The bx1fitPlls program derives coefficients for potential-energy function by a linear least-squares method.
  A base file name must be specified as a command-line argument, and inputs are read from the file 'basefilename.fit'.   The output is printed to the console (standard output).   As an optional output, input data for bx1VIBsol or bx1HRsol are stored in a file named 'basefilename.inp' when a key 'outputOption' is found in 'basefilename.fit'.

Input

  The input file 'basefilename.fit' for bx1fitPlls consists of;
1) * title,
2) * output option,
3) regression function,
4) xy (or y', y'', ...) data table, and
5) * 'continue' block which are merely copied into an input file for bx1HRsol or bx1VIBsol.
The parts marked by asterisks (*) are optional.   These parts can appear in any order, and may be duplicated.   When duplicated, the one-value parameter (output option) is overwritten, while duplicated part is combined to the existing part for multi-value parameters such as title or function input.
Title and comments
[Title]   Any input line beginning with '#' followed by at least one white-space character is a title line, which is transferred to the head part of bx1HRsol or bx1VIBsol input file 'basefilename.inp'.
[Comment]   Any text from an exclamation mark, '!', to the end of the line is regarded as comments and ignored, except in the 'continue' block, in which any text including '!' is copied to the input for bx1HRsol or bx1VIBsol.
[Blank line]   Any blank line consisting of white-space characters and comment part only is skipped by the input parser.
Output option
  An option to control the output of 'basefilename.inp' can be specified as;
outputOption potential-type
where potential-type must be either 'powerSeries' or 'FourierSeries' for the input for bx1VIBsol or bx1HRsol, respectively.   It should be noted that bx1fitPlls can use any function consist of the function listed below (constant, power, sine, cosine, logarithm), bx1VIBsol can only use a power series potential and, for bx1HRsol, it must be a Fourier series.
Regression function
  A function in the following form can be specified as a regression function.
y = a1 f1(x) + a2 f2(x) + ... + an fn(x)   [ + c1 g1(x) + ... + cm gm(x)]
Here, a1, a2, ... , an are fitting parameters which are optimized in the regression analysis, while c1, ... , cm are constants.   f1(x), f2(x), ..., fn(x) and g1(x), ..., gm(x) are mathematical functions of x, and each can be one of xk, cos(kx), sin(kx), ln(x), and constant (= 1).
  An 'optFuncs' block is used to specify the parameter-terms, ai fi(x), as;
optFuncs{
  func-1  (order-1)  [mult-1]
  func-2  (order-2)  [mult-2]
  ...
}
where func-i, order-i, and mult-i are function type, order, and multiplication factor, respectively, of the i'th function.   Below is an example input for a second-order polynomial,
y = a0 + a1 x + a2 x2;
optFuncs{
  const
  pow  1
  pow  2
}
The function type, func-i, must be one of 'pow' [xk], 'cos' [cos(kx)], 'sin' [sin(kx)], 'ln' [ln(x)] (natural logarithm), and 'const' [1] (constant).   The order input, order-i, is necessary for pow, cos, and sin.   The i'th function value is multiplied by mult-i when it is specified.   For example,
optFuncs{
  pow  2  0.5
}
specifies a harmonic oscillator function,   y = (1/2)kx2.   Clearly, this is a redundant parameter since the same problem can be also solved by specifying a function,   y = ax2, and, afterward, the force constant, k, can be derived from a using   a = (1/2)k.   However, it may be useful to retain the physical meaning of the parameter.
  Optionally, constant-terms, cj gj(x) can be specified by 'fixFuncs' block as;
fixFuncs{
  c-1  func-1  (order-1)  [mult-1]
  c-2  func-2  (order-2)  [mult-2]
  ...
}
where c-i is the constant coefficient.   The example below is a second-order polynomial, but the coefficient for the first-order term is fixed to 0.324.
optFuncs{
  const
  pow  2
}
fixFuncs{
  0.324  pow  1
}
Data table
  The data points used in the linear least-squares regression should be prepared in a 'xyTable' block as follows.
xyTable{
  [deriv_order-1]  x-1  dny-1  [w-1]
  [deriv_order-2]  x-2  dny-2  [w-2]
  ...
}
where deriv_order-i, x-i, dny-i, and w-i are order of the derivative, x (independent variable), y (dependent variable) or its derivative, and weight, respectively, for the regression analysis.   Below is a simple examples containing the x-y data only.
xyTable{
  -1.02   122.8
   0.03   0.
   1.11   111.2
}
  In many cases for intramolecular motions, the location of a stationary point, xs, is a useful and important parameter of the potential energy curve.   Such information can be input as a datum like,   dy/dx = 0 at x = xs.   Also useful results of frequency analysis can be specified as second derivative, d2y/dx2, input.   Derivatives can be specified by 'deriv_order-i' optional term, for which 'deriv' or 'deriv1' stands for the first derivative, 'deriv2' for second derivative, etc.   The following is an example using first and second derivative at x = 0.03.
xyTable{
         -1.02   122.8
          0.03   0.
  deriv1  0.03   0.
  deriv2  0.03   229.1
          1.11   111.2
}
When the third field, w-i, is present, it is used to weight the regression analysis. Default weight is unity (1.0).
Continue block
  The content of a continue block, which begins with 'continue{' and terminates with '}', is nothing to do with the bx1fitPlls, but are merely transferred to the input for a subsequent tool, bx1VIBsol or bx1HRsol.   It is a convenience for repeated fit-and-solve procedures in which one may need to repeat manual 'copy & paste' tasks without this feature.

Output

Console output
  Details of the linear least-squares regression analysis are printed to the console (standard output).   Use redirection to store these into a file.   Below is an example output.
===== results of linear least squares regression =====
Function:
 y = a0 + a1 * x + a2 * x^2
 y' = a1 + a2 * 2*x
 y" = a2 * 2
Optimum parameters (+-) standard deviations (relative)
 a0 = -6.7444281e+000 (+-)  5.7137802e+000 (  84.72 %)
 a1 = -1.2905306e+001 (+-)  4.7173646e+000 (  36.55 %)
 a2 =  1.1251074e+002 (+-)  3.8602164e+000 (   3.43 %)
Parameter correlation coefficients
           a0       a1
 a1   0.00229
 a2  -0.50969 -0.06898
Input for  bx1VIBsol  or  bx1HRsol
  An input file for bx1VIBsol, basefilename.inp, is created when outputOption powerSeries is found in the bx1fitPlls input and the regression function is confirmed to be a power series.   Similarly, outputOption FourierSeries option is used to prepare a Fourier series input for bx1HRsol.   See reference manuals for bx1VIBsol and bx1HRsol for details of these input files.

Program limits

  Internally, bx1FitPlls calls DPOSV routine (linear equation solver for real symmetric matrix) in LAPACK written by FORTRAN.   Only one limitation hard-wired in the source codes is in the declaration part of static arrays which are passed to FORTRAN routines.   This can be found in 'libnumLls.h' file at the beginning of basicLinLsSq class declaration;
class basicLinLsSq {
 protected:
  enum { MXNPAR = 50 };  // maximum number of fitting parameters
that is, the maximum number of fitting parameters is 50.   All the other working variables use dynamically allocated memory and the system resource may limit the program execution.

Notes

  Users are recommended to understand the basics of the linear least-squares analysis.   One thing that should be reminded here is that the number of data points must be greater than, or at least equal to, the number of parameters to be optimized.