BIKE and MBIKE - Fitting models of bilayers of surfactants or lipids to neutron reflectivity data

Adrian R. Rennie, Uppsala, Sweden

March 2010, Last modified 25 August 2017.


1. Introduction
   1.1 General
   1.2 Legal Notice
2. Use of the Program
   2.1 Data Files
   2.2 Definitions of Parameters
   2.3 Suggestions for Start Values
   2.4 Customising the Program
3. Simultaneous Fits with Multiple Data Sets
   3.1 General
   3.2 Uses
4. Suggestions and Hints
   4.1 Hints
   4.2 Frequently Asked Questions
Acknowledgements and References

This document is also available as a pdf file. bike.pdf.

1. Introduction

1.1 General

Fitting models to reflectivity or scattering data is often best performed by including constraints of prior knowledge to the models. A further enhancement is to choose appropriate parameters for minimisation that are not correlated. For this reason it is convenient to develop some fitting programs that are optimised for particular classes of problems. The programs BIKE and MBIKE are intended to help model the structures of surfactants and lipids that are found at solid/solution interfaces.

These materials often form bilayers with well defined hydrophilic and hydrophobic regions. The individual molecules are amphiphilic and generally consist of a hydrophilic head group and one or more hydrophobic tails per molecule. These are shown schematically in the figure below:


Associated with each volume for the surfactant there will be a scattering length. Solvent molecules are also defined by a volume and a scattering length. These are discussed in more detail in sections 2.2 and 2.3 below.

The program bike is an extension of drydoc which allows unconstrained models of multiple uniform layers for a single data set. The program mbike is equivalent to the program wetdoc for multiple data sets. These two programs provides a means of making 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. In both programs, simple structure with up to eight layers can be modelled.

The programs bike and mbike are constrained to model 4 layers with 3 of the layers defined by molecular properties of adsorbed species (volume, extent of the tail region etc.). The programs are intended for operation with Windows and can optionally be run with a GUI. The current version is prepared using the MinGW Fortran compiler. The current version of bike is 3.5 and of mbike is 3.5.

The programs are written entirely in FORTRAN and use the FITFUN fitting package and It is recommended to run the program using clickfit and the utility 'Prop' available from the ILL. Instruction for download and use of Prop are available from the ILL WWW site. Prop is installed but Clickfit and the fitting programs only need to be copied to suitable directories

Information about other fitting programs that will treat profiles, multiple data sets and other specific problems is available on the web at:

1.2 Legal Notice

These programs are made available for non-commercial use without charge. They 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.

2. Use of Program

Instructions on the use of FITFUNS can be found in the documentation at the ILL, Grenoble.

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

The default choices in the prelude can be changed by editing the appropriate .fcl file. Once the choices are made, the main program is controlled from a different interactive window:

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:

2.1 Data Files

Seven different 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. At present this resolution is not automatically incorporated in the calculation but information must be provided separately. The input routine is purely to provide convenience and avoid reformatting data. It is hoped to incorporate automatic use of resolution from data sets when some agreement is reached about how resolution is defined.

2.2 Definitions

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

