TRAM and VELO - Fitting multilayer neutron reflectivity data


  1. Introduction
  2. Models of Interface and Parameters tram, velo
  3. Use of Programs
  4. Variation of Models - Other Programs trail, trikk, stige
  5. Examples
  6. Legal Notice
  7. Acknowledgement

1. Introduction

August 2008, Documentation last modified 09 July 2015

The programs fit data that arises from a repeated multilayer structure such as that arising from a concentrated surfactant phase at an interface. The program TRAM can be used to create a stack of multiple surfactant bilayers (such as a lamellar phase). The program tram is an extension of drydoc and bike which allow similar models for either a simple sequence of unrelated layers or a molecular bilayer. The program VELO uses a model with a sinusoidal variation in the scattering length density at the interface.

These programs are designed to make interactive, graphical fits to neutron reflection data using multilayer models calculated using optical matrix methods. The parameters may be changed manually to explore the effect of different structural models or varied using a least squares algorithm.

The programs are written in FORTRAN and use the FITFUN fitting package and PGPLOT (T. J. Pearson, Caltech) graphics as modified by R. E. Ghosh from the ILL, Grenoble, France. The programs are intended for operation with a GUI. The current versions are prepared using the MinGW Fortran compiler. The current version of tram is 2.3 and of velo is 1.8.

Installation It is recommended to run the program using clickfit and the utility 'Prop' available from the ILL. Instructions for the download and use of Prop are available from the ILL WWW site.

Information about other fitting programs that will treat profiles, multiple data sets and other specific problems is available on the web at: Some specific extensions/variants of these programs (trikk, stige) are mentioned below in Section 4.

2. Models and Description of Parameters

2.1 'tram'

The model in tram consists of two bulk phases (described as 'top' through which the incident beam reaches the sample) and 'sub' that will be the solvent subphase beneath the interface and an interfacial structure of bilayers and solvent. The structure is shown schematically in Figure 1. Between the 'top' phase and the bilayer structure, four arbitrarily chosen layers of defined thickness and scattering length density are defined. These can be used to model a non repeating surface structure such as oxide on a solid surface, grafted interfaces or other special layers. They are defined in terms of thickness, t, scattering length density, ρ and roughness, ξ. These layers are numbered from 1 to 4 (increasing away from 'top' towards 'sub'). This notation corresponds to that used in drydoc.

Figure 1. Layer structure modeled in tram with 4 near surface layers and then repeating bilayers separated by solvent.

The individual bilayers that form the multilayer structure are parameterised in terms of molecular properties in a manner similar to that used in bike. Some details of this structure are shown in Figure 2. The bilayer consists of two regions of heads with solvent separated by a region of tails plus solvent. In each bilayer the two 'head' regions are assumed to be identical (i.e. the bilayer is symmetric). Each bilayer is further separated by a layer of pure solvent. The composition of the bilayer regions (and hence the scattering length density of each layer) is calculated from the area per molecule, A, in each half of the bilayer. For these calculations it is necessary to define the scattering length, b, and volume, V, of the head and tail moieties of the molecule in the bilayer. Some tools for understanding and checking the physical model are described in section 3.2 below. The model constrains the bilayers to contain equal numbers of 'heads' and 'tails' but the user must check that the solvation of the molecules is realistic. It is also important to keep the roughness small for the approximations in the calculation to remain valid.

Figure 2a. Head and tail regions of surfactants modeled in tram that then form repeating bilayers separated by solvent.

Figure 2b. Bilayer of surfactants modeled in tram that are separated by solvent.

The fraction of the head region that is occupied by solvent, xhs, is given by:

xhs = 1 - (Vh / A th )

The fraction of the tail region that is occupied by solvent, xts, is given by:

xts = 1 - (2Vt / A tt )

The scattering length density of each of these layers is then given by:

ρh = (1 - xhs) (bh / Vh) + xhs ρsol

ρt = (1 - xts) (bt / Vt) + xts ρsol

where ρsol is taken to be identical to the scattering length density of the bulk medium furthest from the incident beam, ρs. An extension of this simple model allows a gradient in the composition of the bilayers to be introduced. The area per molecule can be different near the top surface (Ai) and close to the bulk solvent (Ao). The value of A for each bilayer is assumed to vary linearly between Ai and Ao. This corresponds to a volume fraction of molecules that varies as 1/z (z is the disatance away from the interface). For convenience if Ao is set to zero, it is automatically taken to be identical to Ai and this corresponds to no composition gradient. Thus the general expression for Aj, the area for each molecule in the bilayer number j is:

Aj = Ai + (j/N) (Ao - Ai).

The program is dimensioned so that it could calculate 120 repeats of the bilayer structure although this is rarely necessary as the changes in the reflectivity that arise from the repeating structure are normally rather small on increasing N above about 30. It is not recommended to use N as a variable parameter in least squares fitting as the derivatives of residuals with respect to this integer quantity are necessarily discontinuous. The user should rather experiment with different values of N by manually changing the value and if necessary fitting other parameters. When N is small(say 3 or 5) the value of N will significantly alter both the width and intensity of the Bragg peaks that arise from the repeating structure.

The parameters that are used in the program tram are listed in Table 1.

Table 1. Parameter used in program tram

No. Parameter Name in program Symbol Unit
1 Scattering length density of medium with incident beam Rho (top) ρT 10-6 Å-2
2 Scattering length density of substrate Rho (sub) ρS 10-6 Å-2
3 Experimental Scale Factor Scale FS None
4 Top surface roughness (between 1st layer and incident beam medium) Rough ξa Å
5 Background Bgd B None
6 Thickness of layer 1 Thick 1 t1 Å
7 Scattering length density of layer 1 rho 1 ρ1 10-6 Å-2
8 Roughness between layer 1 and layer 2 Rough 1 ξ1 Å
9 Thickness of layer 2 Thick 2 t2 Å
10 Scattering length density of layer 2 rho 2 ρ2 10-6 Å-2
11 Roughness between layer 2 and layer 3 Rough 2 ξ2 Å
12 Thickness of layer 3 Thick 3 t3 Å
13 Scattering length density of layer 3 rho 3 ρ3 10-6 Å-2
14 Roughness between layer 3 and layer 4 Rough 3 ξ3 Å
15 Thickness of layer 4 Thick 4 t4 Å
16 Scattering length density of layer 4 rho 3 ρ4 10-6 Å-2
17 Roughness between layer 4 and repeating structure Rough 4 ξ4 Å
18 Number of repeats of bilayer structure No. Repeats N None
19 Thickness heads Thick h th Å
20 Thickness tails Thick t tt Å
21 Thickness solvent Thick sol. tsol Å
22 Volume of heads Vol. h Vh Å3
23 Volume of tails Vol. t Vt Å3
24 Volume of solvent Vol. Sol. Vsol Å3
25 Scattering length - tail b tail bt fm
26 Scattering length - head b head bh fm
27 Area per molecule at interface Ahg in Ai Å2
28 Fractional roughness of bilayer structure Rough f ξf Å2
29 Area per molecule near solvent Ahg out Ao Å

These units assume that the input data to be modelled is reflectivity as a function of momentum transfer, Q given in Å-1. If alternative units for Q are used, the values for the thickness, Area, roughness etc. will also need to be scaled. These parameters are related to the physical model shown in Figure 1.

2.2 'velo'

The structure that is modelled in velo consists of 4 arbitrarily defined layers as in tram followed by a sinusoidal oscillation in the scattering length density that varies as the distance z from the outer boundary of the near surface 4 layers. The density profile is given by:

ρ(z) = ρave + Δρ sin((2πz/Λ) + α)

where ρave is the mean scattering length density, Δρ is the amplitude of the oscillation that has wavelength Λ and if necessary a phase shift, α. The units for Λ are Å and for α are radians.


The maximum number of oscillations that can be calculated by the program is 41. At present each period is approximated by 12 sublayers and the calculation routines are limited to a maximum of 500 layers in total. A schematic diagram of the scattering length density profile is shown in Figure 3. The parameters that are used in the program velo are described in Table 2.

Figure 3. Structure modeled in velo with 4 near surface layers and then an oscillating density profile.

In the example profile that is shown in Figure 3 the values for ρave and Δρ were chosen so that the density profile is approximately continuous at the boundaries with the near surface layers and the bulk solvent, ρs. The number of oscillations in the profile is not an integer but is half integer. The phase α was taken as π/2. It is possible to vary N in the fit but as for the program tram it is often best determined by manual trial as the derivatives of the residual with respect to N are likely to be discontinuous.

Table 2. Parameter used in program velo.

