Next: MAGNETIC STRUCTURES AND STRUCTURE FACTORS
Up: LEAST SQUARES REFINEMENT USING
Previous: Examples of Least squares
Making Other Least Squares Programs
The existing main programs can be adapted to refine different parameters,
or to use a different calculated function in the refinement. Examples
which already exist are:
MPLSQ, multipole LSQ, in which the scattering density is expressed as a sum
of spherical harmonic (multipole) functions, and the coefficients of these
functions may be refined. A new family 5 has been defined for
them, as there may be different numbers of multipole coefficients for
different atoms.
PALSQ, polarization analysis LSQ, in which the observations to be fitted
are the components of the scattered neutron polarization for a given input
polarization.
Recently (April 2001) some changes have been made to make it easier to introduce new parameters
into a least squares refinement based on structure factors. The author of the
new program must provide:
- An augmented main program in which the new parameters are defined
this should be based on
SFLSQ.
The names of the new parameters (A4) must be added to ISFWRD
and their specifications (family, genus, and species) to ISWDSP
- A subroutine called say DOXXX1 with 1 dummy agument MODE.
When called with MODE=1 it should read all the data from the
CDF which are needed to give values to the new parameters.
When called with MODE=2 it should check that enough data have
been read, and do any necessary tidying up.
For every new parameter which can be refined there should be a
corresponding integer pointer. This pointer will be set to the
number of the of the variable to which ithe parameter is
assigned, or zero if it is fixed.
DOXXX1 should be called in the main program with MODE=1 just after
SETFC, and with MODE=2 just before
PARSSF.
- A logical function called say DOXXX2 with two dummy arguments
NN and MODE
- MODE = 1
- Determine symmetry constraints on new parameters
NN is not used.
- MODE = 2
- Set Variable pointers to new parameters
NN is the variable number
- MODE = 3
- Apply shifts, one parameter per entry.
NN is not used
- MODE = 4
- Write new parameter card (one per entry)
NN is the serial number of the letter on the card to
rewrite
- MODE = 5
- Do any calculation required because of parameter changes
at the end of a least squares cycle.
- MODE = 6
- Interpret new words used to fix or vary groups of parameters
when they apply to a particular genus.
Such words should be defined in the main program as belonging to families
with negative numbers (<-10).
- MODE = 7
- Interpret new words used to fix or vary groups of parameters
when they apply to all such parameters (all genera or genus not applicable).
- A subroutine called say LXXCAL to calculate the structure factors
and their derivatives with respect to all the structural parameters
(Only needed if the new parameters modify the structure factor)
- A subroutine called say CALXXX to calculate the measurement (GCALC)
to be fitted, in terms of the structure factor and other
experimental parameters.
(Only needed if the new parameters change how this is done)
- A logical function called say DFTXXX which will be called with
the dummy arguments set to the family, genus and species of a
parameter. It should return TRUE if the parameter is to be varied.
In the EXTERNAL declaration in the main program:
LFCALC should be replaced by LXXCAL
DOTHER should be replaced by DOXXX2
DEFALT should be replaced by DFTXXX
A call to CALXXX should replace that to
CALCSF inside the least squares
cycles. It has two dummy arguments: H giving the reflection indices,
and the second LXXCAL being the structure factor calculation routine.
If, as for magnetic structures, two types of structure factors are to
be calculated a third parameter gives the name of the required routine.
It should be declared EXTERNAL.
For example for magnetic least squares the call becomes:
call CALCMG(H,LFCALC,LMCALC)
LFCALC calculates the nuclear structure factors and their
derivatives.
LMCALC calculates the magnetic structure factors and their
derivatives.
CALCMG combines them into GCALC to match the observed quantity GOBS.
Note. It is convenient to group the main program and the
special subroutines in a single file to be included in the main program
section of the master file.
Next: MAGNETIC STRUCTURES AND STRUCTURE FACTORS
Up: LEAST SQUARES REFINEMENT USING
Previous: Examples of Least squares
P.J. Brown - Institut Laue Langevin, Grenoble, FRANCE. e-mail brown@ill.fr