November 2010, *Documentation last modified 9 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 BYBAN can be used to create a model stack of multiple surfactant bilayers (such as a lamellar phase) that includes a thermal fluctuation amplitude. The program byban is an extension the program tram that has an identical model except for the inclusion of fluctuations. These programs for multiple bilayers of amphiphiles are related to the simpler programs drydoc and bike that allow similar models for either a simple sequence of unrelated layers or a molecular bilayer. Another 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 *byban* is 1.0.

*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: http://www.reflectometry.net/refprog.htm.

The model in *byban* is a modification of that used in the related program
tram for a repeatng structure
of a surfactant bilayer at the interface of two bulk phases. The special feature of this program is that it treats the case of reflectivity profiles that are dominated by Bragg peaks from the repeating structure and includes an extra term to allow for thermal fluctuations of the bilayers. The intensity of Bragg peaks depends on a number of parameter but it is well known that thermal motion will reduce the intensity of diffraction from a crystal by a factor that depends exponentially on the mean square amplitude of the fluctuations, ξ. This is usually written as a Debye-Waller factor, F_{DW} given by:

F_{DW} = exp(-2W)

where 2W = Q^{2}ξ^{2} / 3. Q is the momentum transfer that is given by:

Q = (4π/λ)sin θ

where λ is the wavelength and θ is the grazing angle of incidence. This treatment is widely used in studies of scattering from crystals (see e.g. G. L. Squires, *Theory of Thermal Neutron Scattering*, Dover, New York.) but the application to reflectivity data needs some special consideration. This is based on the idea that the reflectivity for an interfacial structure, R(Q)as a function of momentum transfer Q can be considered approximately as the product of two terms that are R_{F}(Q) and Φ^{2}. R_{F}(Q) is the reflectivity that would occur for a sharp interface of the two bulk phases and Φ is the Fourier transform of the scattering length density distribution in the direction normal to the interface. The term R_{F} is known as the Fresnel reflectivity and includes total reflection below the critical value of Q. The second term concerns interfacial layers and can account for the perturbation in the reflectivity without needing to use dynamic scattering theory that is beyond the first Born approximation. The approach has been used by Tidswell *et al* (Phys. Rev. B, 1990, 41, 1111-1128.) for liquid films and by Penfold *et al* for multilayers of surfactant/polymer complexes (Langmuir, 2007, 23, 3690-3698.).

By analogy with the calculation of scattering from crystals at elevated temperatures, the term Φ^{2} can be multiplied by F_{DW} if the interface gives rise to a reflectivity that is dominated by Bragg peaks. The approximation that the reflectivity is separable in to these distinct functions allows a further simplification: the F_{DW} can be used to multiply the reflectivity calculated by an optical matrix method in place of R_{F}(Q) Φ^{2}. This is the approach used in the program '*byban*'.

It should be emphasised that this approach is quite different to simply increasing the roughness of each bilayer. The thermal fluctuations of the bilayer can reduce the correlation between the lamellae at an interface while preserving well the self-assembled bilayer structure. This reduction in correlation reduces the intensity of the Bragg peaks with increasin Q. The fluctuations can be of the same order or even larger than the lamellar thickness. Roughness must always be constrained to values that are small compared to a layer thickness. The calculation is only approximate as other structure at the interface would not be fluctuating and the Fresnel reflectivity should not be altered. As total reflection occurs at low Q, the influence of F_{DW} is usually small at the critical Q for total reflection.

The possibility to include roughness and near surface layers has been left in the program so as to provide a simple direct comparison with the program '*tram*'. The assumptions for validity of this calculation are that the reflectivity is dominated by the Bragg peaks and that the correlations between the near surface layers and the 'crystal' structure are small so that cross-terms in the expansion of a full scattering function can be ignored. These conditions are fulfilled in a number of practical examples such as those used to illustrate the use of the program in the description below.

The bulk phases are described as 'top' (through which the incident beam reaches the sample) and 'sub' that will be the 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 byban 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 byban that then form repeating bilayers separated by solvent.

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

The fraction of the head region that is occupied by solvent,
x_{hs}, is given by:

x_{hs} = 1 -
(V_{h} / A t_{h} )

The fraction of the tail region that is occupied by solvent,
x_{ts}, is given by:

x_{ts} = 1 -
(2V_{t} / A t_{t} )

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

?_{h} = (1 -
x_{hs}) (b_{h} /
V_{h}) + x_{hs}
?_{sol}

