Examples#

Usage examples for the Python RAT API.

ratapi.examples.DSPC_custom_XY()#

Calculate a Custom XY Example for Supported DSPC layer.

In this example, we model the same data (DSPC supported bilayer) as the Custom Layers example, but this time we will use continuous distributions of the volume fractions of each component to build up the SLD profiles (as described in Shekhar et al, J. Appl. Phys., 110, 102216 (2011).)

In this type of model, each ‘layer’ in the sample is described by a roughened Heaviside step function (really, just two error functions back to back). So, in our case, we will need an oxide, a (possible) intervening water layer, and then the bilayer itself.

We can define our lipid in terms of an Area per Molecule, almost in its entirety, if we recognise that where the volume is known, the thickness of the layer is simply given by the layer volume / APM:

\[d_{\textrm{layer}} =\frac{V_{\textrm{layer}} }{{\textrm{APM}}_{\textrm{layer}}}.\]

We can then define the Volume Fraction of this layer with a roughened Heaviside of length dlayer and a height of 1. Then, the total volume occupied will be given by the sum of the volume fractions across the interface. Of course, this does not permit any hydration, so to deal with this, we can simply scale the (full occupation) Heaviside functions by relevant coverage parameters. When this is correctly done, we can obtain the remaining water distribution as:

\[\begin{split}{\textrm{VF}}_{\textrm{wat}} =1-\\sum_n {\textrm{VF}}_n\end{split}\]

where VFn is the Volume Fraction of the n’th layer.

ratapi.examples.DSPC_custom_layers()#

Calculate a Custom Layers example for a supported DSPC layer.

ratapi.examples.DSPC_data_background()#

Calculate a Standard Layers fit of a DSPC floating bilayer with a data background.

ratapi.examples.DSPC_function_background()#

Calculate a standard Layers fit of a DSPC floating bilayer with a function background.

ratapi.examples.DSPC_standard_layers()#

Calculate a standard Layers fit of a DSPC floating bilayer.

The sample consists of a DSPC bilayer, on a silane SAM on Silicon.

ratapi.examples.absorption()#

Run a custom layers model including absorption.

RAT allows the use of an imaginary, as well as real part of the SLD. The effect of this is usually seen below the critical edge, and must sometimes be accounted for.

This is an example of a Custom Layers project using absorption. used here is Custom Layers. It analyses a bilayer sample on a permalloy / gold substrate, measured using polarised neutrons, against D2O and H2O, leading to 4 contrasts in total. Absorption (i.e. imaginary SLD) is defined for Gold and the Permalloy, to account for non-flat data below the critical edge.

ratapi.examples.convert_rascal(mat_filename='lipid_bilayer.mat')#

Convert a project from RasCAL-1 and a project to RasCAL-1.

We convert a RasCAL-1 monolayer volume model to RAT, and the DSPC Standard Layers example to RasCAL-1.

Parameters:

mat_filename (str) – The filename of the output of the RAT project converted to RasCAL-2.

Returns:

A RasCAL-1 monolayer volume model converted to a RAT project, and the struct of the DSPC standard layers example converted to a RasCAL-1 struct.

Return type:

project, struct

ratapi.examples.domains_custom_XY()#

Calculate an example of a layer containing domains using a custom XY model.

Domains custom XY models operate in the same way as domains custom layer models, in that there is an additional input to the custom model specifying the domain to be calculated.

This is then used within the function to calculate the correct SLD profile for each contrast and domain. In this example, we simulate a hydrogenated layer on a silicon substrate, containing domains of a larger SLD, against D2O, SMW and water.

ratapi.examples.domains_custom_layers()#

Calculate an example custom layers domains project involving incoherent summing on a permalloy layer.

For a custom layers model, rather than being forced to define our layers as [Thick SLD Rough…. etc], we can parameterise however we like and then use a function to calculate the parameters for each layer. So for example, if the volume of lipid tails are known (from the literature), then all we need is the Area per molecule to calculate the layers.

ratapi.examples.domains_standard_layers()#

Calculate an example for using standard layers with domains.

Domains standard layers projects proceed in much the same way as a normal standard layers problem, except that there is an additional grouping step between layers and contrasts.

Layers are grouped into ‘Domain Contrasts’. The model for the actual experimental contrast is built from these domain contrasts rather than from layers. There are exactly two domains for each contrast, with the the ratio of them controlled by a fittable ‘domain ratio’ parameter.