No. Parameter Name in program Symbol Unit
1 Scattering length density of medium with incident beam Rho (top) ρT 10-6 Å-2
2 Scattering length density of substrate Rho (sub) ρS 10-6 Å-2
3 Experimental Scale Factor Scale FS None
4 Top surface roughness (between 1st layer and the incident beam medium) Rough ξa Å
5 Background Bgd B None
6 Thickness of layer 1 Thick 1 t1 Å
7 Scattering length density of layer 1 rho 1 ρ1 10-6 Å-2
8 Roughness between layer 1 and layer 2 Rough 1 ξ1 Å
9 Thickness of layer 2 Thick 2 t2 Å
10 Scattering length density of layer 2 rho 2 ρ2 10-6 Å-2
11 Roughness between layer 2 and layer 3 Rough 2 ξ2 Å
12 Thickness of layer 3 Thick 3 t3 Å
13 Scattering length density of layer 3 rho 3 ρ3 10-6 Å-2
14 Roughness between layer 3 and layer 4 Rough 3 ξ3 Å
15 Thickness of layer 4 Thick 4 t4 Å
16 Scattering length density of layer 4 rho 3 ρ4 10-6 Å-2
17 Roughness between layer 4 and repeating structure Rough 4 ξ4 Å
18 Number of oscillations No. Repeats N None
19 Period of oscillation Period Λ Å
20 Mean Scattering length density in region of oscillations Ave. rho ρave 10-6 Å-2
21 Scattering length density oscillation amplitude Amplitude Δρ 10-6 Å-2
22 Phase of oscillation Phase α Radians

3. Use of Programs

3.0 Starting

Use of Prop and clickfit as well as instructions on the use of FITFUNS can be found in the documentation at the ILL, Grenoble that was described in section 1.

The main options for the program are chosen from a 'Prelude' dialogue box that allows selection of the data format, number of layers, use of resolution function etc.

Figure 4. Prelude Dialogue window for 'tram

Once the choices for data format, resolution etc are made, the main program is controlled from a different interactive window that is shown in Figure 5. The default choices in the prelude can be changed by editing the appropriate .fcl file (see 3.4 below).

Figure 5. Clickfit Dialogue window for 'tram

The individual variables can be selected with a mouse and a new dialogue box appears that allows new values for parameter and the step size to be given. Other functions can be selected from the buttons or pull down menus. When display of data or a fit is calculated, it is shown in a separate graphics window:

Figure 6. Graphics window for 'tram showing data with a model calculation

3.1 Data Files

Seven ASCII data formats can be read in the current version. These are:

The data format is selected in either the opening dialogue or the Clickfit 'Prelude'. A fuller description of the data formats is available at The four column data set input has been added in August 2007. The 4th column provides information about Q resolution of the data. It is assumed to be the width parameter, σ of a Gaussian resiolution function in the units of Q.

3.2 Hints

In studies of complicated systems make sure that the model for the bare solid surface fits the data measured for that system before proceeding to more complex systems. It is useful to build up from simple models (few layers) to more complex models (many layers) when trying to fit data. Check that the model is compatible with all contrasts before proceeding.

Resolution can be included in different ways: the default function would be to assume a constant dQ/Q. A further option is either constant dQ or a combination of terms that have fixed values of dQ/Q and dQ. This resembles a function that approximates to the resolution for fixed slits with measurements at different angles (for example using the old version of D17 at the ILL.) Data from D17 is no longer normally collected in this way.

If resolution from individual data sets is used in calculating smearing (when information is provided in the fourth column), it is assumed to be the width parameter, σ of a Gaussian resolution function.

The default options in this program is for equal weighting of all data points in the fits. This is often found to be more satisfactory than weighting by the errors which are frequently not appropriately chosen. Systematic errors and variation in the resolution may be large compared with the random errors particularly at large reflectivity (small Q).

It is very important to check that the values for the roughness are physically reasonable. The approximation used by the program due to Nevot and Croce is only valid for values of the roughness that are small compared with the layer thickness.

Several tools are available to help check that the parameters are physically reasonable and to understand the structure that has been modelled. The button 'Post-fit options' is active only after a fit has been made but then it presents a further dialogue window that is shown in Figure 7. Option 3 provides a simple output of the scattering length density profile as a graph as shown in Figure 8. This data can also be output as an ASCII file (.bsd) for further processing or plotting.