The following summary of definitions may be useful:

  1. Top - the scattering length density of the bulk medium through which the neutron beam approaches the interface (10-6 Å-2.
  2. Scale - Multiplicative factor to put input data on an absolute scale of reflectivity.
  3. F Sol - Fraction of solvent in the 'Oxide' layer (should be between 0 and 1).
  4. Rough - Gaussian interfacial roughness between the substrate and the 'oxide' layer.
  5. Bgd - a flat background that is added to the model calculation.
  6. Thick Ox - Thickness of the 'oxide' layer between the first material and the layer of surfactant head groups. (units are Å)
  7. Rho Ox - Scattering length density of the 'oxide' layer between the first material and the layer of surfactant head groups. (units are 10-6 Å-2)
  8. Rough Ox - Roughness between the 'oxide' layer and the adjacent layer of surfactant head groups.
  9. Thick Hn - Thickness of the surfactant head group region next to the 'oxide' layer (thn). (units are Å)
  10. Thick ta - Thickness of the surfactant tail group region between the head groups (ttail). (units are Å)
  11. Thick Ho - Thickness of the surfactant head group region next to the bulk solvent (tho). (units are Å)
  12. b solv - Scattering length of a single solvent molecule. (Units are fm or 10-15 m)
  13. V solv - Volume of a single solvent molecule. (Units are Å3)
  14. b head - scattering length of a surfactant head group. (Units are fm or 10-15 m)
  15. V head - Volume of a surfactant head group. (Units are Å3)
  16. b tail - scattering length of a surfactant tail. (Units are fm or 10-15 m)
  17. V tail - Volume of a surfactant tail. (Units are Å3)
  18. Area/hd - Area per two surfactant molecules in the bilayer structure (Units are Å2)
  19. F mix - Fraction of surfactant heads that are mixed in with the tail region (should be between 0 and 1).
  20. Rough f - the roughness as a fraction of the layer thickness for each of the surfactant region layers (should be less than about 0.3)
  21. SlopeB or Mult ahg - the variable 21 is used for different purposes in bike and mbike. For bike it is SlopeB and is the gradient for a sloping background. In mbike it is used as a multiplier for the area per head so that the same model but differing only in surface coverage can be used for different data sets that are fitted simultaneously.

The following diagram indicates this arrangement schematically:


The space in the layers of heads and tails that is not filled by surfactant molecules is assumed to be filled by solvent molecules. An important physical constraint is that the space in these layers is at least sufficient for two surfactant molecules. This implies that:

(thn + ttail + tho) x Ahd   >   2 x (Vhead + Vtail)

It is necessary to check that this constraint is met manually as it is not built in to the programs.

For mbike, The scattering length of each component can be set to a different value for each data set. The thickness, volume and roughness are kept the same for modelling each data set.

The roughness for the top material and oxide layers is given in Ångstrom but the roughness at the following interface for the other layers is defined as a fraction of the thickness (Rough f).

2.3 Some Suggestions for Start Values of Parameters

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.

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 these programs the parameters for the solvent and the surfactant moieties are given in terms of the molecular volume and the scattering length. Some examples of approximate values for these quantites are given in the next table.

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.

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. If large values of the roughness or continuously varying profiles are needed for a model it will be necessary to choose a different program that can model such profiles. Please consult the catalogue of other programs to make a suitable choice such as lprof or cprof.

2.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 defaults when 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 (bike.fcl) is shown below:

prld|title|bike - A.R. Rennie  Version 3.4  27 June 2015 
prld|Give data weighting 0-none;1-statistical|float|0| 0 | 1|
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|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 - from data |float|1| 0| 4|
prld|Resolution: for dQ/Q constant give % resolution |float|5.0|.1|30|
prld|Resolution: for Delta-Q constant give value (A-1)|float|0.01| 1e-5| 0.1|
rcmd|wntle|Reading new data
rcmd|title|Reading reflectivity data
rcmd|Data filename.dat |filer|a28708.dat|
main|wntle|bike - fitting a bilayer model to reflection data
hcmd|title|Bike - a bilayer at a solid surface
hcmd|View file/View helpfile |filed|bike.hhh
jcmd|wntle|model output
jcmd|title|Write out model for later comparison with data
jcmd|Write out reflectivity file (1), Interface as BSD file (2) or Physical Model Parameters (3) |float|1|1|5|
jcmd|Reflectivity file: Minimum Q value A-1 |float|0.0|0|4
jcmd|Reflectivity file: Maximum Q value A-1 |float|0.4|0|4
jcmd|Reflectivity file: Number of points in output |float|50|0|512
jcmd|Filename for output (with extension)|filew|bikeout.dat
jcmd|Title for reflectivity results|text|Output from bike
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 fcl file. It is possible to keep multiple copies of fcl files with different names in order to start the program with different defaults.

3. Simultaneous fits to multiple Contrasts or other Multiple Data Sets

3.1 General

A separate program MBIKE is used to read and make simultaneous fits to multiple data sets for the same sample or structure. The use is very similar to BIKE but it should be used with the clickfit_m graphical user interface (GUI) as this permits setting some different values for parameters for different data sets.

There is one additional parameter in MBIKE (21): Mult Ahg. This is a multiplicative factor for the area per molecule for each data set. If set to 1 the area is just Area/hd. It can be either smaller or larger than 1.

The following parameters can be allowed to vary between different data sets (the others are constrained to be identical):

It is expected that for a given experiment only some of the different variables will be needed but the range of parameters that can be constrained or varied allows some flexibility in use of the program. Different ranges of momentum transfer for fitting can be selected for different data sets using the options under 'Fitting' in the GUI or the 'O' command if the program is run from a command line.

3.2 Uses with multiple data sets

There are a number of reasons to fit a model to multiple data sets. These include:

  1. Using different isotopic contrasts to effectively determine lost phase information. In these cases specific values of b will be chosen for the different data sets. It may also be necessary to allow for different background values.
  2. Checking the combination of different instrument configurations to verify that they match correctly or to determine optimum scale factors. In this case all parameters apart from teh scale factor are likely to be held constant. It will be convenient to choose different Q ranges for the fits for each data set.
  3. Compare samples that are expected to have identical structures but just different coverage. In this case the area per Mult Ahg will be varied and other parameters fixed.

4. Suggestions and Hints

4.1 Hints

In studies of complicated systems make sure that the model for the bare substrate 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.

It is usually convenient to refine a model with only a few parameters initially. Manual changes of parameters to find good starting values are often the most efficient way to search for reasonable models.

Resolution can be included in different ways: the normal 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 fixed slits at various angles is available for scans made in this way (using the old version of D17 at the ILL.) Data from D17 is no longer normally collected in this way. Old versions of the program allowed definition of resolution in terms of the slit sizes etc but this. is no longer included in current versions.

At present the resolution from individual data sets is not used in calculating smearing even when information is provided in the fourth column (as no standard definition is available).

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

4.2 Frequently Asked Questions and Answers

  1. How do I constrain a bilayer to be symmetric? It is possible to keep the thickness of the two head group regions identical even when fitting this parameter by setting identical start values for fitting and setting a step size of -9 for the second thickness (parameter 11). Generally setting a negative step size equal to a parameter number will provide a constraint that the parameters are identical.
  2. Is there a simple way to check that the parameters are physically reasonable? The 'post-fit options' or 'Extra' buttons in the GUI (J on command line) can provide some simple physical parameters of the model. Make sure that the number of solvent molecules is positive.
  3. What is the surface excess? There are two molecules at the interface in the area Area/hd (A). This can be converted to an excess, Γ, in mass per unit area. If the molecular mass of the surfactant is M and Avogadro's constant is NA then:

    Γ = 2 M / (NA A)

    If necessary make allowance for the value of Mult Ahg. You will also need to convert to whatever units (e.g. cm2 or m2) are required. A is in Å2.
  4. Can I fit a series of runs (e.g. adsorption kinetics)? Yes. It is possible to automate a sequence of fits with bike (not with mbike) so that the program automatically reads a sequence of data files and uses either the saved fit parameters or the revised parameters after the previous fit. The fitted parameters are provided in a csv file for users to analyse further. Use the 'Make Sequence File' button in the clickfit GUI. Normally it is better to try and fit only a single or few parameters in this way.
  5. What are the errors in the fit parameters? The programs report the statistical uncertainty in the minimisation (using the user selected weighting) as a percentage of the fitted parameter. The errors are valid if the program reports that it has found a minimum. They do not allow for any systematic errors in the measurements, data reduction or scaling that are often larger than the errors in the minimisation! There is some discussion of uncertainty and errors in a paper by H. M. Kwaambwa, M. Hellsing and A. R. Rennie in Langmuir 26, 3902-310 (2010) particularly in regards of systematic uncertainty in the determination of the background.
  6. How do I fit multiple bilayers? Many systems will adsorb as multilayers or are deposited as multilayers by Langmuir-Blodgett deposition. These experiments need other fitting programs such as tram, trikk or stige. Please consult the catalogue of other programs to make a choice.
  7. How do I fit models that include large patches on a surface? The program spots can fit defined layers and calculate averages for density profiles that could be different on different areas of a surface. This would be appropriate for patches that are large or are separated by more than the coherence length of the scattering experiment. The program is not specifically designed for bilayer structures. Please consult the documentation for spots for more details.


I am very grateful to Dr Ron Ghosh who has provided the FITFUN and clickfit software and co-operated in the development of these programs.


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.

Other details on the calculation of reflectivity profiles can be found in the books by O. S. Heavens, 'Optical Properties of Thin Solid Films', 2nd Ed. (1991) Dover and J. Lekner, 'Theory of Reflection', M. Nijhof, Amsterdam (1987). The matrix calculations were originaly described by F. Abeles Ann. de Physique, 5, 611 (1950) and the method to include small amounts of roughness by L. Nevot and P. Croce J. Phys. Appl. 15, T61 (1980).

Please report mistakes or make suggestions for improvements to:

Professor Adrian R. Rennie
Uppsala, Sweden


Program and documentation: © Copyright A. R. Rennie Last updated 25 August 2017.