rail - fit neutron reflectivity data to a model of a monolayer of molecules partially mixed with solvent

Adrian R. Rennie,
Uppsala University,

Last modified 29 May 2018.


  1. Model of Interface
  2. Starting Parameters
  3. Installing, Downloading and Running the Program
  4. Hints
  5. Legal Notice
  6. Acknowledgement

1. Model of Interface

The program fits a model that corresponds to a layer of molecules on solvent to multiple reflectivity data sets (different solvents or molecule contrasts). The molecules are assumed to be partially immersed in the solvent subphase. A fraction fair of the interfacial molecules are in the hydrophobic layer (mixed with air) and (1-fair) is in a layer that is hydrated. The thickness of the interfacial region is described by the total thickness and the thickness of the hydrated region. This model is shown schematically in Figure 1

Figure 1. Schematic diagram of model that is calculated. The red molecules occupy, on average, an area A. A fraction, f, of the interface molecule is not hydrated by solvent.

The parameters for the interface and solvent molecules are their scattering lengths and the molecular volumes as listed below.


The parameters that are used in the program are:

Parameter Number Name in program Symbol Unit
Scattering length density of medium with incident beam 1 Rho (top) ρT 10-6 Å-2
Experimental Scale Factor 2 Scale FS None
Roughness between layer and incident beam medium 3 Rough ξa Å
Experimental Background 4 Bgd B None
Scattering length of molecule forming interfacial layer 5 b mol bmol fm (or 10-15 m)
Volume of molecule forming interfacial layer 6 V mol Vmol Å3
Fraction of molecule mixed in layer with air 7 f (air) fair None
Scattering length of solvent molecule forming subphase 8 b mol bsol fm (or 10-15 m)
Volume of solvent molecule forming subphase 9 V mol Vsol Å3
Total thickness of interfacial layer 10 t tot ttot Å
Roughness between layers 11 Rough 1 ξ1 Å
Thickness of hydrated interfacial layer 12 t hyd thyd Å
Roughness between layer and solvent subphase 13 Rough 2 ξ2 Å
Area per molecule 14 A A Å2

The scattering length density of the subphase is calculated from the scattering length, bsol, and the molecular volume of the solvent, Vsol as ρ = bsol / Vsol.

The scattering length for the molecule may need to be adjusted for any exchange of protons with the solvent. For example, for proteins and peptides there is a calculator available to estimate exchange of hydrogen with aqueous solvent. The properties for the individual layers that make up the interface are calculated from the parameters as follows:

Layer 1

Thickness is given by:

t1 = ttot - thyd

and scattering length density is:

ρ1 = fair bmol / (A t1)

Layer 2

Thickness is given by:

t2 = thyd

Volume of solvent in the near surface layer is the amount to fill gaps between peptide. The volume of the layer is A t2. Volume of solvent in layer 2 is (A t2 - (1 -fair) Vp) and so the number of solvent molecules in layer 2 is n2 given by:

n2 = (A t2 - (1 - fair) Vp) / Vsol

The scattering length density of layer 2 is:

ρ2 = ((1 - fair) bmol + n2bsol) / (A t2)


The volume of the molecules that form the interfacial layer is used as a paramter so as to provide a constraint in the fit procedure. The product of the area per molecule and the thickness of the layer should be at least the molecular volume so as to provide reaslonable values for the packing density. The program also requires the thickness of each layer to be positive and the area per molecule to be greater than zero. Another constraint is that the fraction of the molecule in the layer mixec with air, fair should lie between 0 and 1.


The effect of roughness on reflectivity is calculated according to the method of L. Nevot and P. Croce J. Phys. Appl. 15, T61 (1980). This uses an approximation that is valid for values of the roughness that are small compared to the thickness of the adjacent layer. The roughness generally reduces the reflectivty by exp(-ξ2Q2/2). At a liquid interface the roughness is often dominated by capillary waves. For pure water at 25 C these are about 3Å.

2. Typical values of parameters

The program will usually start with default parameters. If the parameters are 'Saved', these will be used as the defaults when the program is restarted (with the same work directory). Scattering lengths and scattering length densities can be calculated from tables if the molecular formula is known. A useful calculator for neutron scattering length density is available on the NIST www site.

Example of typical parameters that might be used are:

Material Chemical Formula Formula Volume / Å3 Scattering Length / 10-15m (fm)
Water H2O 30 -1.68
Heavy Water D2O 30 19.15
Air matched Water D2O 30 0.0

3. Installing, Downloading and Running the Program

The program is available for download as a zip file (refprog.zip) with other software designed for both for general modelling of interfaces as well as for other specific structures. The program uses PGPLOT (T. J. Pearson, Caltech) graphics as modified by R. E. Ghosh from the Institut Laue Langevin, Grenoble, France. It is convenient to run the the program using the graphical user interfaces (GUI) provided by Prop and clickfit_m that are available from the Institut Laue Langevin. Although prop is installed, it is necessary only to copy clickfit_m and rail to suitable directories. It is possible to run rail from a command line if the enviroment variables for PGPLOT are set appropriately.

Further information about general aspects of running the program and the user interface is documented in the links provided in the previous paragraph and in the descriptions of a range of other reflectivity fitting programs which will not be repeated here. The data formats that can be read by rail are described on the www at http://www.reflectometry.net/refdata.htm.

Figure 2. The 'Prelude' interface to select format and fitting options

After starting the program and selecting appropriate options for the input data format from the 'Prelude' dialogue (Figure 2), plotting and resolution the following interface will appear.

Figure 3. Interface to select parameters and initiate fits

The data are plotted and the calculated reflectivity is shown in a separate graphics window (Figure 4).

Figure 4. Result of a fit showing the differences and the residual.

In order to use the program with clickfit_m, it is necessary to provide a control file that defines certain parameters. This is a simple text file and can be edited to provide different defaults such as input data file type, resolution etc. It is possible to have multiple, different versions so as to quickly start the program in different configurations. An example file rail.fcl is shown below:

prld|title|rail - A.R. Rennie  version 1.5  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|12.7|.1|30|
prld|Resolution: for Delta-Q constant give value (A-1)|float|0.01| 1e-5 | 0.1 |
main|wntle|rail - fitting two layers at interface
rcmd|wntle|Reading new data
rcmd|title|Reading reflectivity data
rcmd|Data filename.ext|filer|297898_900.mft|
hcmd|title|Flying - first example of rail+gui
hcmd|View file/View helpfile |filed|rail.hhh
jcmd|wntle|model output
jcmd|title|Write out model for later comparison with data
jcmd|Write out reflectivity file (1) or Interface as BSD file (2) |float|1|1|2|
jcmd|using parameter set number|float|1|1|10|
jcmd|Reflectivity file: Minimum Q value A-1 |float|0|0|4
jcmd|Reflectivity file: Maximum Q value A-1 |float|0.3|0.05|4
jcmd|Reflectivity file: Number of points in output |float|200|50|512
jcmd|Filename for output (no extension)|filew|railout
jcmd|Title for reflectivity results|text|Output from rail
rstx|attempt restart function (dummy at present - rsta control name)

For example, changing the 2 to 6 in the sixth line would provide a different default input data type (to read ISIS data in place of AFIT .aft files).

4. Hints

5. Legal Notice

The program is 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 program represents acceptance of this condition.

The program and this documentation is © Copyright of Adrian R. Rennie, 2018.


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 program.