Figure 7. Post-fit options for 'tram'.

Figure 8. Graphics window for 'tram showing scattering length density profile for a model calculation.

Option 4 in the 'Post-fit options' provides a simple calculation to estimate how the molecules pack in the first bilayer of the stack that is appended to the program log file (tramnnn.log where nnn increases each time the program is run). An example of the text is shown below:

Some physical interpretation of the multibilayer 

 Area per head group Inner (A2)      35.     Surface Excess (A-2)    0.563E-01
 rho sol is     6.35     x 1E-6 A-2
 Head n rho     4.93     x 1E-6 A-2  No. of Solv / Head     3.96    
 Tail rho       3.58     x 1E-6 A-2  No. of Solv/2 tails    -11.3    

This example shows that the packing of the molecules was not physically possible in the model for which the calculation was made as the volume of the heads was larger than the thickness multiplied by the area that would lead to a negative number of water molecules hydrating these groups! Under these circumstances the model needs to be refined not just because it inadequately fits the data.

3.3 Definitions and Starting Parameters

The program assumes that data for scattering length density is provided in units of 1 x 10-6 Å-2. If the momentum transfer, Q, in the input data files is in Å-1 then the thickness of layers must be given in Å.

It is for the user to determine how to model data and to choose parameters and values consistently. Some examples and suggestions as to how to estimate parameters are provided here. Data for scattering lengths and a simple means of determining scattering length densities is provided at the NCNR, NIST web site. The following table provides some approximate values for scattering length densities in the units used in the programs. In order to obtain a scattering length the atomic formula for a molecule is needed. The scattering length density calculation needs also information about the mass density of the material (which is combined with the formula mass) to determine a formula volume.

Table 3 Scattering Length Densities of Some Materials

Material Chemical Formula Scattering Length Density / 10-6 Å-2
Silicon Si 2.07
Silica SiO2 amorphous 3.41
Sapphire Al2O3 5.8
Water H2O -0.56
Heavy Water D2O 6.35

In tram the parameters for the solvent and the molecular moieties that form the bilayer are given in terms of the molecular volume and the scattering length. Some examples of approximate values for these quantites are given in the Table 4.

Table 4 Molecular Volumes and Scattering Lengths of Some Materials

Material Chemical Formula Formula Volume / Å3 Scattering Length / 10-15m (fm)
Water H2O 30 -1.68
Heavy Water D2O 30 19.15
Dodecyl Chain C12H25 370 -13.8
Dodecyl Chain deuterated C12D25 370 246.5
Hexaoxaethylene C12H25O6 440 21.1

The users input of molecular volume will be important in determining the amount of solvent that is surrounding the surfactant in the interfacial layers. It is important to consider when calculating volumes whether it is appropriate to consider a liquid or a crystalline density. The values for layer thickness for the surfactants will clearly depend greatly on the molecular structure but are ofte in the region of 10 to 30 Å. The areas per molecule in the layer are similarly varied but often in the range of 40 to 200 Å2.

3.4 Customising

The last parameters, the ranges for fitting and the limits for graphs are saved in a parameter file if the 'Save' option is used. These are the new defaults for the parameters when a new fit is attempted or the program is restarted.

Further customisation of the defaults is possible by editing the clickfit configuration file that is used to start the program. An example (tram.fcl) is shown below:

prld|title|TRAM - A.R. Rennie  version 2.3 27 June 2015 
prld|Data type .dat 0; RAL 1; Afit 2; NIST 3; .TXT (ANSTO) 4; .OUT (ILL) 5; New .his 6; .mft 7; 3-col no header 8; mantid .mft 9 |float|9| 0 | 9 |
prld|Give data weighting 0-none;1-statistical|float|0| 0 | 1 |
prld|Fit data as R*Q**4 0-no, 1 yes |float|0| 0 | 1 |
prld|Include resolution 0-none; 1 const dQ/Q; 2 const dQ; 3 dQ/Q + dQ; 4 taken from input data |float|4| 0 |4|
prld|Resolution: for dQ/Q constant give % resolution |float|2.0|.1|30|
prld|Resolution: for Delta-Q constant give value (A-1)|float|0.01| 1e-5 | 0.1 |
main|wntle|tram - fitting repeating layers (heads/tails) at interface
rcmd|wntle|Reading new data
rcmd|title|Reading reflectivity data
rcmd|Data filename with extension |filer|238526.mft|
hcmd|title|tram - first example of tram+gui
hcmd|View file/View helpfile |filed|tram.hhh
jcmd|wntle|model output
jcmd|title|Write out model for later comparison with data
jcmd|Write out reflectivity file (1), profile as BSD file (2), plot (3), model parameters (4) |float|1|1|4|
jcmd|Reflectivity file: Minimum Q value A-1 |float|0.0|0.0|4.0
jcmd|Reflectivity file: Maximum Q value A-1 |float|0.3|0.05|4.0
jcmd|Reflectivity file: Number of points in output |float|200|50|512
jcmd|Filename for output (no extension)|filew|tramout.txt
jcmd|Title for reflectivity results|text|Output from tram
rstx|attempt restart function (dummy at present - rsta control name)

