Skip to content

Commit 8e7e39e

Browse files
committed
Added loadR2 utility
1 parent 8dceadd commit 8e7e39e

6 files changed

Lines changed: 119 additions & 10 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"procedure":"dream","parallel":"contrasts","numSimulationPoints":500,"resampleMinAngle":0.9,"resampleNPoints":50,"display":"iter","xTolerance":1E-6,"funcTolerance":1E-6,"maxFuncEvals":10000,"maxIterations":1000,"updateFreq":1,"updatePlotFreq":20,"populationSize":20,"fWeight":0.5,"crossoverProbability":0.8,"strategy":4,"targetValue":1,"numGenerations":500,"nLive":150,"nMCMC":0,"propScale":0.1,"nsTolerance":0.1,"nSamples":20000,"nChains":10,"jumpProbability":0.5,"pUnitGamma":0.2,"boundHandling":"reflect","adaptPCR":true}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
function [output,sub_rough] = customBilayerDSPC(params,bulk_in,bulk_out,contrast)
2+
%CUSTOMBILAYER RASCAL Custom Layer Model File.
3+
%
4+
%
5+
% This file accepts 3 vectors containing the values for
6+
% Params, bulk in and bulk out
7+
% The final parameter is an index of the contrast being calculated
8+
% The m-file should output a matrix of layer values, in the form..
9+
% Output = [thick 1, SLD 1, Rough 1, Percent Hydration 1, Hydrate how 1
10+
% ....
11+
% thick n, SLD n, Rough n, Percent Hydration n, Hydration how n]
12+
% The "hydrate how" parameter decides if the layer is hydrated with
13+
% Bulk out or Bulk in phases. Set to 1 for Bulk out, zero for Bulk in.
14+
% Alternatively, leave out hydration and just return..
15+
% Output = [thick 1, SLD 1, Rough 1,
16+
% ....
17+
% thick n, SLD n, Rough n] };
18+
% The second output parameter should be the substrate roughness
19+
20+
sub_rough = params(1);
21+
oxide_thick = params(2);
22+
oxide_hydration = params(3);
23+
lipidAPM = params(4);
24+
headHydration = params(5);
25+
bilayerHydration = params(6);
26+
bilayerRough = params(7);
27+
waterThick = params(8);
28+
29+
30+
% We have a constant SLD for the bilayer
31+
oxide_SLD = 3.41e-6;
32+
33+
% Now make the lipid layers..
34+
% Use known lipid volume and compositions
35+
% to make the layers
36+
37+
% define all the neutron b's.
38+
bc = 0.6646e-4; %Carbon
39+
bo = 0.5843e-4; %Oxygen
40+
bh = -0.3739e-4; %Hydrogen
41+
bp = 0.513e-4; %Phosphorus
42+
bn = 0.936e-4; %Nitrogen
43+
bd = 0.6671e-4; %Deuterium
44+
45+
% Now make the lipid groups..
46+
COO = (4*bo) + (2*bc);
47+
GLYC = (3*bc) + (5*bh);
48+
CH3 = (2*bc) + (6*bh);
49+
PO4 = (1*bp) + (4*bo);
50+
CH2 = (1*bc) + (2*bh);
51+
CHOL = (5*bc) + (12*bh) + (1*bn);
52+
53+
% Group these into heads and tails:
54+
Head = CHOL + PO4 + GLYC + COO;
55+
Tails = (34*CH2) + (2*CH3);
56+
57+
% We need volumes for each.
58+
% Use literature values:
59+
vHead = 319;
60+
vTail = 782;
61+
62+
% we use the volumes to calculate the SLD's
63+
SLDhead = Head / vHead;
64+
SLDtail = Tails / vTail;
65+
66+
% We calculate the layer thickness' from
67+
% the volumes and the APM...
68+
headThick = vHead / lipidAPM;
69+
tailThick = vTail / lipidAPM;
70+
71+
% Manually deal with hydration for layers in
72+
% this example.
73+
oxSLD = (oxide_hydration * bulk_out(contrast)) + ((1 - oxide_hydration) * oxide_SLD);
74+
headSLD = (headHydration * bulk_out(contrast)) + ((1 - headHydration) * SLDhead);
75+
tailSLD = (bilayerHydration * bulk_out(contrast)) + ((1 - bilayerHydration) * SLDtail);
76+
77+
% Make the layers
78+
oxide = [oxide_thick oxSLD sub_rough];
79+
water = [waterThick bulk_out(contrast) bilayerRough];
80+
head = [headThick headSLD bilayerRough];
81+
tail = [tailThick tailSLD bilayerRough];
82+
83+
output = [oxide ; water ; head ; tail ; tail ; head];
84+
85+
86+

0 commit comments

Comments
 (0)