Accompanying the XML file should be the reflect.dtd
file, which should not need to be altered. It's required to describe the rules for the XML file, to verify that the number and order of records are valid.
<?xml version="1.0"?> <!DOCTYPE yanera SYSTEM "yanera.dtd">
The root level of XML tag is also always the same, and every option described below appears between the <yanera\>
tags.
The rest of the file is broken into three sections, one for models, another for the data to be fit, another for miscellaneous information.
<model_section\>
XML tags, as follows;
<model_section> ... </model_section>
The <model_section\>
tag has two children: <model_type\>
and <model\>
.
<model_type\>
XML tags. For example
<model_type>slab</model_type>
This tag is required. Possibilities for the value are:
<model/>
tags.
<model data_idref="data1"> ... </model>
The "data_idref" property is required. It refers to the "data_id" of only one data file, and make the association that this is the model of that data set. See the section on <data/>
XML tags, for more information. At least one <data/>
tag, even empty must be present.
Every <model/>
tag can have several children, described as follows.
<polarized\>
tags. Options are "up" and "down", and it's for you to decide which is correct. In the "up" case, the scattering length density is the sum of the nuclear and magnetic parts; . For "down" it's the difference; This may be omitted in general. For example;
<polarized>POLARIZED_UP</polarized>
The defualt value is POALRIZED_UNPOLARIZED
.
<layer> <name>Fe layer</name> <thik fix="NO">11.000</thik> <sigz fix="YES"> 1.000</sigz> <rsld fix="YES"> 8.230</rsld> <isld fix="NO"> 0.000</isld> <rmag fix="YES"> 4.200</rmag> </layer>
For a set of layers, that run from bulk () to substrate (), the scattering length density profile can be given as
where is the thickness, is the real part of the scattering length density, the roughness, each of layer . The location of the error function, , is calculated by a running total of the thicknesses.
Units are in for the thickness (<thik/>
) and roughness (<sigz/>
), and for the scattering length densities (SLD). The nuclear SLD is given by <rsld/>
, and for the magnetic SLD as <rmag/>
. The imaginary part of the nuclear SLD is optional, as is the name of the layer. The order of these parameters is important, since it's dictated by the DTD.
In order to hold a parameter fixed in the fit, set the fix
attribute to YES
, otherwise set to NO
. This is ignored if just simulating and not fitting. The fix
attribute is required.
<bulk> ... </bulk> <substrate> ... </substrate>
The layer that the neutrons go through first should be listed first, whether it's <substrate/>
or <bulk/>
. It's possible to use the text "n/a" in place of numbers for <sigz/>
in the first layer, and for <thik/>
in the first and last layers, since these quantities don't have meaning in these layers.
<repeat num="3"> <layer> ... </layer> <layer> ... </layer> </repeat>
<substrate/>
and <bulk/>
layers are still specified as in the slab model type, but in-between layers are a sum of Gaussian and box functions. An example of each is given here: <layer> <type>box</type> <name>a box layer</name> <thik fix="YES">10.000</thik> <sigz fix="YES"> 0.500</sigz> <cntr fix="YES"> 5.000</cntr> <rsld fix="YES"> 1.000</rsld> </layer> <layer> <type>gaussian</type> <name>a gaussian layer</name> <sigz fix="YES"> 0.500</sigz> <cntr fix="YES"> 5.000</cntr> <rsld fix="YES"> 1.000</rsld> </layer>
For both function types, we require a new parameter, the center of the layer in direction, given by <cntr/>
tag.
For a Gaussian function, the <sigz/>
tag becomes the width of the gaussian, given by
A box function is a box of total width <thik/>
, convoluted with a Gaussian of width <sigz/>
:
If <sigz/>
is zero, then it becomes a Heavyside step function.
Use a roughness parameter for both bulk and substrate. For a component-type model, these are modeled as error functions. The last, bulk layer will also need a center parameter, that sets the total thickness of the model.
Repeating layers do not work with components. This will result in undefined behaviour, and likely crashes. Use common components, described in the next section.
This is done by a special <layer/>
tag: <component/>
. Put these tags just before the first <model/>
, and not in it. A common component looks like a <layer/>
tag:
<component component_id="id1"> <type>box</type> <name>repeating layer type 1</name> <thik fix="YES">10.000</thik> <sigz fix="YES"> 0.500</sigz> <rsld fix="YES"> 0.000</rsld> </component>
Each common component should have a unique "component_id" identifier, which is an unique alpha-numeric string, which is also different from any "layer_id". Use this identifier to associate layers in the model with these parameters, i.e.:
<layer component_idref="id1"> <cntr fix="YES">15.000</cntr> </layer> <layer component_idref="id1"> <cntr fix="YES">25.000</cntr> </layer>
In this example, two layers are box functions with different centers, but share all other parameters in common. Any layer specified like that above shares the <thik/>
, <sigz/>
, and <rsld/>
parameters. Keep in mind that since the <component/>
tags are processed last, they will overwrite any data in the layers. So place only shared parameters into <component/>
tags. Any number of common components can be specified, and any layer can share these values.
<layer> <type>function</type> <name>inhomogeneous layer</name> <func>a*cos(21.991148578*(z-b)/c)</func> <parm name="a" fix="YES">0.500</parm> <parm name="b" fix="NO">10.000</parm> <parm name="c" fix="YES">50.000</parm> <thik fix="NO"> 50.000</thik> <sigz fix="YES">1.2</sigz> </layer>
For a layer of given thickness <thik/>
, the <func/>
tab gives a analytic expression for the SLD of that layer. The ordinate is given by z
, and several variables can appear as a
, b
, c
, etc. Mathematical functions recognised are absolute value (abs), sin, cos, tan, exponential (exp), and natural logarithm (log). Powers are expressed by "a^2". Use parentheses liberally, to make sure the expression is evaluated correctly.
Variables in the function must be placed in a <parm/>
tag, only once regardless how many times they appear in the expression. Use the "name" property to associate the value with that parameter. Use the fix
property as usual.
Any number of layers, except for the bulk layers, can be of function type.
Finally, include <sigz/>
tag, just as a normal homogenous layer, to indicate the smoothness of the transition from the functional layer to the regular layers surrounding it.
Repeating layers may not work with function layers. Typically if a function is translated by some distance to work correctly, it will not repeat correctly. (This can be done in a later version, by adding a feature to set some zero point based on the current thickness of the sum total of the layers.)
<background fix="YES"> 0.000</background>
MODEL_SLAB | MODEL_COMPONENT | MODEL_FUNCTION | |||||||||||
top bulk | layer | bottom bulk | top bulk | box layer | gaussian layer | bottom bulk | top bulk | layer | function layer | bottom bulk | |||
<type/> | x | x | x | ||||||||||
<name/> | o | o | o | o | o | o | o | o | o | o | o | ||
<func/> | x | ||||||||||||
<parm/> | x | ||||||||||||
<thik/> | x | x | x | x | |||||||||
<sigz/> | x | x | x | x | x | x | x | x | x | ||||
<cntr/> | x | x | x | ||||||||||
<rsld/> | x | x | x | x | x | x | x | x | x | x | |||
<isld/> | o | o | o | o | o | o | o | o | o | o | |||
<rmag/> | o | o | o | o | o | o | o | o | o | o | |||
o = optional | |||||||||||||
x = required |