The default data types, resolution and even input data file name can be altered by editing the file.

3.5 Calculation Method and References

A description of the methods used in these calculations is given in the Rutherford Appleton Laboratory Report: 'Adaptation of Methods in Multilayer Optics for the Calculation of Specular Neutron Reflection' by J. Penfold, No. RAL-88-088. The agorith used in this program is based on the method of Abeles. Other details on the calculation of reflectivity profiles can be found in the books by O. S. Heavens, 'Optical Properties of Thin Solid Films', Dover and J. Lekner, 'Theory of Reflection', Nijhof.

4. Variation of these Models - Other Programs

4.1 'trail'

This is a modification of 'tram' (described in detail above) that allows the surface structure for up to three different regions to be modelled under the condition that the areas are large (so that reflectivity rather than scattering length density are averaged. The repeating bilayer model can be added to 4 layers on the surface that are defined by scattering length density and thickness. It was intended to model an interface that might have patches with a single bilayer and areas that may have a repeating bilayer. The repeating bilayer is described by an area per head group and volumes of 'heads'. and 'tails'. The different regions at the interface are described by two extra parameters fb and fm that describe the fraction of the interface covered just by bilayer and multiple bilayers respectively. The remaining fraction of the interface, fox has only the layer 1 (typically oxide, gel or a grafted layer) at the interface. fox is derived from the other parameters by:

fox = 1 - ( fb + fm ).

Apart from the different structures for different regions of the interface, the program functions in a manner very similar to tram. The program can be considered analagous to the program spots that treats non-uniform interfaces with large patches that just consist of layers defined by thickness and scattering length density.

4.2 'trikk'

This program allows multiple data sets that are measured with different contrasts to be used in a combined fit with the mdel that is described for tram. To run this program with a graphical user interface (GUI), the procedure Clickfit_m rather than Clickfit should be used. The scattering length density of the solvent, ρS, the scale factor, the background, as well as the scattering length density of each of the the near surface layers, ρ1 to ρ4 can be allowed to vary between data sets but the dimensions such as thickness and area per molecule are constrained to remain the same for each data set.

4.3 'stige'

This program calculates the repeating bilayer structure used in trikk (and tram) for multiple data set but allows a gradient in both the surfactant density (area per molecule) and in the solvent spacing. The extra parameter tsol_out (Tsol Out in the program) is used to define a linear gradient in the thickness of the solvent layer. Although this program is designed for multiple data sets and to be run with Clickfit_m, it can of course be used with just a single data set.

In practice, it is found that quite small changes in the lattice repeat such as that caused by a gradient in the solvent thickness cause the Bragg peaks from a repeating structure to reduce in intensity very rapidly.

5. Examples

Studies that have used these programs include self-assembly of surfactants and lipids in lamellar phases at interfaces as well as other multilayer structures. A typical papers that describes these types of investigations are:

6. Legal Notice

The programs are made available for non-commercial use without charge. The use should be acknowledged in any publication by reference to the author and this web page. No guarantee is provided that the results of the programs are correct. It is the reponsibility of the user to check all results. Download and use of the programs represents acceptance of this condition.

The programs and this documentation are © Copyright of Adrian R. Rennie.


I am very grateful to Dr Ron Ghosh (ILL, Grenoble and Department of Chemistry, University College London) who has provided the FITFUN and clickfit software and co-operated in the development of the programs.

Professor Adrian R. Rennie
Department of Physics, Uppsala University, Uppsala, Sweden


Program and documentation: © Copyright A. R. Rennie Last updated 09 July 2015