?_{t} = (1 -
x_{ts}) (b_{t} /
V_{t}) + x_{ts}
?_{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 (A_{i})
and close to the bulk solvent (A_{o}). The value of A for
each bilayer is assumed to vary linearly between
A_{i} and A_{o}. This
corresponds to a volume fraction of molecules that varies as 1/z (z is the
disatance away from the interface). For convenience if
A_{o} is set to zero, it is automatically taken to be
identical to A_{i} and this corresponds to no composition
gradient. Thus the general expression for A_{j}, the area
for each molecule in the bilayer number j is:

A_{j} = A_{i} +
(j/N) (A_{o} - A_{i}).

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 *byban* are listed in Table
1.

Table 1. Parameter used in program *byban*

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 | F_{S} |
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 | t_{1} |
Å |

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 | t_{2} |
Å |

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 | t_{3} |
Å |

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 | t_{4} |
Å |

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 | t_{h} |
Å |

20 | Thickness tails | Thick t | t_{t} |
Å |

21 | Thickness solvent | Thick sol. | t_{sol} |
Å |

22 | Volume of heads | Vol. h | V_{h} |
Å^{3} |

23 | Volume of tails | Vol. t | V_{t} |
Å^{3} |

24 | Volume of solvent | Vol. Sol. | V_{sol} |
Å^{3} |

25 | Scattering length - tail | b tail | b_{t} |
fm |

26 | Scattering length - head | b head | b_{h} |
fm |

27 | Area per molecule at interface | Ahg in | A_{i} |
Å^{2} |

28 | Fractional roughness of bilayer structure | Rough f | ξ_{f} |
Å^{2} |

29 | Area per molecule near solvent | Ahg out | A_{o} |
Å^{2} |

30 | Debye-Waller Factor | Debye-W | ζ | Å |

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. The Debye-Waller term (30) is parameterised by the root mean
square fluctuation amplitude, ζ in units of Å

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 '*byban*

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 '*byban*

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 '*byban* showing data with a
model calculation

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

- .DAT - a simple text file as described below.
- .AFT - data files formatted for the AFIT program
- .ASC/.HIS - histogrammed data from the ISIS facility
- .REFL - a data format from NIST
- .TXT - 4 column data from ANSTO
- .OUT - 4 column data from ILL
- .ASC - new ISIS data format

The data format is selected in either the opening dialogue or the Clickfit 'Prelude'. A fuller description of the data formats is available at http://www.reflectometry.net/refdata.htm. 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.

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 '*byban*'.

Figure 8. Graphics window for '*byban*' 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 (bybannn.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.

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 | SiO_{2} amorphous |
3.41 |

Sapphire | Al_{2}O_{3} |
5.8 |

Water | H_{2}O |
-0.56 |

Heavy Water | D_{2}O |
6.35 |

In *byban* 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^{-15}m (fm) |
---|---|---|---|

Water | H_{2}O |
30 | -1.68 |

Heavy Water | D_{2}O |
30 | 19.15 |

Dodecyl Chain | C_{12}H_{25} |
370 | -13.8 |

Dodecyl Chain deuterated |
C_{12}D_{25} |
370 | 246.5 |

Hexaoxaethylene | C_{12}H_{25}O_{6} |
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}.

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 (byban.fcl) is shown below:

vers|1.0 prog|byban.exe prpt|byba prld|wntle|BYBAN-prelude prld|title|BYBAN - A.R. Rennie version 1.7 27 June 20115 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|0| 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 | prld|help|refprel.hhh main|wntle|byban - fitting repeating bilayers (heads/tails) at interface rcmd|wntle|Reading new data rcmd|title|Reading reflectivity data rcmd|Data filename with extension |filer|f1234.asc| rcmd|help|refread.hhh hcmd|wntle|About... hcmd|title|byban - first example of byban+gui hcmd|View file/View helpfile |filed|byban.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|bybanout.txt jcmd|Title for reflectivity results|text|Output from byban 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.

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.

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 paper that describes this type of investigation is:

- Maja S. Hellsing, Adrian R. Rennie, Arwel V. Hughes,
'Adsorption of Aerosol-OT to sapphire - Lamellar structures studied with neutrons' -
*Langmuir***27**, (2011), 4669-4678.

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 programs represents acceptance of this condition.

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

Thanks are due to to Maja Hellsing for providing Figures to illustrate this document and for testing the program. 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 and Astronomy,
Uppsala University, Uppsala, Sweden

E-mail: Adrian.Rennie@physics.uu.se

**Program and documentation: Copyright A. R. Rennie** *Last updated 8 July 2015*