diff --git a/examples/DSPC_custom_XY/controls.json b/examples/DSPC_custom_XY/controls.json new file mode 100644 index 0000000..458cb1e --- /dev/null +++ b/examples/DSPC_custom_XY/controls.json @@ -0,0 +1 @@ +{"procedure":"calculate","parallel":"single","calcSldDuringFit":false,"resampleMinAngle":0.9,"resampleNPoints":50,"display":"iter"} \ No newline at end of file diff --git a/examples/DSPC_custom_XY/custom_XY_DSPC.py b/examples/DSPC_custom_XY/custom_XY_DSPC.py new file mode 100644 index 0000000..0a8c116 --- /dev/null +++ b/examples/DSPC_custom_XY/custom_XY_DSPC.py @@ -0,0 +1,137 @@ +import math + +import numpy as np + + +def custom_XY_DSPC(params, bulk_in, bulk_out, contrast): + """This function makes a model of a supported DSPC bilayer using volume restricted distribution functions.""" + # Split up the parameters + subRough = params[0] + oxideThick = params[1] + oxideHydration = params[2] + waterThick = params[3] + lipidAPM = params[4] + lipidCoverage = params[5] + bilayerRough = params[6] + + # We are going to need our Neutron scattering cross-sections, plus the component volumes + # (the volumes are taken from Armen et al as usual). + # Define these first + + # define all the neutron b's. + bc = 0.6646e-4 # Carbon + bo = 0.5843e-4 # Oxygen + bh = -0.3739e-4 # Hydrogen + bp = 0.513e-4 # Phosphorus + bn = 0.936e-4 # Nitrogen + + # Now make the lipid groups + COO = (4 * bo) + (2 * bc) + GLYC = (3 * bc) + (5 * bh) + CH3 = (2 * bc) + (6 * bh) + PO4 = (1 * bp) + (4 * bo) + CH2 = (1 * bc) + (2 * bh) + CHOL = (5 * bc) + (12 * bh) + (1 * bn) + + # Group these into heads and tails + heads = CHOL + PO4 + GLYC + COO + tails = (34 * CH2) + (2 * CH3) + + # We need volumes for each. Use literature values + vHead = 319 + vTail = 782 + + # Start making our sections. For each we are using a roughened Heaviside to describe our groups. + # We will make these as Volume Fractions (i.e. with a height of 1 for full occupancy), + # which we will correct later for hydration. + + # Make an array of z values for our model + z = np.arange(0, 141) + + # Make our Silicon substrate + vfSilicon, siSurf = layer(z, -25, 50, 1, subRough, subRough) + + # Add the Oxide + vfOxide, oxSurface = layer(z, siSurf, oxideThick, 1, subRough, subRough) + + # We fill in the water at the end, but there may be a hydration layer between the bilayer and the oxide, + # so we start the bilayer stack an appropriate distance away + watSurface = oxSurface + waterThick + + # Now make the first lipid head group + # Work out the thickness + headThick = vHead / lipidAPM + + # ... and make a box for the volume fraction (1 for now, we correct for coverage later) + vfHeadL, headLSurface = layer(z, watSurface, headThick, 1, bilayerRough, bilayerRough) + + # ... also do the same for the tails + # We'll make both together, so the thickness will be twice the volume + tailsThick = (2 * vTail) / lipidAPM + vfTails, tailsSurf = layer(z, headLSurface, tailsThick, 1, bilayerRough, bilayerRough) + + # Finally the upper head ... + vfHeadR, headSurface = layer(z, tailsSurf, headThick, 1, bilayerRough, bilayerRough) + + # Making the model + # We've created the volume fraction profiles corresponding to each of the groups. + # We now convert them to SLDs, taking in account of the hydrations to scale the volume fractions + + # 1. Oxide ... + vfOxide = vfOxide * (1 - oxideHydration) + + # 2. Lipid ... + # Scale both the heads and tails according to overall coverage + vfTails = vfTails * lipidCoverage + vfHeadL = vfHeadL * lipidCoverage + vfHeadR = vfHeadR * lipidCoverage + + # Some extra work to deal with head hydration, which we take to be an additional 30% always + vfHeadL = vfHeadL * 0.7 + vfHeadR = vfHeadR * 0.7 + + # Make a total Volume Fraction across the whole interface + vfTot = vfSilicon + vfOxide + vfHeadL + vfTails + vfHeadR + + # All the volume that's left, we will fill with water + vfWat = 1 - vfTot + + # Now convert all the Volume Fractions to SLDs + sld_Value_Tails = tails / vTail + sld_Value_Head = heads / vHead + + sldSilicon = vfSilicon * 2.073e-6 + sldOxide = vfOxide * 3.41e-6 + + sldHeadL = vfHeadL * sld_Value_Head + sldHeadR = vfHeadR * sld_Value_Head + sldTails = vfTails * sld_Value_Tails + sldWat = vfWat * bulk_out[contrast] + + # Put this all together + totSLD = sldSilicon + sldOxide + sldHeadL + sldTails + sldHeadR + sldWat + + # Make the SLD array for output + SLD = [[a, b] for (a, b) in zip(z, totSLD)] + + return SLD, subRough + + +def layer(z, prevLaySurf, thickness, height, Sigma_L, Sigma_R): + """This produces a layer, with a defined thickness, height and roughness. + Each side of the layer has its own roughness value. + """ + # Find the edges + left = prevLaySurf + right = prevLaySurf + thickness + + # Make our heaviside + a = (z - left) / ((2**0.5) * Sigma_L) + b = (z - right) / ((2**0.5) * Sigma_R) + + erf_a = np.array([math.erf(value) for value in a]) + erf_b = np.array([math.erf(value) for value in b]) + + VF = np.array((height / 2) * (erf_a - erf_b)) + + return VF, right diff --git a/examples/DSPC_custom_XY/project.json b/examples/DSPC_custom_XY/project.json new file mode 100644 index 0000000..9139227 --- /dev/null +++ b/examples/DSPC_custom_XY/project.json @@ -0,0 +1 @@ +{"name": "Orso lipid example - custom XY", "calculation": "non polarised", "model": "custom xy", "geometry": "substrate/liquid", "absorption": false, "parameters": [{"name": "Substrate Roughness", "min": 1.0, "value": 3.0, "max": 10.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Oxide Thickness", "min": 10.0, "value": 15.0, "max": 30.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Oxide Hydration", "min": 0.1, "value": 0.2, "max": 0.4, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Water Thickness", "min": 0.0, "value": 5.0, "max": 20.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Lipid APM", "min": 40.0, "value": 50.0, "max": 90.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Lipid Coverage", "min": 0.9, "value": 1.0, "max": 1.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Bilayer Roughness", "min": 3.0, "value": 5.0, "max": 8.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "bulk_in": [{"name": "Silicon", "min": 2.07e-06, "value": 2.073e-06, "max": 2.08e-06, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "bulk_out": [{"name": "SLD D2O", "min": 5e-06, "value": 6.1e-06, "max": 6.35e-06, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "SLD SMW", "min": 1e-06, "value": 2.073e-06, "max": 3e-06, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "SLD H2O", "min": -6e-07, "value": -5.6e-07, "max": -3e-07, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "scalefactors": [{"name": "Scalefactor 1", "min": 0.5, "value": 1.0, "max": 2.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "domain_ratios": [], "background_parameters": [{"name": "Background parameter D2O", "min": 1e-10, "value": 1e-07, "max": 1e-05, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Background parameter SMW", "min": 0.0, "value": 1e-07, "max": 1e-05, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Background parameter H2O", "min": 0.0, "value": 1e-07, "max": 1e-05, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "backgrounds": [{"name": "Background D2O", "type": "constant", "value_1": "Background parameter D2O", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}, {"name": "Background SMW", "type": "constant", "value_1": "Background parameter SMW", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}, {"name": "Background H2O", "type": "constant", "value_1": "Background parameter H2O", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}], "resolution_parameters": [{"name": "Resolution Param 1", "min": 0.01, "value": 0.03, "max": 0.05, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "resolutions": [{"name": "Resolution 1", "type": "constant", "value_1": "Resolution Param 1", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}, {"name": "Data Resolution", "type": "data", "value_1": "", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}], "custom_files": [{"name": "DSPC Model", "filename": "custom_XY_DSPC.py", "language": "python", "path": "./examples/DSPC_custom_XY"}], "data": [{"name": "Simulation", "data": [], "data_range": [], "simulation_range": [0.005, 0.7]}, {"name": "Bilayer / D2O", "data": [[0.0057118, 0.80913, 0.21163, 0.00028795], [0.0058691, 1.0752, 0.23874, 0.0002962], [0.0060315, 1.0755, 0.18897, 0.00030471], [0.0061994, 1.2951, 0.22787, 0.00031349], [0.0063727, 1.3213, 0.19994, 0.00032256], [0.0065517, 0.99676, 0.12718, 0.00033191], [0.0067366, 1.3087, 0.16472, 0.00034156], [0.0069274, 0.94947, 0.097342, 0.00035151], [0.0071244, 0.98951, 0.088681, 0.00036178], [0.0073278, 1.0361, 0.080311, 0.00037236], [0.0075376, 0.97293, 0.066768, 0.00038328], [0.0077542, 1.035, 0.059054, 0.00039454], [0.0079777, 0.94479, 0.049823, 0.00040615], [0.0082083, 1.0434, 0.048259, 0.00041813], [0.0084461, 1.0045, 0.039538, 0.00043047], [0.0086915, 0.9574, 0.033601, 0.0004432], [0.0089447, 0.92857, 0.029145, 0.00045633], [0.0092057, 0.95709, 0.026996, 0.00046986], [0.009475, 0.96495, 0.024872, 0.00048381], [0.0097527, 1.0356, 0.024179, 0.00049819], [0.010039, 0.96068, 0.020667, 0.00051301], [0.010334, 0.98929, 0.019574, 0.00052829], [0.010639, 1.0348, 0.019004, 0.00054404], [0.010953, 1.0228, 0.017656, 0.00056028], [0.011277, 1.021, 0.016143, 0.00057701], [0.01161, 1.0071, 0.014936, 0.00059426], [0.011954, 0.99918, 0.014062, 0.00061204], [0.012309, 1.0089, 0.013298, 0.00063036], [0.012675, 1.0072, 0.012407, 0.00064925], [0.013052, 0.98556, 0.011377, 0.00066871], [0.01344, 0.98748, 0.010934, 0.00068877], [0.013841, 0.98214, 0.010377, 0.00070944], [0.014254, 0.87823, 0.0091905, 0.00073075], [0.014679, 0.5477, 0.0063914, 0.00075271], [0.015118, 0.29895, 0.0042078, 0.00077534], [0.01557, 0.20403, 0.0032352, 0.00079865], [0.016036, 0.15495, 0.0026677, 0.00082269], [0.016516, 0.12663, 0.0023018, 0.00084745], [0.017011, 0.092231, 0.0019088, 0.00087297], [0.017521, 0.076761, 0.0016965, 0.00089927], [0.018046, 0.062979, 0.0014926, 0.00092637], [0.018588, 0.054176, 0.0013568, 0.0009543], [0.018959, 0.049216, 0.005119, 0.0009825], [0.019517, 0.033476, 0.0027462, 0.0010118], [0.020093, 0.030784, 0.0022798, 0.001042], [0.020687, 0.028541, 0.0019449, 0.0010732], [0.021299, 0.026371, 0.0017941, 0.0011053], [0.02193, 0.021513, 0.0011848, 0.0011384], [0.02258, 0.018216, 0.00090338, 0.0011725], [0.023251, 0.013495, 0.00059985, 0.0012076], [0.023942, 0.014918, 0.00061434, 0.0012439], [0.024655, 0.011625, 0.00043752, 0.0012812], [0.025389, 0.010568, 0.00038864, 0.0013197], [0.026146, 0.009357, 0.00032322, 0.0013594], [0.026926, 0.0083579, 0.00027507, 0.0014003], [0.027731, 0.0071568, 0.00023078, 0.0014424], [0.02856, 0.0064795, 0.00020002, 0.0014859], [0.029414, 0.0053461, 0.00016428, 0.0015306], [0.030295, 0.0050876, 0.00014855, 0.0015768], [0.031202, 0.004162, 0.00012079, 0.0016243], [0.032137, 0.0037583, 0.00010698, 0.0016734], [0.033101, 0.0033047, 9.3559e-05, 0.0017239], [0.034095, 0.0030501, 8.4502e-05, 0.0017759], [0.035118, 0.002803, 7.6113e-05, 0.0018296], [0.036173, 0.0025113, 6.6973e-05, 0.0018849], [0.03726, 0.0022857, 6.0845e-05, 0.0019419], [0.038381, 0.0020586, 5.3916e-05, 0.0020006], [0.039535, 0.0018433, 4.8078e-05, 0.0020612], [0.040725, 0.0016424, 4.3597e-05, 0.0021236], [0.04195, 0.0016172, 4.1052e-05, 0.0021879], [0.043214, 0.0013918, 3.5466e-05, 0.0022542], [0.044515, 0.0013502, 3.3549e-05, 0.0023225], [0.045856, 0.0012032, 3.0163e-05, 0.002393], [0.047238, 0.001153, 2.8017e-05, 0.0024656], [0.048662, 0.0011496, 2.68e-05, 0.0025404], [0.05013, 0.00099878, 2.3916e-05, 0.0026176], [0.051642, 0.00090928, 2.2253e-05, 0.0026971], [0.052362, 0.00093364, 7.4057e-05, 0.0026466], [0.053931, 0.00085039, 5.3373e-05, 0.0027267], [0.055549, 0.0007389, 4.183e-05, 0.0028093], [0.057216, 0.00080543, 4.0271e-05, 0.0028944], [0.058934, 0.00066525, 3.0974e-05, 0.0029822], [0.060705, 0.00068005, 2.8859e-05, 0.0030727], [0.062529, 0.00062689, 2.3624e-05, 0.0031661], [0.064409, 0.00061871, 2.139e-05, 0.0032623], [0.066347, 0.00057996, 1.8549e-05, 0.0033615], [0.068343, 0.00057708, 1.7363e-05, 0.0034638], [0.070401, 0.00047824, 1.413e-05, 0.0035693], [0.072521, 0.00045306, 1.2523e-05, 0.0036781], [0.074705, 0.00044581, 1.1641e-05, 0.0037903], [0.076956, 0.00040641, 1.0238e-05, 0.003906], [0.079275, 0.00037577, 9.1872e-06, 0.0040253], [0.081665, 0.00037196, 8.6233e-06, 0.0041484], [0.084128, 0.00032986, 7.5105e-06, 0.0042754], [0.086665, 0.00030196, 6.6373e-06, 0.0044064], [0.08928, 0.00028539, 6.1e-06, 0.0045415], [0.091974, 0.00026766, 5.5463e-06, 0.0046809], [0.09475, 0.00024604, 5.0224e-06, 0.0048248], [0.09761, 0.00023099, 4.5376e-06, 0.0049732], [0.10056, 0.000206, 4.0827e-06, 0.0051263], [0.10359, 0.00018355, 3.6626e-06, 0.0052844], [0.10672, 0.00015789, 3.176e-06, 0.0054476], [0.10995, 0.0001401, 2.8324e-06, 0.005616], [0.11327, 0.00012388, 2.5242e-06, 0.0057899], [0.11669, 0.00010764, 2.233e-06, 0.0059694], [0.12022, 9.1264e-05, 1.9598e-06, 0.0061548], [0.12385, 7.7687e-05, 1.7269e-06, 0.0063462], [0.12759, 6.6643e-05, 1.5243e-06, 0.006544], [0.13145, 5.4644e-05, 1.3232e-06, 0.0067482], [0.13542, 4.6118e-05, 1.1597e-06, 0.0069593], [0.13952, 3.6927e-05, 1.0042e-06, 0.0071773], [0.14374, 2.8406e-05, 8.6519e-07, 0.0074027], [0.14808, 2.1887e-05, 7.4033e-07, 0.0076357], [0.15256, 1.524e-05, 6.1526e-07, 0.0078765], [0.15717, 1.1539e-05, 5.3438e-07, 0.0081256], [0.16193, 7.3846e-06, 4.4587e-07, 0.0083832], [0.16682, 4.8089e-06, 3.7568e-07, 0.0086496], [0.17187, 3.1754e-06, 3.272e-07, 0.0089254], [0.17707, 2.3124e-06, 2.964e-07, 0.0092107], [0.18243, 5.9916e-07, 2.3989e-07, 0.0095061], [0.18795, 2.2964e-07, 2.3136e-07, 0.009812], [0.19363, 5.1747e-07, 2.4632e-07, 0.010129], [0.19949, 9.1981e-07, 2.547e-07, 0.010457], [0.20553, 8.5905e-07, 2.5007e-07, 0.010797], [0.21175, 7.5717e-07, 2.6728e-07, 0.01115], [0.21815, 1.2167e-06, 2.6304e-07, 0.011515], [0.22475, 8.7884e-07, 2.4686e-07, 0.011895], [0.23156, 8.6619e-07, 2.5636e-07, 0.012288], [0.23856, 1.2552e-07, 2.4662e-07, 0.012697], [0.24578, 6.9057e-07, 2.7196e-07, 0.013121], [0.25322, 1.1345e-06, 2.8793e-07, 0.013561], [0.26088, 1.0345e-06, 2.6218e-07, 0.014019], [0.26878, 4.5589e-07, 2.2887e-07, 0.014495], [0.27692, 3.3247e-07, 2.4888e-07, 0.01499], [0.2853, 9.8265e-07, 2.4589e-07, 0.015505], [0.29393, 2.0578e-07, 2.3722e-07, 0.016041], [0.30283, -2.5061e-07, 2.2853e-07, 0.0166], [0.312, 1.2115e-07, 2.1632e-07, 0.017181], [0.32144, 6.3574e-07, 2.5362e-07, 0.017787], [0.33117, 4.7038e-07, 2.6211e-07, 0.018419], [0.34119, 9.1473e-08, 2.6771e-07, 0.019079], [0.35152, -5.5708e-08, 2.593e-07, 0.019767], [0.36216, 1.147e-06, 2.9303e-07, 0.020486], [0.37313, 1.3574e-06, 3.0051e-07, 0.021237], [0.38442, 3.4657e-07, 3.467e-07, 0.022023], [0.39606, 1.6604e-06, 3.6502e-07, 0.022844]], "data_range": [0.0057118, 0.39606], "simulation_range": [0.0057118, 0.39606]}, {"name": "Bilayer / SMW", "data": [[0.0076029, 0.0062655, 0.0038663, 0.00040889], [0.007894, 0.0069654, 0.003187, 0.00042485], [0.0081974, 0.0082745, 0.003134, 0.00044148], [0.0085137, 0.0057798, 0.0022367, 0.0004588], [0.0088432, 0.0035195, 0.001416, 0.00047683], [0.0091865, 0.0077421, 0.0017487, 0.00049561], [0.0095441, 0.0047236, 0.0012403, 0.00051516], [0.0099167, 0.0030356, 0.00086974, 0.00053552], [0.010305, 0.003415, 0.00081503, 0.00055671], [0.010709, 0.0054965, 0.00093727, 0.00057878], [0.01113, 0.0045413, 0.00076479, 0.00060175], [0.011568, 0.0028372, 0.00054933, 0.00062566], [0.012024, 0.0031035, 0.00052609, 0.00065055], [0.012499, 0.002672, 0.00045092, 0.00067645], [0.012994, 0.0025145, 0.0003969, 0.00070341], [0.013509, 0.0028125, 0.00039068, 0.00073147], [0.014045, 0.002698, 0.00035172, 0.00076068], [0.014603, 0.0023755, 0.00031076, 0.00079107], [0.015183, 0.002494, 0.00029623, 0.00082271], [0.015788, 0.0021612, 0.00025995, 0.00085563], [0.016417, 0.0017002, 0.00022356, 0.00088988], [0.017071, 0.001607, 0.00020864, 0.00092553], [0.017753, 0.0017224, 0.00020812, 0.00096263], [0.018462, 0.0015332, 0.00019088, 0.0010012], [0.0192, 0.0018212, 0.0002031, 0.0010414], [0.019968, 0.0011565, 0.00015702, 0.0010832], [0.020767, 0.0012404, 0.00016011, 0.0011267], [0.021598, 0.0011897, 0.0001589, 0.001172], [0.022391, 0.0010312, 0.00011368, 0.001231], [0.023284, 0.00081551, 8.6663e-05, 0.0012805], [0.024214, 0.0009776, 8.5735e-05, 0.0013321], [0.025183, 0.00075386, 6.647e-05, 0.0013858], [0.026191, 0.00077278, 6.0941e-05, 0.0014417], [0.027241, 0.00076965, 5.5878e-05, 0.0014999], [0.028334, 0.00084815, 5.3499e-05, 0.0015605], [0.029473, 0.00063788, 4.1181e-05, 0.0016236], [0.030658, 0.00058606, 3.5868e-05, 0.0016893], [0.031892, 0.00052866, 3.1423e-05, 0.0017577], [0.033176, 0.00047636, 2.7461e-05, 0.0018289], [0.034513, 0.00050641, 2.6685e-05, 0.001903], [0.035905, 0.00045356, 2.2688e-05, 0.0019802], [0.037355, 0.00042316, 2.0737e-05, 0.0020606], [0.038863, 0.0004082, 1.8701e-05, 0.0021442], [0.040433, 0.00036221, 1.6715e-05, 0.0022314], [0.042068, 0.00035441, 1.5501e-05, 0.0023221], [0.043769, 0.00030534, 1.3683e-05, 0.0024165], [0.04554, 0.0003157, 1.306e-05, 0.0025149], [0.047383, 0.00026957, 1.1336e-05, 0.0026173], [0.049302, 0.00026205, 1.0508e-05, 0.0027239], [0.051299, 0.0002268, 9.62e-06, 0.002835], [0.053377, 0.00023185, 9.1028e-06, 0.0029506], [0.055541, 0.00020148, 8.1413e-06, 0.003071], [0.057792, 0.00018161, 7.6025e-06, 0.0031964], [0.060135, 0.00018774, 7.4695e-06, 0.0033271], [0.062071, 0.00017184, 9.7954e-06, 0.0033352], [0.064577, 0.000163, 8.393e-06, 0.0034712], [0.067187, 0.0001529, 7.2557e-06, 0.0036128], [0.069903, 0.00012821, 6.0878e-06, 0.0037603], [0.072729, 0.00011498, 5.2217e-06, 0.0039141], [0.075672, 0.00011787, 4.6717e-06, 0.0040742], [0.078735, 0.00010904, 4.1646e-06, 0.0042411], [0.081923, 9.6409e-05, 3.5777e-06, 0.004415], [0.085241, 8.1921e-05, 3.0563e-06, 0.0045963], [0.088694, 7.5479e-05, 2.7418e-06, 0.0047852], [0.092289, 7.0579e-05, 2.4511e-06, 0.0049821], [0.09603, 6.131e-05, 2.1459e-06, 0.0051874], [0.099924, 5.9189e-05, 1.9494e-06, 0.0054014], [0.10398, 4.8626e-05, 1.6885e-06, 0.0056247], [0.10819, 4.2236e-05, 1.4473e-06, 0.0058574], [0.11258, 3.4461e-05, 1.2585e-06, 0.0061003], [0.11715, 2.8862e-05, 1.1169e-06, 0.0063536], [0.12191, 2.3232e-05, 9.5792e-07, 0.006618], [0.12686, 1.9011e-05, 8.5326e-07, 0.0068939], [0.13201, 1.5334e-05, 7.5287e-07, 0.0071819], [0.13736, 1.1405e-05, 6.5758e-07, 0.0074827], [0.14294, 8.7894e-06, 6.0684e-07, 0.0077968], [0.14875, 6.1254e-06, 5.442e-07, 0.008125], [0.15479, 5.077e-06, 4.9451e-07, 0.008468], [0.16108, 3.1418e-06, 4.5961e-07, 0.0088266], [0.16762, 3.0271e-06, 4.2547e-07, 0.0092015], [0.17443, 1.4175e-06, 4.0724e-07, 0.0095937], [0.18152, 1.1026e-06, 3.9399e-07, 0.010004], [0.18889, 4.922e-07, 3.8718e-07, 0.010434], [0.19657, 3.8303e-07, 3.9074e-07, 0.010884], [0.20456, 2.7507e-07, 3.9658e-07, 0.011356], [0.21287, 5.1577e-07, 3.9708e-07, 0.01185], [0.22152, -1.4249e-07, 3.9425e-07, 0.012369], [0.23052, -3.5209e-07, 4.0549e-07, 0.012913], [0.23989, 6.0464e-07, 4.3519e-07, 0.013484], [0.24964, 4.3679e-07, 4.5058e-07, 0.014085], [0.25979, 8.9286e-08, 4.3952e-07, 0.014716], [0.27035, 6.2218e-07, 4.4806e-07, 0.015381], [0.28134, -2.7682e-07, 4.49e-07, 0.01608], [0.29278, 3.2166e-07, 4.5407e-07, 0.016816], [0.30468, 1.0896e-07, 4.6808e-07, 0.017593], [0.31707, -7.8017e-07, 4.5974e-07, 0.018413], [0.32996, 1.0431e-06, 5.1414e-07, 0.019278]], "data_range": [0.0076029, 0.32996], "simulation_range": [0.0076029, 0.32996]}, {"name": "Bilayer / H2O", "data": [[0.0063374, 0.12823, 0.039385, 0.00033914], [0.0065738, 0.084726, 0.024968, 0.00035216], [0.0068204, 0.068107, 0.020754, 0.00036572], [0.0070775, 0.064598, 0.016285, 0.00037985], [0.0073457, 0.10179, 0.017018, 0.00039457], [0.0076253, 0.092242, 0.013751, 0.00040991], [0.0079168, 0.067577, 0.0097702, 0.00042588], [0.0082206, 0.088561, 0.0097059, 0.00044252], [0.0085371, 0.07448, 0.0072737, 0.00045984], [0.008867, 0.046379, 0.0048195, 0.00047789], [0.0092106, 0.046316, 0.0041631, 0.00049667], [0.0095686, 0.048837, 0.0037936, 0.00051623], [0.0099414, 0.042241, 0.0031407, 0.00053659], [0.01033, 0.040019, 0.0027336, 0.00055779], [0.010734, 0.036485, 0.0024038, 0.00057986], [0.011155, 0.028296, 0.0019236, 0.00060283], [0.011594, 0.026965, 0.0016661, 0.00062674], [0.01205, 0.026248, 0.0014756, 0.00065162], [0.012525, 0.022186, 0.0012518, 0.00067752], [0.01302, 0.019129, 0.0010586, 0.00070447], [0.013535, 0.017201, 0.00095089, 0.00073252], [0.014071, 0.016285, 0.00086909, 0.00076171], [0.014629, 0.013296, 0.00072488, 0.00079209], [0.015209, 0.011045, 0.0006195, 0.0008237], [0.015814, 0.010244, 0.00057647, 0.0008566], [0.016443, 0.008899, 0.00051765, 0.00089083], [0.017097, 0.0090525, 0.0004941, 0.00092645], [0.017778, 0.007198, 0.00042364, 0.00096351], [0.018487, 0.0071734, 0.000411, 0.0010021], [0.019224, 0.0053014, 0.00034916, 0.0010422], [0.019991, 0.0040658, 0.0002942, 0.001084], [0.02079, 0.0035737, 0.00027823, 0.0011274], [0.021141, 0.0041702, 0.00035516, 0.0011576], [0.021972, 0.0031769, 0.00023015, 0.0012036], [0.022838, 0.0025278, 0.00017246, 0.0012515], [0.02374, 0.002042, 0.00013247, 0.0013013], [0.024678, 0.0018214, 0.0001074, 0.0013532], [0.025655, 0.0018156, 9.9405e-05, 0.0014071], [0.026672, 0.001493, 8.0288e-05, 0.0014633], [0.02773, 0.0012242, 6.5093e-05, 0.0015218], [0.028831, 0.0010878, 5.5556e-05, 0.0015826], [0.029977, 0.0009494, 4.767e-05, 0.0016459], [0.03117, 0.00075857, 3.8051e-05, 0.0017118], [0.032411, 0.00071229, 3.3606e-05, 0.0017804], [0.033703, 0.00058844, 2.863e-05, 0.0018518], [0.035047, 0.00052981, 2.4879e-05, 0.001926], [0.036446, 0.00041317, 2.0072e-05, 0.0020033], [0.037901, 0.00033282, 1.7052e-05, 0.0020838], [0.039415, 0.00028356, 1.4507e-05, 0.0021675], [0.040991, 0.0002625, 1.3357e-05, 0.0022546], [0.04263, 0.00020161, 1.0789e-05, 0.0023453], [0.044336, 0.00019092, 9.9916e-06, 0.0024397], [0.04611, 0.00013093, 7.7505e-06, 0.0025379], [0.047956, 0.00013752, 7.5144e-06, 0.0026401], [0.049877, 0.00011123, 6.4842e-06, 0.0027465], [0.051876, 8.3709e-05, 5.4462e-06, 0.0028573], [0.053955, 7.5738e-05, 4.9643e-06, 0.0029726], [0.056118, 6.588e-05, 4.4172e-06, 0.0030926], [0.058368, 6.0283e-05, 4.2269e-06, 0.0032176], [0.058514, 5.6798e-05, 6.7895e-06, 0.0031323], [0.06085, 4.3927e-05, 5.3636e-06, 0.0032585], [0.063279, 4.6048e-05, 4.5458e-06, 0.0033898], [0.065808, 3.4073e-05, 3.7013e-06, 0.0035266], [0.068438, 4.0143e-05, 3.5649e-06, 0.003669], [0.071175, 2.6662e-05, 2.8241e-06, 0.0038173], [0.074023, 2.4083e-05, 2.3545e-06, 0.0039717], [0.076986, 2.3309e-05, 2.266e-06, 0.0041325], [0.080068, 2.8828e-05, 2.1438e-06, 0.0043001], [0.083276, 1.9108e-05, 1.7976e-06, 0.0044746], [0.086612, 1.8879e-05, 1.6076e-06, 0.0046564], [0.090084, 1.7687e-05, 1.4593e-06, 0.0048458], [0.093695, 1.9856e-05, 1.3628e-06, 0.0050431], [0.097452, 1.5334e-05, 1.2134e-06, 0.0052488], [0.10136, 1.6665e-05, 1.1448e-06, 0.0054631], [0.10543, 1.375e-05, 1.0325e-06, 0.0056866], [0.10966, 1.502e-05, 9.7171e-07, 0.0059195], [0.11406, 1.3664e-05, 8.8592e-07, 0.0061624], [0.11864, 1.3706e-05, 8.2178e-07, 0.0064157], [0.1234, 1.1483e-05, 7.5018e-07, 0.0066799], [0.12836, 1.1903e-05, 6.9697e-07, 0.0069556], [0.13351, 7.5482e-06, 6.225e-07, 0.0072433], [0.13887, 7.5468e-06, 5.8373e-07, 0.0075436], [0.14445, 6.7379e-06, 5.4847e-07, 0.0078571], [0.15025, 6.263e-06, 5.1627e-07, 0.0081845], [0.15629, 4.3803e-06, 4.7069e-07, 0.0085265], [0.16257, 3.0045e-06, 4.4574e-07, 0.008884], [0.1691, 1.5888e-06, 4.1655e-07, 0.0092576], [0.1759, 1.2506e-06, 4.0119e-07, 0.0096483], [0.18297, 1.2114e-06, 3.9518e-07, 0.010057], [0.19032, 5.2251e-07, 3.8281e-07, 0.010485], [0.19797, -2.0168e-07, 3.7798e-07, 0.010933], [0.20593, 2.1403e-07, 3.8461e-07, 0.011402], [0.2142, -2.4472e-07, 3.8796e-07, 0.011893], [0.22282, 3.7336e-07, 4.076e-07, 0.012409], [0.23177, 1.371e-06, 4.2292e-07, 0.012949], [0.24109, 9.7523e-07, 4.4739e-07, 0.013517], [0.25078, 1.7962e-06, 4.7723e-07, 0.014113], [0.26087, 1.5649e-06, 4.6336e-07, 0.014739], [0.27136, 1.8752e-06, 4.7594e-07, 0.015398], [0.28227, 2.1743e-06, 4.729e-07, 0.016091], [0.29362, -2.8282e-07, 4.6128e-07, 0.016821], [0.30542, 1.2489e-06, 4.7552e-07, 0.01759], [0.31771, 1.0352e-06, 4.9121e-07, 0.018401], [0.33048, -6.7397e-07, 5.0658e-07, 0.019257]], "data_range": [0.0063374, 0.33048], "simulation_range": [0.0063374, 0.33048]}], "layers": [], "domain_contrasts": [], "contrasts": [{"name": "Bilayer / D2O", "data": "Bilayer / D2O", "background": "Background D2O", "background_action": "add", "bulk_in": "Silicon", "bulk_out": "SLD D2O", "scalefactor": "Scalefactor 1", "resolution": "Data Resolution", "resample": false, "model": ["DSPC Model"]}, {"name": "Bilayer / SMW", "data": "Bilayer / SMW", "background": "Background SMW", "background_action": "add", "bulk_in": "Silicon", "bulk_out": "SLD SMW", "scalefactor": "Scalefactor 1", "resolution": "Data Resolution", "resample": false, "model": ["DSPC Model"]}, {"name": "Bilayer / H2O", "data": "Bilayer / H2O", "background": "Background H2O", "background_action": "add", "bulk_in": "Silicon", "bulk_out": "SLD H2O", "scalefactor": "Scalefactor 1", "resolution": "Data Resolution", "resample": false, "model": ["DSPC Model"]}]} diff --git a/examples/DSPC_custom_layers/controls.json b/examples/DSPC_custom_layers/controls.json new file mode 100644 index 0000000..458cb1e --- /dev/null +++ b/examples/DSPC_custom_layers/controls.json @@ -0,0 +1 @@ +{"procedure":"calculate","parallel":"single","calcSldDuringFit":false,"resampleMinAngle":0.9,"resampleNPoints":50,"display":"iter"} \ No newline at end of file diff --git a/examples/DSPC_custom_layers/custom_bilayer_DSPC.py b/examples/DSPC_custom_layers/custom_bilayer_DSPC.py new file mode 100644 index 0000000..c97cde4 --- /dev/null +++ b/examples/DSPC_custom_layers/custom_bilayer_DSPC.py @@ -0,0 +1,85 @@ +import numpy as np + + +def custom_bilayer_DSPC(params, bulk_in, bulk_out, contrast): + """CUSTOMBILAYER RAT Custom Layer Model File. + + This file accepts 3 vectors containing the values for params, bulk in and bulk out. + The final parameter is an index of the contrast being calculated. + + The function should output a matrix of layer values, in the form... + + Output = [thick 1, SLD 1, Rough 1, Percent Hydration 1, Hydrate how 1 + .... + thick n, SLD n, Rough n, Percent Hydration n, Hydration how n] + + The "hydrate how" parameter decides if the layer is hydrated with Bulk out or Bulk in phases. + Set to 1 for Bulk out, zero for Bulk in. + Alternatively, leave out hydration and just return... + + Output = [thick 1, SLD 1, Rough 1, + .... + thick n, SLD n, Rough n] + + The second output parameter should be the substrate roughness. + """ + sub_rough = params[0] + oxide_thick = params[1] + oxide_hydration = params[2] + lipidAPM = params[3] + headHydration = params[4] + bilayerHydration = params[5] + bilayerRough = params[6] + waterThick = params[7] + + # We have a constant SLD for the bilayer + oxide_SLD = 3.41e-6 + + # Now make the lipid layers + # Use known lipid volume and compositions to make the layers + + # define all the neutron b's. + bc = 0.6646e-4 # Carbon + bo = 0.5843e-4 # Oxygen + bh = -0.3739e-4 # Hydrogen + bp = 0.513e-4 # Phosphorus + bn = 0.936e-4 # Nitrogen + + # Now make the lipid groups + COO = (4 * bo) + (2 * bc) + GLYC = (3 * bc) + (5 * bh) + CH3 = (2 * bc) + (6 * bh) + PO4 = (1 * bp) + (4 * bo) + CH2 = (1 * bc) + (2 * bh) + CHOL = (5 * bc) + (12 * bh) + (1 * bn) + + # Group these into heads and tails: + Head = CHOL + PO4 + GLYC + COO + Tails = (34 * CH2) + (2 * CH3) + + # We need volumes for each. Use literature values: + vHead = 319 + vTail = 782 + + # We use the volumes to calculate the SLDs + SLDhead = Head / vHead + SLDtail = Tails / vTail + + # We calculate the layer thickness' from the volumes and the APM + headThick = vHead / lipidAPM + tailThick = vTail / lipidAPM + + # Manually deal with hydration for layers in this example. + oxSLD = (oxide_hydration * bulk_out[contrast]) + ((1 - oxide_hydration) * oxide_SLD) + headSLD = (headHydration * bulk_out[contrast]) + ((1 - headHydration) * SLDhead) + tailSLD = (bilayerHydration * bulk_out[contrast]) + ((1 - bilayerHydration) * SLDtail) + + # Make the layers + oxide = [oxide_thick, oxSLD, sub_rough] + water = [waterThick, bulk_out[contrast], bilayerRough] + head = [headThick, headSLD, bilayerRough] + tail = [tailThick, tailSLD, bilayerRough] + + output = np.array([oxide, water, head, tail, tail, head]) + + return output, sub_rough diff --git a/examples/DSPC_custom_layers/project.json b/examples/DSPC_custom_layers/project.json new file mode 100644 index 0000000..987a4ab --- /dev/null +++ b/examples/DSPC_custom_layers/project.json @@ -0,0 +1 @@ +{"name": "Orso lipid example - custom layers", "calculation": "non polarised", "model": "custom layers", "geometry": "substrate/liquid", "absorption": false, "parameters": [{"name": "Substrate Roughness", "min": 1.0, "value": 3.0, "max": 10.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Oxide Thickness", "min": 5.0, "value": 20.0, "max": 60.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Oxide Hydration", "min": 0.0, "value": 0.2, "max": 0.5, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Lipid APM", "min": 45.0, "value": 55.0, "max": 65.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Head Hydration", "min": 0.0, "value": 0.2, "max": 0.5, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Bilayer Hydration", "min": 0.0, "value": 0.1, "max": 0.2, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Bilayer Roughness", "min": 2.0, "value": 4.0, "max": 8.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Water Thickness", "min": 0.0, "value": 2.0, "max": 10.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "bulk_in": [{"name": "Silicon", "min": 2.07e-06, "value": 2.073e-06, "max": 2.08e-06, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "bulk_out": [{"name": "SLD D2O", "min": 5e-06, "value": 6.35e-06, "max": 6.35e-06, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "SLD SMW", "min": 1e-06, "value": 2.073e-06, "max": 3e-06, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "SLD H2O", "min": -6e-07, "value": -5.6e-07, "max": -3e-07, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "scalefactors": [{"name": "Scalefactor 1", "min": 0.5, "value": 1.0, "max": 2.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "domain_ratios": [], "background_parameters": [{"name": "Background parameter D2O", "min": 1e-10, "value": 1e-07, "max": 1e-05, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Background parameter SMW", "min": 1e-10, "value": 1e-07, "max": 1e-05, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Background parameter H2O", "min": 1e-10, "value": 1e-07, "max": 1e-05, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "backgrounds": [{"name": "Background D2O", "type": "constant", "value_1": "Background parameter D2O", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}, {"name": "Background SMW", "type": "constant", "value_1": "Background parameter SMW", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}, {"name": "Background H2O", "type": "constant", "value_1": "Background parameter H2O", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}], "resolution_parameters": [{"name": "Resolution Param 1", "min": 0.01, "value": 0.03, "max": 0.05, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "resolutions": [{"name": "Resolution 1", "type": "constant", "value_1": "Resolution Param 1", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}, {"name": "Data Resolution", "type": "data", "value_1": "", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}], "custom_files": [{"name": "DSPC Model", "filename": "custom_bilayer_DSPC.py", "language": "python", "path": "./examples/DSPC_custom_layers/"}], "data": [{"name": "Simulation", "data": [], "data_range": [], "simulation_range": [0.005, 0.7]}, {"name": "Bilayer / D2O", "data": [[0.0057118, 0.80913, 0.21163, 0.00028795], [0.0058691, 1.0752, 0.23874, 0.0002962], [0.0060315, 1.0755, 0.18897, 0.00030471], [0.0061994, 1.2951, 0.22787, 0.00031349], [0.0063727, 1.3213, 0.19994, 0.00032256], [0.0065517, 0.99676, 0.12718, 0.00033191], [0.0067366, 1.3087, 0.16472, 0.00034156], [0.0069274, 0.94947, 0.097342, 0.00035151], [0.0071244, 0.98951, 0.088681, 0.00036178], [0.0073278, 1.0361, 0.080311, 0.00037236], [0.0075376, 0.97293, 0.066768, 0.00038328], [0.0077542, 1.035, 0.059054, 0.00039454], [0.0079777, 0.94479, 0.049823, 0.00040615], [0.0082083, 1.0434, 0.048259, 0.00041813], [0.0084461, 1.0045, 0.039538, 0.00043047], [0.0086915, 0.9574, 0.033601, 0.0004432], [0.0089447, 0.92857, 0.029145, 0.00045633], [0.0092057, 0.95709, 0.026996, 0.00046986], [0.009475, 0.96495, 0.024872, 0.00048381], [0.0097527, 1.0356, 0.024179, 0.00049819], [0.010039, 0.96068, 0.020667, 0.00051301], [0.010334, 0.98929, 0.019574, 0.00052829], [0.010639, 1.0348, 0.019004, 0.00054404], [0.010953, 1.0228, 0.017656, 0.00056028], [0.011277, 1.021, 0.016143, 0.00057701], [0.01161, 1.0071, 0.014936, 0.00059426], [0.011954, 0.99918, 0.014062, 0.00061204], [0.012309, 1.0089, 0.013298, 0.00063036], [0.012675, 1.0072, 0.012407, 0.00064925], [0.013052, 0.98556, 0.011377, 0.00066871], [0.01344, 0.98748, 0.010934, 0.00068877], [0.013841, 0.98214, 0.010377, 0.00070944], [0.014254, 0.87823, 0.0091905, 0.00073075], [0.014679, 0.5477, 0.0063914, 0.00075271], [0.015118, 0.29895, 0.0042078, 0.00077534], [0.01557, 0.20403, 0.0032352, 0.00079865], [0.016036, 0.15495, 0.0026677, 0.00082269], [0.016516, 0.12663, 0.0023018, 0.00084745], [0.017011, 0.092231, 0.0019088, 0.00087297], [0.017521, 0.076761, 0.0016965, 0.00089927], [0.018046, 0.062979, 0.0014926, 0.00092637], [0.018588, 0.054176, 0.0013568, 0.0009543], [0.018959, 0.049216, 0.005119, 0.0009825], [0.019517, 0.033476, 0.0027462, 0.0010118], [0.020093, 0.030784, 0.0022798, 0.001042], [0.020687, 0.028541, 0.0019449, 0.0010732], [0.021299, 0.026371, 0.0017941, 0.0011053], [0.02193, 0.021513, 0.0011848, 0.0011384], [0.02258, 0.018216, 0.00090338, 0.0011725], [0.023251, 0.013495, 0.00059985, 0.0012076], [0.023942, 0.014918, 0.00061434, 0.0012439], [0.024655, 0.011625, 0.00043752, 0.0012812], [0.025389, 0.010568, 0.00038864, 0.0013197], [0.026146, 0.009357, 0.00032322, 0.0013594], [0.026926, 0.0083579, 0.00027507, 0.0014003], [0.027731, 0.0071568, 0.00023078, 0.0014424], [0.02856, 0.0064795, 0.00020002, 0.0014859], [0.029414, 0.0053461, 0.00016428, 0.0015306], [0.030295, 0.0050876, 0.00014855, 0.0015768], [0.031202, 0.004162, 0.00012079, 0.0016243], [0.032137, 0.0037583, 0.00010698, 0.0016734], [0.033101, 0.0033047, 9.3559e-05, 0.0017239], [0.034095, 0.0030501, 8.4502e-05, 0.0017759], [0.035118, 0.002803, 7.6113e-05, 0.0018296], [0.036173, 0.0025113, 6.6973e-05, 0.0018849], [0.03726, 0.0022857, 6.0845e-05, 0.0019419], [0.038381, 0.0020586, 5.3916e-05, 0.0020006], [0.039535, 0.0018433, 4.8078e-05, 0.0020612], [0.040725, 0.0016424, 4.3597e-05, 0.0021236], [0.04195, 0.0016172, 4.1052e-05, 0.0021879], [0.043214, 0.0013918, 3.5466e-05, 0.0022542], [0.044515, 0.0013502, 3.3549e-05, 0.0023225], [0.045856, 0.0012032, 3.0163e-05, 0.002393], [0.047238, 0.001153, 2.8017e-05, 0.0024656], [0.048662, 0.0011496, 2.68e-05, 0.0025404], [0.05013, 0.00099878, 2.3916e-05, 0.0026176], [0.051642, 0.00090928, 2.2253e-05, 0.0026971], [0.052362, 0.00093364, 7.4057e-05, 0.0026466], [0.053931, 0.00085039, 5.3373e-05, 0.0027267], [0.055549, 0.0007389, 4.183e-05, 0.0028093], [0.057216, 0.00080543, 4.0271e-05, 0.0028944], [0.058934, 0.00066525, 3.0974e-05, 0.0029822], [0.060705, 0.00068005, 2.8859e-05, 0.0030727], [0.062529, 0.00062689, 2.3624e-05, 0.0031661], [0.064409, 0.00061871, 2.139e-05, 0.0032623], [0.066347, 0.00057996, 1.8549e-05, 0.0033615], [0.068343, 0.00057708, 1.7363e-05, 0.0034638], [0.070401, 0.00047824, 1.413e-05, 0.0035693], [0.072521, 0.00045306, 1.2523e-05, 0.0036781], [0.074705, 0.00044581, 1.1641e-05, 0.0037903], [0.076956, 0.00040641, 1.0238e-05, 0.003906], [0.079275, 0.00037577, 9.1872e-06, 0.0040253], [0.081665, 0.00037196, 8.6233e-06, 0.0041484], [0.084128, 0.00032986, 7.5105e-06, 0.0042754], [0.086665, 0.00030196, 6.6373e-06, 0.0044064], [0.08928, 0.00028539, 6.1e-06, 0.0045415], [0.091974, 0.00026766, 5.5463e-06, 0.0046809], [0.09475, 0.00024604, 5.0224e-06, 0.0048248], [0.09761, 0.00023099, 4.5376e-06, 0.0049732], [0.10056, 0.000206, 4.0827e-06, 0.0051263], [0.10359, 0.00018355, 3.6626e-06, 0.0052844], [0.10672, 0.00015789, 3.176e-06, 0.0054476], [0.10995, 0.0001401, 2.8324e-06, 0.005616], [0.11327, 0.00012388, 2.5242e-06, 0.0057899], [0.11669, 0.00010764, 2.233e-06, 0.0059694], [0.12022, 9.1264e-05, 1.9598e-06, 0.0061548], [0.12385, 7.7687e-05, 1.7269e-06, 0.0063462], [0.12759, 6.6643e-05, 1.5243e-06, 0.006544], [0.13145, 5.4644e-05, 1.3232e-06, 0.0067482], [0.13542, 4.6118e-05, 1.1597e-06, 0.0069593], [0.13952, 3.6927e-05, 1.0042e-06, 0.0071773], [0.14374, 2.8406e-05, 8.6519e-07, 0.0074027], [0.14808, 2.1887e-05, 7.4033e-07, 0.0076357], [0.15256, 1.524e-05, 6.1526e-07, 0.0078765], [0.15717, 1.1539e-05, 5.3438e-07, 0.0081256], [0.16193, 7.3846e-06, 4.4587e-07, 0.0083832], [0.16682, 4.8089e-06, 3.7568e-07, 0.0086496], [0.17187, 3.1754e-06, 3.272e-07, 0.0089254], [0.17707, 2.3124e-06, 2.964e-07, 0.0092107], [0.18243, 5.9916e-07, 2.3989e-07, 0.0095061], [0.18795, 2.2964e-07, 2.3136e-07, 0.009812], [0.19363, 5.1747e-07, 2.4632e-07, 0.010129], [0.19949, 9.1981e-07, 2.547e-07, 0.010457], [0.20553, 8.5905e-07, 2.5007e-07, 0.010797], [0.21175, 7.5717e-07, 2.6728e-07, 0.01115], [0.21815, 1.2167e-06, 2.6304e-07, 0.011515], [0.22475, 8.7884e-07, 2.4686e-07, 0.011895], [0.23156, 8.6619e-07, 2.5636e-07, 0.012288], [0.23856, 1.2552e-07, 2.4662e-07, 0.012697], [0.24578, 6.9057e-07, 2.7196e-07, 0.013121], [0.25322, 1.1345e-06, 2.8793e-07, 0.013561], [0.26088, 1.0345e-06, 2.6218e-07, 0.014019], [0.26878, 4.5589e-07, 2.2887e-07, 0.014495], [0.27692, 3.3247e-07, 2.4888e-07, 0.01499], [0.2853, 9.8265e-07, 2.4589e-07, 0.015505], [0.29393, 2.0578e-07, 2.3722e-07, 0.016041], [0.30283, -2.5061e-07, 2.2853e-07, 0.0166], [0.312, 1.2115e-07, 2.1632e-07, 0.017181], [0.32144, 6.3574e-07, 2.5362e-07, 0.017787], [0.33117, 4.7038e-07, 2.6211e-07, 0.018419], [0.34119, 9.1473e-08, 2.6771e-07, 0.019079], [0.35152, -5.5708e-08, 2.593e-07, 0.019767], [0.36216, 1.147e-06, 2.9303e-07, 0.020486], [0.37313, 1.3574e-06, 3.0051e-07, 0.021237], [0.38442, 3.4657e-07, 3.467e-07, 0.022023], [0.39606, 1.6604e-06, 3.6502e-07, 0.022844]], "data_range": [0.013, 0.37], "simulation_range": [0.0057118, 0.39606]}, {"name": "Bilayer / SMW", "data": [[0.0076029, 0.0062655, 0.0038663, 0.00040889], [0.007894, 0.0069654, 0.003187, 0.00042485], [0.0081974, 0.0082745, 0.003134, 0.00044148], [0.0085137, 0.0057798, 0.0022367, 0.0004588], [0.0088432, 0.0035195, 0.001416, 0.00047683], [0.0091865, 0.0077421, 0.0017487, 0.00049561], [0.0095441, 0.0047236, 0.0012403, 0.00051516], [0.0099167, 0.0030356, 0.00086974, 0.00053552], [0.010305, 0.003415, 0.00081503, 0.00055671], [0.010709, 0.0054965, 0.00093727, 0.00057878], [0.01113, 0.0045413, 0.00076479, 0.00060175], [0.011568, 0.0028372, 0.00054933, 0.00062566], [0.012024, 0.0031035, 0.00052609, 0.00065055], [0.012499, 0.002672, 0.00045092, 0.00067645], [0.012994, 0.0025145, 0.0003969, 0.00070341], [0.013509, 0.0028125, 0.00039068, 0.00073147], [0.014045, 0.002698, 0.00035172, 0.00076068], [0.014603, 0.0023755, 0.00031076, 0.00079107], [0.015183, 0.002494, 0.00029623, 0.00082271], [0.015788, 0.0021612, 0.00025995, 0.00085563], [0.016417, 0.0017002, 0.00022356, 0.00088988], [0.017071, 0.001607, 0.00020864, 0.00092553], [0.017753, 0.0017224, 0.00020812, 0.00096263], [0.018462, 0.0015332, 0.00019088, 0.0010012], [0.0192, 0.0018212, 0.0002031, 0.0010414], [0.019968, 0.0011565, 0.00015702, 0.0010832], [0.020767, 0.0012404, 0.00016011, 0.0011267], [0.021598, 0.0011897, 0.0001589, 0.001172], [0.022391, 0.0010312, 0.00011368, 0.001231], [0.023284, 0.00081551, 8.6663e-05, 0.0012805], [0.024214, 0.0009776, 8.5735e-05, 0.0013321], [0.025183, 0.00075386, 6.647e-05, 0.0013858], [0.026191, 0.00077278, 6.0941e-05, 0.0014417], [0.027241, 0.00076965, 5.5878e-05, 0.0014999], [0.028334, 0.00084815, 5.3499e-05, 0.0015605], [0.029473, 0.00063788, 4.1181e-05, 0.0016236], [0.030658, 0.00058606, 3.5868e-05, 0.0016893], [0.031892, 0.00052866, 3.1423e-05, 0.0017577], [0.033176, 0.00047636, 2.7461e-05, 0.0018289], [0.034513, 0.00050641, 2.6685e-05, 0.001903], [0.035905, 0.00045356, 2.2688e-05, 0.0019802], [0.037355, 0.00042316, 2.0737e-05, 0.0020606], [0.038863, 0.0004082, 1.8701e-05, 0.0021442], [0.040433, 0.00036221, 1.6715e-05, 0.0022314], [0.042068, 0.00035441, 1.5501e-05, 0.0023221], [0.043769, 0.00030534, 1.3683e-05, 0.0024165], [0.04554, 0.0003157, 1.306e-05, 0.0025149], [0.047383, 0.00026957, 1.1336e-05, 0.0026173], [0.049302, 0.00026205, 1.0508e-05, 0.0027239], [0.051299, 0.0002268, 9.62e-06, 0.002835], [0.053377, 0.00023185, 9.1028e-06, 0.0029506], [0.055541, 0.00020148, 8.1413e-06, 0.003071], [0.057792, 0.00018161, 7.6025e-06, 0.0031964], [0.060135, 0.00018774, 7.4695e-06, 0.0033271], [0.062071, 0.00017184, 9.7954e-06, 0.0033352], [0.064577, 0.000163, 8.393e-06, 0.0034712], [0.067187, 0.0001529, 7.2557e-06, 0.0036128], [0.069903, 0.00012821, 6.0878e-06, 0.0037603], [0.072729, 0.00011498, 5.2217e-06, 0.0039141], [0.075672, 0.00011787, 4.6717e-06, 0.0040742], [0.078735, 0.00010904, 4.1646e-06, 0.0042411], [0.081923, 9.6409e-05, 3.5777e-06, 0.004415], [0.085241, 8.1921e-05, 3.0563e-06, 0.0045963], [0.088694, 7.5479e-05, 2.7418e-06, 0.0047852], [0.092289, 7.0579e-05, 2.4511e-06, 0.0049821], [0.09603, 6.131e-05, 2.1459e-06, 0.0051874], [0.099924, 5.9189e-05, 1.9494e-06, 0.0054014], [0.10398, 4.8626e-05, 1.6885e-06, 0.0056247], [0.10819, 4.2236e-05, 1.4473e-06, 0.0058574], [0.11258, 3.4461e-05, 1.2585e-06, 0.0061003], [0.11715, 2.8862e-05, 1.1169e-06, 0.0063536], [0.12191, 2.3232e-05, 9.5792e-07, 0.006618], [0.12686, 1.9011e-05, 8.5326e-07, 0.0068939], [0.13201, 1.5334e-05, 7.5287e-07, 0.0071819], [0.13736, 1.1405e-05, 6.5758e-07, 0.0074827], [0.14294, 8.7894e-06, 6.0684e-07, 0.0077968], [0.14875, 6.1254e-06, 5.442e-07, 0.008125], [0.15479, 5.077e-06, 4.9451e-07, 0.008468], [0.16108, 3.1418e-06, 4.5961e-07, 0.0088266], [0.16762, 3.0271e-06, 4.2547e-07, 0.0092015], [0.17443, 1.4175e-06, 4.0724e-07, 0.0095937], [0.18152, 1.1026e-06, 3.9399e-07, 0.010004], [0.18889, 4.922e-07, 3.8718e-07, 0.010434], [0.19657, 3.8303e-07, 3.9074e-07, 0.010884], [0.20456, 2.7507e-07, 3.9658e-07, 0.011356], [0.21287, 5.1577e-07, 3.9708e-07, 0.01185], [0.22152, -1.4249e-07, 3.9425e-07, 0.012369], [0.23052, -3.5209e-07, 4.0549e-07, 0.012913], [0.23989, 6.0464e-07, 4.3519e-07, 0.013484], [0.24964, 4.3679e-07, 4.5058e-07, 0.014085], [0.25979, 8.9286e-08, 4.3952e-07, 0.014716], [0.27035, 6.2218e-07, 4.4806e-07, 0.015381], [0.28134, -2.7682e-07, 4.49e-07, 0.01608], [0.29278, 3.2166e-07, 4.5407e-07, 0.016816], [0.30468, 1.0896e-07, 4.6808e-07, 0.017593], [0.31707, -7.8017e-07, 4.5974e-07, 0.018413], [0.32996, 1.0431e-06, 5.1414e-07, 0.019278]], "data_range": [0.013, 0.32996], "simulation_range": [0.0076029, 0.32996]}, {"name": "Bilayer / H2O", "data": [[0.0063374, 0.12823, 0.039385, 0.00033914], [0.0065738, 0.084726, 0.024968, 0.00035216], [0.0068204, 0.068107, 0.020754, 0.00036572], [0.0070775, 0.064598, 0.016285, 0.00037985], [0.0073457, 0.10179, 0.017018, 0.00039457], [0.0076253, 0.092242, 0.013751, 0.00040991], [0.0079168, 0.067577, 0.0097702, 0.00042588], [0.0082206, 0.088561, 0.0097059, 0.00044252], [0.0085371, 0.07448, 0.0072737, 0.00045984], [0.008867, 0.046379, 0.0048195, 0.00047789], [0.0092106, 0.046316, 0.0041631, 0.00049667], [0.0095686, 0.048837, 0.0037936, 0.00051623], [0.0099414, 0.042241, 0.0031407, 0.00053659], [0.01033, 0.040019, 0.0027336, 0.00055779], [0.010734, 0.036485, 0.0024038, 0.00057986], [0.011155, 0.028296, 0.0019236, 0.00060283], [0.011594, 0.026965, 0.0016661, 0.00062674], [0.01205, 0.026248, 0.0014756, 0.00065162], [0.012525, 0.022186, 0.0012518, 0.00067752], [0.01302, 0.019129, 0.0010586, 0.00070447], [0.013535, 0.017201, 0.00095089, 0.00073252], [0.014071, 0.016285, 0.00086909, 0.00076171], [0.014629, 0.013296, 0.00072488, 0.00079209], [0.015209, 0.011045, 0.0006195, 0.0008237], [0.015814, 0.010244, 0.00057647, 0.0008566], [0.016443, 0.008899, 0.00051765, 0.00089083], [0.017097, 0.0090525, 0.0004941, 0.00092645], [0.017778, 0.007198, 0.00042364, 0.00096351], [0.018487, 0.0071734, 0.000411, 0.0010021], [0.019224, 0.0053014, 0.00034916, 0.0010422], [0.019991, 0.0040658, 0.0002942, 0.001084], [0.02079, 0.0035737, 0.00027823, 0.0011274], [0.021141, 0.0041702, 0.00035516, 0.0011576], [0.021972, 0.0031769, 0.00023015, 0.0012036], [0.022838, 0.0025278, 0.00017246, 0.0012515], [0.02374, 0.002042, 0.00013247, 0.0013013], [0.024678, 0.0018214, 0.0001074, 0.0013532], [0.025655, 0.0018156, 9.9405e-05, 0.0014071], [0.026672, 0.001493, 8.0288e-05, 0.0014633], [0.02773, 0.0012242, 6.5093e-05, 0.0015218], [0.028831, 0.0010878, 5.5556e-05, 0.0015826], [0.029977, 0.0009494, 4.767e-05, 0.0016459], [0.03117, 0.00075857, 3.8051e-05, 0.0017118], [0.032411, 0.00071229, 3.3606e-05, 0.0017804], [0.033703, 0.00058844, 2.863e-05, 0.0018518], [0.035047, 0.00052981, 2.4879e-05, 0.001926], [0.036446, 0.00041317, 2.0072e-05, 0.0020033], [0.037901, 0.00033282, 1.7052e-05, 0.0020838], [0.039415, 0.00028356, 1.4507e-05, 0.0021675], [0.040991, 0.0002625, 1.3357e-05, 0.0022546], [0.04263, 0.00020161, 1.0789e-05, 0.0023453], [0.044336, 0.00019092, 9.9916e-06, 0.0024397], [0.04611, 0.00013093, 7.7505e-06, 0.0025379], [0.047956, 0.00013752, 7.5144e-06, 0.0026401], [0.049877, 0.00011123, 6.4842e-06, 0.0027465], [0.051876, 8.3709e-05, 5.4462e-06, 0.0028573], [0.053955, 7.5738e-05, 4.9643e-06, 0.0029726], [0.056118, 6.588e-05, 4.4172e-06, 0.0030926], [0.058368, 6.0283e-05, 4.2269e-06, 0.0032176], [0.058514, 5.6798e-05, 6.7895e-06, 0.0031323], [0.06085, 4.3927e-05, 5.3636e-06, 0.0032585], [0.063279, 4.6048e-05, 4.5458e-06, 0.0033898], [0.065808, 3.4073e-05, 3.7013e-06, 0.0035266], [0.068438, 4.0143e-05, 3.5649e-06, 0.003669], [0.071175, 2.6662e-05, 2.8241e-06, 0.0038173], [0.074023, 2.4083e-05, 2.3545e-06, 0.0039717], [0.076986, 2.3309e-05, 2.266e-06, 0.0041325], [0.080068, 2.8828e-05, 2.1438e-06, 0.0043001], [0.083276, 1.9108e-05, 1.7976e-06, 0.0044746], [0.086612, 1.8879e-05, 1.6076e-06, 0.0046564], [0.090084, 1.7687e-05, 1.4593e-06, 0.0048458], [0.093695, 1.9856e-05, 1.3628e-06, 0.0050431], [0.097452, 1.5334e-05, 1.2134e-06, 0.0052488], [0.10136, 1.6665e-05, 1.1448e-06, 0.0054631], [0.10543, 1.375e-05, 1.0325e-06, 0.0056866], [0.10966, 1.502e-05, 9.7171e-07, 0.0059195], [0.11406, 1.3664e-05, 8.8592e-07, 0.0061624], [0.11864, 1.3706e-05, 8.2178e-07, 0.0064157], [0.1234, 1.1483e-05, 7.5018e-07, 0.0066799], [0.12836, 1.1903e-05, 6.9697e-07, 0.0069556], [0.13351, 7.5482e-06, 6.225e-07, 0.0072433], [0.13887, 7.5468e-06, 5.8373e-07, 0.0075436], [0.14445, 6.7379e-06, 5.4847e-07, 0.0078571], [0.15025, 6.263e-06, 5.1627e-07, 0.0081845], [0.15629, 4.3803e-06, 4.7069e-07, 0.0085265], [0.16257, 3.0045e-06, 4.4574e-07, 0.008884], [0.1691, 1.5888e-06, 4.1655e-07, 0.0092576], [0.1759, 1.2506e-06, 4.0119e-07, 0.0096483], [0.18297, 1.2114e-06, 3.9518e-07, 0.010057], [0.19032, 5.2251e-07, 3.8281e-07, 0.010485], [0.19797, -2.0168e-07, 3.7798e-07, 0.010933], [0.20593, 2.1403e-07, 3.8461e-07, 0.011402], [0.2142, -2.4472e-07, 3.8796e-07, 0.011893], [0.22282, 3.7336e-07, 4.076e-07, 0.012409], [0.23177, 1.371e-06, 4.2292e-07, 0.012949], [0.24109, 9.7523e-07, 4.4739e-07, 0.013517], [0.25078, 1.7962e-06, 4.7723e-07, 0.014113], [0.26087, 1.5649e-06, 4.6336e-07, 0.014739], [0.27136, 1.8752e-06, 4.7594e-07, 0.015398], [0.28227, 2.1743e-06, 4.729e-07, 0.016091], [0.29362, -2.8282e-07, 4.6128e-07, 0.016821], [0.30542, 1.2489e-06, 4.7552e-07, 0.01759], [0.31771, 1.0352e-06, 4.9121e-07, 0.018401], [0.33048, -6.7397e-07, 5.0658e-07, 0.019257]], "data_range": [0.013, 0.33048], "simulation_range": [0.0063374, 0.33048]}], "layers": [], "domain_contrasts": [], "contrasts": [{"name": "Bilayer / D2O", "data": "Bilayer / D2O", "background": "Background D2O", "background_action": "add", "bulk_in": "Silicon", "bulk_out": "SLD D2O", "scalefactor": "Scalefactor 1", "resolution": "Data Resolution", "resample": false, "model": ["DSPC Model"]}, {"name": "Bilayer / SMW", "data": "Bilayer / SMW", "background": "Background SMW", "background_action": "add", "bulk_in": "Silicon", "bulk_out": "SLD SMW", "scalefactor": "Scalefactor 1", "resolution": "Data Resolution", "resample": false, "model": ["DSPC Model"]}, {"name": "Bilayer / H2O", "data": "Bilayer / H2O", "background": "Background H2O", "background_action": "add", "bulk_in": "Silicon", "bulk_out": "SLD H2O", "scalefactor": "Scalefactor 1", "resolution": "Data Resolution", "resample": false, "model": ["DSPC Model"]}]} diff --git a/examples/DSPC_standard_layers/controls.json b/examples/DSPC_standard_layers/controls.json new file mode 100644 index 0000000..458cb1e --- /dev/null +++ b/examples/DSPC_standard_layers/controls.json @@ -0,0 +1 @@ +{"procedure":"calculate","parallel":"single","calcSldDuringFit":false,"resampleMinAngle":0.9,"resampleNPoints":50,"display":"iter"} \ No newline at end of file diff --git a/examples/DSPC_standard_layers/project.json b/examples/DSPC_standard_layers/project.json new file mode 100644 index 0000000..163f172 --- /dev/null +++ b/examples/DSPC_standard_layers/project.json @@ -0,0 +1 @@ +{"name": "original_dspc_bilayer", "calculation": "non polarised", "model": "standard layers", "geometry": "substrate/liquid", "absorption": false, "parameters": [{"name": "Substrate Roughness", "min": 1.0, "value": 3.0, "max": 10.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Oxide Thickness", "min": 5.0, "value": 19.54, "max": 60.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Oxide SLD", "min": 3.39e-06, "value": 3.39e-06, "max": 3.41e-06, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "SAM Tails Thickness", "min": 15.0, "value": 22.66, "max": 35.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "SAM Tails SLD", "min": -5e-07, "value": -4.01e-07, "max": -3e-07, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "SAM Tails Hydration", "min": 1.0, "value": 5.252, "max": 50.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "SAM Roughness", "min": 1.0, "value": 5.64, "max": 15.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "CW Thickness", "min": 10.0, "value": 17.12, "max": 28.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "CW SLD", "min": 0.0, "value": 0.0, "max": 1e-09, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "SAM Heads Thickness", "min": 5.0, "value": 8.56, "max": 17.0, "fit": true, "prior_type": "gaussian", "mu": 10.0, "sigma": 2.0}, {"name": "SAM Heads SLD", "min": 1e-07, "value": 1.75e-06, "max": 2e-06, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "SAM Heads Hydration", "min": 10.0, "value": 45.45, "max": 50.0, "fit": true, "prior_type": "uniform", "mu": 30.0, "sigma": 3.0}, {"name": "Bilayer Heads Thickness", "min": 7.0, "value": 10.7, "max": 17.0, "fit": true, "prior_type": "gaussian", "mu": 10.0, "sigma": 2.0}, {"name": "Bilayer Heads SLD", "min": 5e-07, "value": 1.47e-06, "max": 1.5e-06, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Bilayer Roughness", "min": 2.0, "value": 6.014, "max": 15.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Bilayer Tails Thickness", "min": 14.0, "value": 17.82, "max": 22.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Bilayer Tails SLD", "min": -5e-07, "value": -4.61e-07, "max": 0.0, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Bilayer Tails Hydration", "min": 10.0, "value": 17.64, "max": 50.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Bilayer Heads Hydration", "min": 10.0, "value": 36.15, "max": 50.0, "fit": true, "prior_type": "gaussian", "mu": 30.0, "sigma": 3.0}, {"name": "CW Hydration", "min": 99.9, "value": 100.0, "max": 100.0, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Oxide Hydration", "min": 0.0, "value": 23.61, "max": 60.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "bulk_in": [{"name": "Silicon", "min": 2e-06, "value": 2.073e-06, "max": 2.1e-06, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "bulk_out": [{"name": "D2O", "min": 5.5e-06, "value": 5.98e-06, "max": 6.4e-06, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "SMW", "min": 1e-06, "value": 2.21e-06, "max": 4.99e-06, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "scalefactors": [{"name": "Scalefactor 1", "min": 0.05, "value": 0.1, "max": 0.2, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Scalefactor 2", "min": 0.05, "value": 0.15, "max": 0.2, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "domain_ratios": [], "background_parameters": [{"name": "Background parameter D2O", "min": 5e-10, "value": 2.23e-06, "max": 7e-06, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Background parameter SMW", "min": 1e-10, "value": 3.38e-06, "max": 4.99e-06, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "backgrounds": [{"name": "D2O Background", "type": "constant", "value_1": "Background parameter D2O", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}, {"name": "SMW Background", "type": "constant", "value_1": "Background parameter SMW", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}], "resolution_parameters": [{"name": "Resolution Param 1", "min": 0.01, "value": 0.03, "max": 0.05, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "resolutions": [{"name": "Resolution 1", "type": "constant", "value_1": "Resolution Param 1", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}], "custom_files": [], "data": [{"name": "Simulation", "data": [], "data_range": [], "simulation_range": [0.005, 0.7]}, {"name": "dspc_bil_D2O", "data": [[0.011403, 0.10063, 0.0019003], [0.011973, 0.11082, 0.001883], [0.012572, 0.10766, 0.0016413], [0.013201, 0.10652, 0.0014669], [0.013861, 0.090118, 0.0011774], [0.014554, 0.034255, 0.00048888], [0.015281, 0.017209, 0.00026267], [0.016045, 0.010465, 0.00017551], [0.016848, 0.0070455, 0.00013083], [0.01769, 0.0045958, 9.7193e-05], [0.018575, 0.0034925, 8.0937e-05], [0.019503, 0.002451, 6.4505e-05], [0.020479, 0.0017544, 5.1254e-05], [0.021502, 0.0013384, 4.2675e-05], [0.022578, 0.0010447, 3.5865e-05], [0.023706, 0.00076523, 2.9299e-05], [0.024892, 0.00064257, 2.6236e-05], [0.026136, 0.00050024, 1.3657e-05], [0.027443, 0.00039982, 1.1639e-05], [0.028815, 0.00034301, 1.0137e-05], [0.030256, 0.00027746, 8.5758e-06], [0.031769, 0.00026396, 8.2806e-06], [0.033357, 0.00023596, 7.8864e-06], [0.035025, 0.0002028, 1.0041e-05], [0.036777, 0.00018591, 4.9391e-06], [0.038615, 0.00015427, 4.3142e-06], [0.040546, 0.00014273, 3.958e-06], [0.042573, 0.00012868, 3.6645e-06], [0.044702, 0.00011002, 3.2644e-06], [0.046937, 9.1148e-05, 2.8227e-06], [0.049284, 9.1217e-05, 2.7234e-06], [0.051748, 7.6323e-05, 2.3706e-06], [0.054336, 6.6691e-05, 2.1365e-06], [0.057052, 6.4594e-05, 2.4647e-06], [0.059905, 6.0971e-05, 1.3241e-06], [0.0629, 6.3097e-05, 1.2946e-06], [0.066045, 6.0729e-05, 1.1791e-06], [0.069348, 5.9985e-05, 1.1102e-06], [0.072815, 6.1021e-05, 1.1013e-06], [0.076456, 5.6755e-05, 1.035e-06], [0.080279, 5.8755e-05, 1.5569e-06], [0.084292, 5.4071e-05, 9.5338e-07], [0.088507, 4.6964e-05, 8.4392e-07], [0.092932, 4.2634e-05, 7.7134e-07], [0.097579, 3.27e-05, 6.528e-07], [0.10246, 2.54e-05, 5.4648e-07], [0.10758, 1.7075e-05, 4.2154e-07], [0.11296, 1.2197e-05, 3.4055e-07], [0.11861, 7.8205e-06, 2.5881e-07], [0.12454, 5.091e-06, 2.0153e-07], [0.13077, 4.1579e-06, 1.762e-07], [0.1373, 3.6345e-06, 1.6248e-07], [0.14417, 3.3455e-06, 1.5143e-07], [0.15138, 2.7295e-06, 1.3191e-07], [0.15895, 1.8245e-06, 1.0679e-07], [0.16689, 1.2171e-06, 8.7591e-08], [0.17524, 4.9313e-07, 5.6663e-08], [0.184, 2.4038e-07, 4.1253e-08], [0.1932, 3.3832e-07, 5.3216e-08], [0.20286, 3.2022e-07, 5.5047e-08], [0.213, 4.1948e-07, 6.8549e-08], [0.22365, 3.1493e-07, 6.3396e-08], [0.23484, 2.3214e-07, 5.5974e-08], [0.24658, 3.3414e-07, 6.8415e-08], [0.25891, 3.9863e-07, 8.2061e-08], [0.27185, 2.5113e-07, 6.271e-08], [0.28544, 2.2469e-07, 6.3286e-08], [0.29972, 2.0862e-07, 6.0631e-08], [0.3147, 2.0861e-07, 6.1379e-08], [0.33044, 3.3381e-07, 7.7193e-08], [0.34696, 1.8378e-07, 6.049e-08], [0.36431, 2.3515e-07, 6.6222e-08], [0.38252, 2.1154e-07, 6.3084e-08], [0.40165, 2.4662e-07, 6.6637e-08], [0.42173, 2.017e-07, 6.2432e-08], [0.44282, 2.4563e-07, 6.9088e-08], [0.46496, 1.9906e-07, 6.0793e-08], [0.48821, 2.8635e-07, 7.3878e-08], [0.51262, 1.9471e-07, 6.1764e-08], [0.53825, 2.8836e-07, 7.5438e-08], [0.56516, 2.3816e-07, 7.061e-08], [0.59342, 2.1782e-07, 6.6918e-08]], "data_range": [0.011403, 0.59342], "simulation_range": [0.011403, 0.59342]}, {"name": "dspc_bil_smw", "data": [[0.011403, 0.0018074, 0.00010983], [0.011973, 0.0014774, 9.0584e-05], [0.012572, 0.001325, 7.7039e-05], [0.013201, 0.0012216, 6.6408e-05], [0.013861, 0.0010077, 5.5778e-05], [0.014554, 0.0010266, 5.1388e-05], [0.015281, 0.00091489, 4.521e-05], [0.016045, 0.00080921, 3.995e-05], [0.016848, 0.00061576, 3.3466e-05], [0.01769, 0.00060308, 3.1557e-05], [0.018575, 0.00046074, 2.6813e-05], [0.019503, 0.00040453, 2.4355e-05], [0.020479, 0.00036496, 2.2031e-05], [0.021502, 0.00032468, 2.0023e-05], [0.022578, 0.0002479, 1.6581e-05], [0.023706, 0.00027709, 1.7017e-05], [0.024892, 0.00021141, 1.4388e-05], [0.026136, 0.00017034, 7.5065e-06], [0.027443, 0.00015127, 6.7139e-06], [0.028815, 0.00013632, 5.9548e-06], [0.030256, 0.00011151, 5.2534e-06], [0.031769, 9.5843e-05, 4.7729e-06], [0.033357, 7.5905e-05, 4.2186e-06], [0.035025, 6.919e-05, 6.2034e-06], [0.036777, 5.272e-05, 2.3936e-06], [0.038615, 3.9182e-05, 1.9828e-06], [0.040546, 2.938e-05, 1.6381e-06], [0.042573, 2.2329e-05, 1.3936e-06], [0.044702, 1.471e-05, 1.0942e-06], [0.046937, 8.1966e-06, 7.7674e-07], [0.049284, 6.4866e-06, 6.6572e-07], [0.051748, 3.0853e-06, 4.3607e-07], [0.054336, 2.6025e-06, 3.888e-07], [0.057052, 2.7294e-06, 4.9982e-07], [0.059905, 4.3615e-06, 3.1992e-07], [0.0629, 5.4926e-06, 3.4522e-07], [0.066045, 7.2943e-06, 3.6968e-07], [0.069348, 8.9112e-06, 3.8947e-07], [0.072815, 1.0612e-05, 4.1912e-07], [0.076456, 1.2411e-05, 4.4241e-07], [0.080279, 1.4576e-05, 7.0225e-07], [0.084292, 1.4768e-05, 4.5606e-07], [0.088507, 1.3957e-05, 4.2438e-07], [0.092932, 1.1624e-05, 3.7299e-07], [0.097579, 1.0598e-05, 3.4827e-07], [0.10246, 7.7689e-06, 2.8497e-07], [0.10758, 6.4311e-06, 2.4647e-07], [0.11296, 4.952e-06, 2.0748e-07], [0.11861, 2.8957e-06, 1.5122e-07], [0.12454, 1.9786e-06, 1.2104e-07], [0.13077, 1.1837e-06, 9.0553e-08], [0.1373, 9.5591e-07, 8.0264e-08], [0.14417, 9.9179e-07, 7.9466e-08], [0.15138, 8.1026e-07, 6.9286e-08], [0.15895, 7.8161e-07, 6.7637e-08], [0.16689, 6.039e-07, 5.9878e-08], [0.17524, 4.8559e-07, 5.489e-08], [0.184, 4.1425e-07, 5.2852e-08], [0.1932, 4.375e-07, 5.9223e-08], [0.20286, 3.0001e-07, 5.1646e-08], [0.213, 4.9488e-07, 7.1141e-08], [0.22365, 2.7977e-07, 5.7809e-08], [0.23484, 2.3853e-07, 5.4901e-08], [0.24658, 2.1767e-07, 5.3744e-08], [0.25891, 2.5677e-07, 6.3708e-08], [0.27185, 5.7975e-07, 9.3465e-08], [0.28544, 3.2659e-07, 7.4563e-08], [0.29972, 3.0527e-07, 7.1553e-08], [0.3147, 3.3603e-07, 7.6342e-08], [0.33044, 3.8583e-07, 8.1122e-08], [0.34696, 2.9402e-07, 7.285e-08], [0.36431, 3.0297e-07, 7.2958e-08], [0.38252, 4.0996e-07, 8.5727e-08], [0.40165, 4.0612e-07, 8.3403e-08], [0.42173, 5.3059e-07, 9.7535e-08], [0.44282, 4.9546e-07, 9.5624e-08], [0.46496, 3.5423e-07, 7.8721e-08], [0.48821, 3.5614e-07, 7.9969e-08], [0.51262, 3.7628e-07, 8.3392e-08], [0.53825, 5.8915e-07, 1.0457e-07], [0.56516, 3.2619e-07, 7.9702e-08], [0.59342, 3.068e-07, 7.7062e-08]], "data_range": [0.011403, 0.59342], "simulation_range": [0.011403, 0.59342]}], "layers": [{"name": "Oxide", "thickness": "Oxide Thickness", "SLD": "Oxide SLD", "roughness": "Substrate Roughness", "hydration": "Oxide Hydration", "hydrate_with": "bulk out"}, {"name": "SAM Tails", "thickness": "SAM Tails Thickness", "SLD": "SAM Tails SLD", "roughness": "SAM Roughness", "hydration": "SAM Tails Hydration", "hydrate_with": "bulk out"}, {"name": "SAM Heads", "thickness": "SAM Heads Thickness", "SLD": "SAM Heads SLD", "roughness": "SAM Roughness", "hydration": "SAM Heads Hydration", "hydrate_with": "bulk out"}, {"name": "Central Water", "thickness": "CW Thickness", "SLD": "CW SLD", "roughness": "Bilayer Roughness", "hydration": "CW Hydration", "hydrate_with": "bulk out"}, {"name": "Bilayer Heads", "thickness": "Bilayer Heads Thickness", "SLD": "Bilayer Heads SLD", "roughness": "Bilayer Roughness", "hydration": "Bilayer Heads Hydration", "hydrate_with": "bulk out"}, {"name": "Bilayer Tails", "thickness": "Bilayer Tails Thickness", "SLD": "Bilayer Tails SLD", "roughness": "Bilayer Roughness", "hydration": "Bilayer Tails Hydration", "hydrate_with": "bulk out"}], "domain_contrasts": [], "contrasts": [{"name": "D2O", "data": "dspc_bil_D2O", "background": "D2O Background", "background_action": "add", "bulk_in": "Silicon", "bulk_out": "D2O", "scalefactor": "Scalefactor 1", "resolution": "Resolution 1", "resample": false, "model": ["Oxide", "SAM Tails", "SAM Heads", "Central Water", "Bilayer Heads", "Bilayer Tails", "Bilayer Tails", "Bilayer Heads"]}, {"name": "SMW", "data": "dspc_bil_smw", "background": "SMW Background", "background_action": "add", "bulk_in": "Silicon", "bulk_out": "SMW", "scalefactor": "Scalefactor 2", "resolution": "Resolution 1", "resample": false, "model": ["Oxide", "SAM Tails", "SAM Heads", "Central Water", "Bilayer Heads", "Bilayer Tails", "Bilayer Tails", "Bilayer Heads"]}]} \ No newline at end of file diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..6d6cbc8 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,9 @@ +# Examples + +This directory contains example projects which correspond to the examples in RATapi. +They can all be loaded with the RasCAL-2 project load dialog. + +To (re-)create the examples, run `make_examples.py` in this directory. + +The one exceptional project is the folder `rascal1_example`, which contains a .mat +file for a RasCAL-1 project. This can be loaded using the import RasCAL-1 project dialog. diff --git a/examples/absorption/controls.json b/examples/absorption/controls.json new file mode 100644 index 0000000..c049228 --- /dev/null +++ b/examples/absorption/controls.json @@ -0,0 +1 @@ +{"procedure":"calculate","parallel":"contrasts","calcSldDuringFit":false,"resampleMinAngle":0.9,"resampleNPoints":150,"display":"iter"} diff --git a/examples/absorption/project.json b/examples/absorption/project.json new file mode 100644 index 0000000..29e3332 --- /dev/null +++ b/examples/absorption/project.json @@ -0,0 +1 @@ +{"name": "Absorption example", "calculation": "non polarised", "model": "custom layers", "geometry": "substrate/liquid", "absorption": true, "parameters": [{"name": "Substrate Roughness", "min": 1.0, "value": 3.0, "max": 5.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Alloy Thickness", "min": 100.0, "value": 135.6, "max": 200.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Alloy SLD up", "min": 6e-06, "value": 9.87e-06, "max": 1.2e-05, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Alloy SLD imaginary up", "min": 1e-09, "value": 4.87e-08, "max": 1e-07, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Alloy SLD down", "min": 6e-06, "value": 7.05e-06, "max": 1.3e-05, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Alloy SLD imaginary down", "min": 1e-09, "value": 4.87e-08, "max": 1e-07, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Alloy Roughness", "min": 2.0, "value": 5.71, "max": 10.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Gold Thickness", "min": 100.0, "value": 154.7, "max": 200.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Gold Roughness", "min": 0.1, "value": 5.42, "max": 10.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Gold SLD", "min": 4e-06, "value": 4.49e-06, "max": 5e-06, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Gold SLD imaginary", "min": 1e-09, "value": 4.2e-08, "max": 1e-07, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Thiol APM", "min": 40.0, "value": 56.27, "max": 100.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Thiol Head Hydration", "min": 20.0, "value": 30.0, "max": 50.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Thiol Coverage", "min": 0.5, "value": 0.9, "max": 1.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "CW Thickness", "min": 1.0, "value": 12.87, "max": 25.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Bilayer APM", "min": 48.0, "value": 65.86, "max": 90.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Bilayer Head Hydration", "min": 20.0, "value": 30.0, "max": 50.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Bilayer Roughness", "min": 1.0, "value": 3.87, "max": 10.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Bilayer Coverage", "min": 0.5, "value": 0.94, "max": 1.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "bulk_in": [{"name": "Silicon", "min": 2e-06, "value": 2.073e-06, "max": 2.1e-06, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "bulk_out": [{"name": "D2O", "min": 5.8e-06, "value": 6.21e-06, "max": 6.35e-06, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "H2O", "min": -5.6e-07, "value": -3.15e-07, "max": 0.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "scalefactors": [{"name": "Scalefactor 1", "min": 0.5, "value": 1.0, "max": 1.5, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Scalefactor 2", "min": 0.5, "value": 1.0, "max": 1.5, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Scalefactor 3", "min": 0.5, "value": 1.0, "max": 1.5, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Scalefactor 4", "min": 0.5, "value": 1.0, "max": 1.5, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "domain_ratios": [], "background_parameters": [{"name": "Background parameter 1", "min": 5e-08, "value": 7.88e-06, "max": 9e-05, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Background parameter 2", "min": 1e-08, "value": 5.46e-06, "max": 9e-05, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Background parameter 3", "min": 1e-06, "value": 9.01e-06, "max": 9e-05, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Background parameter 4", "min": 1e-06, "value": 5.61e-06, "max": 9e-05, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "backgrounds": [{"name": "Background 1", "type": "constant", "value_1": "Background parameter 1", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}, {"name": "Background 2", "type": "constant", "value_1": "Background parameter 2", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}, {"name": "Background 3", "type": "constant", "value_1": "Background parameter 3", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}, {"name": "Background 4", "type": "constant", "value_1": "Background parameter 4", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}], "resolution_parameters": [{"name": "Resolution Param 1", "min": 0.01, "value": 0.03, "max": 0.05, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "resolutions": [{"name": "Resolution 1", "type": "constant", "value_1": "Resolution Param 1", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}], "custom_files": [{"name": "DPPC absorption", "filename": "volume_thiol_bilayer.py", "language": "python", "path": "./examples/absorption"}], "data": [{"name": "Simulation", "data": [], "data_range": [], "simulation_range": [0.005, 0.7]}, {"name": "D2O_dn", "data": [[0.01218, 1.015359223955, 0.0231718818417596], [0.012545, 0.919431439253596, 0.0193509380578665], [0.012922, 0.924921688167335, 0.0183337262959345], [0.013309, 0.892889622419078, 0.01658695139614], [0.013709, 0.88564788305433, 0.0151834012597258], [0.01412, 0.954057058169692, 0.0152655865808885], [0.014544, 0.801205833810502, 0.0128764862406952], [0.01498, 0.57206372730641, 0.00977028529084846], [0.015429, 0.507292263127758, 0.00840850146518913], [0.015892, 0.441240863619522, 0.0072616120448651], [0.016369, 0.411263430900333, 0.00703930748762168], [0.01686, 0.398699855165213, 0.00667722051938428], [0.017366, 0.369396072619489, 0.00590757519620061], [0.017887, 0.333584829398094, 0.00529590083869447], [0.018423, 0.300131361783826, 0.00480817811310586], [0.018976, 0.254862070126983, 0.00436222169827209], [0.019545, 0.218629795547172, 0.0038320590117552], [0.020132, 0.183303580450672, 0.00337229276836539], [0.020736, 0.158391997035939, 0.00306386203644447], [0.021358, 0.128249520024251, 0.00266512849877059], [0.021998, 0.0956717976354879, 0.0021819192293442], [0.022658, 0.0688201017211762, 0.00176311091650106], [0.023338, 0.0481760921553437, 0.00145639799252248], [0.024038, 0.0328252888275119, 0.00118309811714777], [0.024759, 0.0183323789955876, 0.000868570851156994], [0.025502, 0.0106467041665263, 0.000644514803462562], [0.026267, 0.00788878035636094, 0.000551382666981037], [0.027055, 0.0069025565024083, 0.0005165549530129], [0.027867, 0.00807841288019132, 0.000666341069082825], [0.028703, 0.0104166526322881, 0.000419481963016605], [0.029564, 0.0134376368351915, 0.000465997507494358], [0.030451, 0.0158250530499512, 0.000492135134224797], [0.031365, 0.018520664219071, 0.000528646973626596], [0.032305, 0.0188403112263801, 0.000530903701707703], [0.033275, 0.0189720098352925, 0.000529859543938832], [0.034273, 0.0167957829499141, 0.000677826804540402], [0.035301, 0.0143561588467109, 0.000448314190440904], [0.03636, 0.0120825895112668, 0.000385361581730607], [0.037451, 0.00911010812085284, 0.000338273434605409], [0.038574, 0.0064407693084981, 0.000272228771598909], [0.039732, 0.00380747078042373, 0.000191909461416686], [0.040924, 0.00219977095894102, 0.000139024554548823], [0.042151, 0.00106749974738118, 9.30715079659133e-05], [0.043416, 0.000526289198019469, 6.53777493347705e-05], [0.044718, 0.000538684361211223, 6.36026811276904e-05], [0.04606, 0.000666071609013439, 6.89514635050019e-05], [0.047442, 0.00096513860352319, 8.1892283337263e-05], [0.048865, 0.00123628279834282, 9.06632085957762e-05], [0.050331, 0.000932500252618815, 7.56441779783758e-05], [0.051841, 0.000704570716426959, 6.33837448213143e-05], [0.053396, 0.000422547071305871, 4.87823773114622e-05], [0.054998, 0.000225234935497996, 3.52790595843578e-05], [0.056648, 0.000224295193506012, 3.47502441981879e-05], [0.058347, 0.000348546599750749, 4.2399541917882e-05], [0.060098, 0.000753444036511839, 6.21105459934656e-05], [0.061901, 0.00108427363670046, 0.000132874128465088], [0.063758, 0.00147590016504429, 6.80656135268955e-05], [0.06567, 0.00157522988312169, 6.65397958839974e-05], [0.06764, 0.00123685540099027, 5.63878877698811e-05], [0.06967, 0.000809188588366061, 4.4090403853279e-05], [0.07176, 0.000394860049176463, 3.01087945030146e-05], [0.073913, 0.000158546936575836, 1.87827141365489e-05], [0.07613, 0.000205156792077874, 2.11738354272626e-05], [0.078414, 0.000432213951295092, 3.08747347502442e-05], [0.080766, 0.000654956381151268, 3.77210414631682e-05], [0.083189, 0.000798309138064603, 4.33157061537943e-05], [0.085685, 0.000842635319478595, 5.73848900266092e-05], [0.088255, 0.000695947994206608, 4.00080838020816e-05], [0.090903, 0.000486577520293712, 3.1324396241032e-05], [0.09363, 0.000518575903533295, 3.11105123109569e-05], [0.096439, 0.000572434234901815, 3.26076998214827e-05], [0.099332, 0.000634309003334568, 3.34605409410893e-05], [0.10231, 0.000482232476674863, 2.81521775741857e-05], [0.10538, 0.000365623631648085, 2.39677995217084e-05], [0.10854, 0.000216433695981677, 1.81376940954562e-05], [0.1118, 0.00016573141567584, 1.53181312944188e-05], [0.11515, 0.000215844252079895, 1.6793425174307e-05], [0.11861, 0.000301364141601267, 1.9534170905049e-05], [0.12217, 0.000246353868436121, 1.75755330256998e-05], [0.12583, 0.000162551786857085, 1.40661524470343e-05], [0.12961, 7.50985213378692e-05, 9.36878978746337e-06], [0.13349, 6.5539425376402e-05, 8.69884468995251e-06], [0.1375, 4.34100171780794e-05, 7.01707703189734e-06], [0.14162, 4.008555357203e-05, 6.73885951025632e-06], [0.14587, 3.09498467445855e-05, 5.80450671966048e-06], [0.15025, 9.04307992859308e-06, 3.1003401933376e-06], [0.15476, 1.20906733133484e-05, 3.56933544410388e-06], [0.1594, 1.50092626898851e-05, 4.01428138367746e-06], [0.16418, 2.38057866549901e-05, 5.21304186735828e-06], [0.16911, 2.45653272255718e-05, 5.35080332783186e-06], [0.17418, 1.01465189127286e-05, 3.58853447404763e-06], [0.17941, 9.15355855704133e-06, 3.55249418976725e-06], [0.18479, 4.82434571726902e-06, 2.64124760012126e-06], [0.19033, 1.52628919801947e-06, 1.52659234059753e-06], [0.19604, 3.69800262723568e-06, 2.61612044865102e-06], [0.20192, 1.54286099228671e-06, 1.90198389976085e-06], [0.20798, 1.2093704739129e-05, 5.23729327360302e-06], [0.21422, 2.37360638620364e-06, 2.37431371888578e-06], [0.22065, 5.71086934554886e-06, 4.04257469096298e-06], [0.22727, 3.01060999023207e-06, 3.01168783050962e-06]], "data_range": [0.01218, 0.22727], "simulation_range": [0.01218, 0.22727]}, {"name": "D2O_up", "data": [[0.01218, 0.992633447203191, 0.0219469837210634], [0.012545, 0.990954025840188, 0.0202675623580603], [0.012922, 0.970629210481116, 0.0186524551995267], [0.013309, 0.905284451993359, 0.0164253134601805], [0.013709, 0.849691788011222, 0.0143674497604916], [0.01412, 0.923719918319052, 0.0144663066089047], [0.014544, 0.836695356781618, 0.012738792725052], [0.01498, 0.690394854863642, 0.0107616557567893], [0.015429, 0.647588694440734, 0.00960800778640814], [0.015892, 0.645336743067616, 0.00911143342430199], [0.016369, 0.610183400446573, 0.00884272600622149], [0.01686, 0.591499837783164, 0.00840359548846352], [0.017366, 0.570029962403863, 0.00761083226779137], [0.017887, 0.536078932804061, 0.00690967384873757], [0.018423, 0.512433443386324, 0.00652970476535812], [0.018976, 0.471688390999828, 0.006198019046165], [0.019545, 0.440256493444531, 0.00566003167999389], [0.020132, 0.404511536479704, 0.00527032958644249], [0.020736, 0.349147884501613, 0.0046943643962671], [0.021358, 0.312582301188954, 0.00428099772896429], [0.021998, 0.259890455924731, 0.00367278001488578], [0.022658, 0.218038512185347, 0.00320883986335617], [0.023338, 0.177852630775396, 0.00283478692341457], [0.024038, 0.13474112101376, 0.00240080917574763], [0.024759, 0.106736769785683, 0.00208190996011374], [0.025502, 0.0800339701139335, 0.00173986144773755], [0.026267, 0.0629630336456803, 0.00151831141815684], [0.027055, 0.0486268821924083, 0.00133304070688372], [0.027867, 0.0438443481745835, 0.00145884463443959], [0.028703, 0.0414683486326075, 0.000859081280177103], [0.029564, 0.0396858718677837, 0.000810072711311285], [0.030451, 0.0431706711960152, 0.000821790492184965], [0.031365, 0.0430351724269547, 0.000802038206836008], [0.032305, 0.0459130899444646, 0.000825282925246665], [0.033275, 0.0442355770148285, 0.000801618351495258], [0.034273, 0.0424817267505105, 0.0010891810912422], [0.035301, 0.0378423252352144, 0.000770091032271608], [0.03636, 0.0340178247676482, 0.000687723048149774], [0.037451, 0.0269470791427317, 0.000604820702685166], [0.038574, 0.0201473310559362, 0.00049903624114964], [0.039732, 0.0148899788163896, 0.000390637225901258], [0.040924, 0.00926448978033932, 0.000286551270062406], [0.042151, 0.00525296284280234, 0.00020761846600126], [0.043416, 0.00224450848298632, 0.00013476020534743], [0.044718, 0.000825225672245654, 7.76465199717552e-05], [0.04606, 0.00042697379720987, 5.50773869730338e-05], [0.047442, 0.000539342353861715, 6.0461077501479e-05], [0.048865, 0.000610355159449608, 6.25775301055364e-05], [0.050331, 0.000652340693524686, 6.20679783965343e-05], [0.051841, 0.000645756598408367, 6.00030534933873e-05], [0.053396, 0.00044294738449207, 4.94608675738087e-05], [0.054998, 0.000240195423576786, 3.60025954693792e-05], [0.056648, 0.000272715128151301, 3.79568312372374e-05], [0.058347, 0.000626595927403195, 5.63579457623237e-05], [0.060098, 0.00105784461535525, 7.26731426172255e-05], [0.061901, 0.00191091433042615, 0.000145273764766503], [0.063758, 0.00242199278612187, 7.67476478558751e-05], [0.06567, 0.00245310025000477, 7.36216340006489e-05], [0.06764, 0.00208229164678715, 6.49897898814863e-05], [0.06967, 0.00148174583484418, 5.32605584076032e-05], [0.07176, 0.000760739708773068, 3.778698066757e-05], [0.073913, 0.000348289089486441, 2.5634076986202e-05], [0.07613, 0.00026177980495811, 2.18076680852688e-05], [0.078414, 0.000482070268516575, 2.89681100784366e-05], [0.080766, 0.000822000419855341, 3.91591442584782e-05], [0.083189, 0.00107937174373557, 4.62298898833947e-05], [0.085685, 0.00121868737953014, 5.89152464741694e-05], [0.088255, 0.00093064753144144, 3.58632798335846e-05], [0.090903, 0.000683219145403538, 2.85902402717609e-05], [0.09363, 0.000617206435237314, 2.6059657627054e-05], [0.096439, 0.000679364110002099, 2.74680814519361e-05], [0.099332, 0.000679421363003111, 2.6527223801981e-05], [0.10231, 0.000618313326590202, 2.4697036202981e-05], [0.10538, 0.000397373995686941, 1.91950228057787e-05], [0.10854, 0.000221130174239966, 1.40565659649993e-05], [0.1118, 0.000169302849291017, 1.18072863985954e-05], [0.11515, 0.000282123704650852, 1.46924559629001e-05], [0.11861, 0.000364777953777744, 1.65755071661673e-05], [0.12217, 0.000370522338212561, 1.66440199240444e-05], [0.12583, 0.000266913490715472, 1.3984999713735e-05], [0.12961, 0.000126966163476402, 9.38891963587091e-06], [0.13349, 5.18254165155824e-05, 5.89228802076375e-06], [0.1375, 5.09036431992977e-05, 5.82740128628409e-06], [0.14162, 4.02125994770893e-05, 5.18807610832268e-06], [0.14587, 2.1658810282639e-05, 3.67926868833375e-06], [0.15025, 1.67732208629936e-05, 3.19147311971603e-06], [0.15476, 2.08839863356171e-05, 3.584037863318e-06], [0.1594, 3.48040993148724e-05, 4.68959331284948e-06], [0.16418, 3.53556365579496e-05, 4.88158170957461e-06], [0.16911, 3.13460180537797e-05, 4.67241741254604e-06], [0.17418, 1.44691692589553e-05, 3.24471841065669e-06], [0.17941, 5.15238840435886e-06, 2.00729021546213e-06], [0.18479, 6.53466669211245e-06, 2.35882364167255e-06], [0.19033, 4.82146605851257e-06, 2.15881982480582e-06], [0.19604, 8.58737762171034e-06, 3.03975266703563e-06], [0.20192, 6.21767590984561e-06, 2.78402259585107e-06], [0.20798, 1.10605164220691e-05, 3.85923395484647e-06], [0.21422, 3.31304032519705e-06, 2.17542319509914e-06], [0.22065, 3.88347105860799e-06, 2.50004771083418e-06], [0.23408, 9.81030172331533e-06, 4.33519723658848e-06], [0.23877, 1.4051604038245e-05, 9.12402908452451e-06]], "data_range": [0.01218, 0.23877], "simulation_range": [0.01218, 0.23877]}, {"name": "H2O_dn", "data": [[0.01218, 0.671793398788385, 0.0176660747858784], [0.012545, 0.644505953624399, 0.0154311155212033], [0.012922, 0.620221433047838, 0.0142020054313766], [0.013309, 0.586849801545853, 0.0126900981825778], [0.013709, 0.536818466680593, 0.0110429287654063], [0.01412, 0.514074576979319, 0.0102055044913307], [0.014544, 0.49879883016503, 0.00955530603718404], [0.01498, 0.458977438897013, 0.00867427407562148], [0.015429, 0.412915186964696, 0.007567108836432], [0.015892, 0.368054104867349, 0.00665656987674953], [0.016369, 0.32760601629413, 0.00629439105911845], [0.01686, 0.288515771882181, 0.0056298307917276], [0.017366, 0.252874973887612, 0.00483444746187591], [0.017887, 0.220398997284312, 0.00426415291414247], [0.018423, 0.18478431167746, 0.00373067683308962], [0.018976, 0.149527365782327, 0.00331705661165657], [0.019545, 0.117427407562147, 0.00279115312304157], [0.020132, 0.0955112805514936, 0.00243545017756424], [0.020736, 0.0731642991435137, 0.00208220179653228], [0.021358, 0.0571626279506998, 0.00178966471694172], [0.021998, 0.0435293503237936, 0.00149031230415709], [0.022658, 0.0324838103196156, 0.00123566429914351], [0.023338, 0.0236706183413411, 0.0010463494881972], [0.024038, 0.0180465322749112, 0.000903331940672655], [0.024759, 0.0156246083141842, 0.000830008355964069], [0.025502, 0.0135426676415291, 0.000754230206810111], [0.026267, 0.0129645393774807, 0.000735481512429497], [0.027055, 0.0130843952371005, 0.000739685606851891], [0.027867, 0.0139662105702945, 0.000870247545435555], [0.028703, 0.0154924796323376, 0.000508303739293921], [0.029564, 0.016434092333403, 0.000510209943597243], [0.030451, 0.016574576979319, 0.000502245665343639], [0.031365, 0.0161698349697096, 0.000487857739711719], [0.032305, 0.0150783371631502, 0.00047122414873616], [0.033275, 0.0149590035512847, 0.000470022978901191], [0.034273, 0.0125342072279089, 0.000605833507415918], [0.035301, 0.0114445372884897, 0.000364137246709839], [0.03636, 0.00940986003760184, 0.000309040108627533], [0.037451, 0.00774284520576562, 0.000284572801336954], [0.038574, 0.00572905786505118, 0.000233447357426363], [0.039732, 0.00428687069145603, 0.000186630457489033], [0.040924, 0.00302094213494882, 0.000149059954042198], [0.042151, 0.0018035303948193, 0.000111035095049091], [0.043416, 0.000843847921453938, 7.5799039064132e-05], [0.044718, 0.000547733444746188, 5.85753081261751e-05], [0.04606, 0.000229230206810111, 3.67949655316482e-05], [0.047442, 0.000348182577814915, 4.46782953833299e-05], [0.048865, 0.000422994568623355, 4.81407979945686e-05], [0.050331, 0.000684457906831001, 5.89957175684145e-05], [0.051841, 0.000815750992270733, 6.20247545435555e-05], [0.053396, 0.000878342385627742, 6.42599749321078e-05], [0.054998, 0.00101070607896386, 6.82891163567997e-05], [0.056648, 0.000820790683100063, 6.08157509922707e-05], [0.058347, 0.000605781282640485, 5.08956548986839e-05], [0.060098, 0.000380692500522248, 4.03436390223522e-05], [0.061901, 0.000300318571130144, 5.40526425736369e-05], [0.063758, 0.000191644035930645, 2.21320764570712e-05], [0.06567, 0.00010858314184249, 1.54277209108001e-05], [0.06764, 0.000199717986212659, 2.00757259243785e-05], [0.06967, 0.000334499686651347, 2.51444015040735e-05], [0.07176, 0.000430123250470023, 2.81439314810946e-05], [0.073913, 0.000419103822853562, 2.74728431167746e-05], [0.07613, 0.000410068936703572, 2.69088155420932e-05], [0.078414, 0.000315045957802381, 2.39680384374347e-05], [0.080766, 0.000239265197409651, 2.10841863379987e-05], [0.083189, 0.000125002611238772, 1.58859933152287e-05], [0.085685, 5.68936703572175e-05, 1.23999895550449e-05], [0.088255, 2.96323375809484e-05, 7.13938792563192e-06], [0.090903, 3.24655316482139e-05, 7.07019009818258e-06], [0.09363, 4.33335074159181e-05, 7.85956757885941e-06], [0.096439, 7.03389387925632e-05, 9.97101524963443e-06], [0.099332, 5.94239607269689e-05, 8.93043659912262e-06], [0.10231, 5.06214748276582e-05, 7.99274075621475e-06], [0.10538, 2.5376018383121e-05, 5.52825360350951e-06], [0.10854, 1.72558491748485e-05, 4.54198871944851e-06], [0.1118, 3.16560476289952e-05, 5.8959160225611e-06], [0.11515, 5.1558909546689e-05, 7.19579068310006e-06], [0.11861, 6.05467933987884e-05, 7.6853979527888e-06], [0.12217, 5.03655734280343e-05, 6.95607896386046e-06], [0.12583, 2.71856068518905e-05, 5.05091915604763e-06], [0.12961, 1.50430854397326e-05, 3.69124712763735e-06], [0.13349, 6.32389805723835e-06, 2.39147691664926e-06], [0.1375, 1.05776060162941e-05, 3.05541048673491e-06], [0.14162, 7.04016085230834e-06, 2.49015562983079e-06], [0.14587, 6.21030917067057e-06, 2.28875078337163e-06], [0.15025, 3.75626697305202e-06, 1.74626592855651e-06], [0.15476, 5.59327344892417e-06, 2.1459160225611e-06], [0.1594, 6.88870900355128e-06, 2.40646542719866e-06], [0.16418, 1.41638813453102e-05, 3.54345101316064e-06], [0.16911, 5.95571339043242e-06, 2.34755588050971e-06], [0.17418, 7.29318988928348e-06, 2.65458533528306e-06], [0.17941, 6.28211823689158e-06, 2.56590766659703e-06], [0.18479, 7.84155003133487e-06, 2.96741174012952e-06], [0.19033, 9.05603718404011e-06, 3.42620639231251e-06], [0.19604, 2.86087319824525e-06, 2.02389283476081e-06], [0.20192, 1.33115730102361e-05, 4.71903070816795e-06], [0.20798, 1.44652182995613e-05, 5.1190724879883e-06], [0.21422, 6.84849592646752e-06, 3.62048255692501e-06], [0.22065, 2.94234384792145e-06, 2.47461875913934e-06], [0.22727, 6.87434719030708e-06, 3.97273866722373e-06], [0.23408, 7.563975349906e-06, 4.37774180071026e-06], [0.23877, 7.5399519532066e-06, 7.54282431585544e-06]], "data_range": [0.01218, 0.23877], "simulation_range": [0.01218, 0.23877]}, {"name": "H2O_up", "data": [[0.01218, 0.855928694401465, 0.0193592956610805], [0.012545, 0.8480615424848, 0.0177581885937194], [0.012922, 0.822193649617539, 0.0162403295050886], [0.013309, 0.814958484973958, 0.0149567415607906], [0.013709, 0.752282781615708, 0.0129300237540044], [0.01412, 0.745309128947196, 0.0121387321027742], [0.014544, 0.701287946477216, 0.0109987578181184], [0.01498, 0.685989495935668, 0.0105023209187787], [0.015429, 0.663826356048554, 0.0095911696123085], [0.015892, 0.634929282803408, 0.00883845097740101], [0.016369, 0.581929522522719, 0.0083860352605313], [0.01686, 0.549828927582976, 0.00784710266524288], [0.017366, 0.511953276527121, 0.00692113234685205], [0.017887, 0.458604833613006, 0.0060923573125286], [0.018423, 0.425000544816615, 0.00564299256870138], [0.018976, 0.361627476191514, 0.00509447120099375], [0.019545, 0.331771525704448, 0.0046117636803452], [0.020132, 0.28454682153987, 0.00412339006690348], [0.020736, 0.245298232614902, 0.00368339616884957], [0.021358, 0.21799202388476, 0.00335367315361649], [0.021998, 0.178721642295203, 0.00286595332011245], [0.022658, 0.149338592629721, 0.00250833569420533], [0.023338, 0.127615664567307, 0.00228234576241637], [0.024038, 0.104480571839519, 0.00202525769825877], [0.024759, 0.0884542463006952, 0.00182302177087192], [0.025502, 0.0770697583193497, 0.00165401965698346], [0.026267, 0.0712184278771765, 0.00157201386013468], [0.027055, 0.060003922679626, 0.00144417808965502], [0.027867, 0.0580752718634907, 0.00167524571229324], [0.028703, 0.0526031337851679, 0.000996905441628348], [0.029564, 0.0511931483862532, 0.000941094427615665], [0.030451, 0.0478218231743195, 0.000873384618737333], [0.031365, 0.0436899339682263, 0.000805195371238041], [0.032305, 0.0430317954976355, 0.000791531370540676], [0.033275, 0.0401333711072853, 0.000757164338483666], [0.034273, 0.0359578965720139, 0.00101277050144921], [0.035301, 0.0322945496545863, 0.000726785364046462], [0.03636, 0.0284525028875281, 0.000643450214657746], [0.037451, 0.0234532656307887, 0.000581559047224704], [0.038574, 0.0184121864580382, 0.000493015450999194], [0.039732, 0.0146165580665548, 0.00040261947828361], [0.040924, 0.0101087453962996, 0.000313269553468303], [0.042151, 0.00730795214330856, 0.000257414954126441], [0.043416, 0.0042269052237017, 0.000194231481683265], [0.044718, 0.00221260923573125, 0.000133410334081548], [0.04606, 0.00111497809837209, 9.29980168675224e-05], [0.047442, 0.00048536622572842, 5.98666288927147e-05], [0.048865, 0.000298167236908057, 4.57384444396016e-05], [0.050331, 0.000510253448689171, 5.73539346655916e-05], [0.051841, 0.000786301131039292, 6.93878440516922e-05], [0.053396, 0.00112199533636978, 8.28317388367076e-05], [0.054998, 0.00139612526423606, 9.13984352866825e-05], [0.056648, 0.00127421709852464, 8.6257545710114e-05], [0.058347, 0.001081569943557, 7.75491969403099e-05], [0.060098, 0.000916011070673611, 7.0819622115196e-05], [0.061901, 0.000690260858195132, 8.21409113692331e-05], [0.063758, 0.000484995750430405, 3.52845032362107e-05], [0.06567, 0.000463508183145553, 3.30006319872731e-05], [0.06764, 0.000508226730882385, 3.31531806393968e-05], [0.06967, 0.000711508706169503, 3.80434545731907e-05], [0.07176, 0.000932399154444614, 4.34458561248284e-05], [0.073913, 0.00109495063961471, 4.75145466036132e-05], [0.07613, 0.00105653017194412, 4.63878658443568e-05], [0.078414, 0.000904134068472552, 4.30034650336697e-05], [0.080766, 0.000647917710898512, 3.65136095190359e-05], [0.083189, 0.000387538954387953, 2.99147906814566e-05], [0.085685, 0.000218624011157844, 2.59812147231242e-05], [0.088255, 8.9402227210321e-05, 1.16902390655305e-05], [0.090903, 5.22304792206943e-05, 8.29603155577833e-06], [0.09363, 4.09222655654107e-05, 7.03903066227908e-06], [0.096439, 5.00490334953255e-05, 7.83119402009284e-06], [0.099332, 5.55451435046963e-05, 7.99311351798984e-06], [0.10231, 4.74927539390241e-05, 7.19964260030074e-06], [0.10538, 4.42957700438033e-05, 6.77882624708523e-06], [0.10854, 4.78632292370388e-05, 6.96471767603025e-06], [0.1118, 7.88981628783751e-05, 8.58500228822978e-06], [0.11515, 0.000108653867108331, 9.69098001612657e-06], [0.11861, 0.000136979972541243, 1.07788698324144e-05], [0.12217, 0.00010743783642426, 9.50356310066032e-06], [0.12583, 6.88822542332251e-05, 7.53546756161876e-06], [0.12961, 4.55946128533136e-05, 5.99537995510711e-06], [0.13349, 1.58101423060998e-05, 3.45871379693595e-06], [0.1375, 1.3898489768344e-05, 3.23424935166823e-06], [0.14162, 1.1293394643363e-05, 2.92087083487698e-06], [0.14587, 6.01848017957156e-06, 2.08115588292981e-06], [0.15025, 7.7183080175213e-06, 2.31285549284111e-06], [0.15476, 1.47192015167695e-05, 3.22378887266546e-06], [0.1594, 2.20694314293809e-05, 3.99241615272299e-06], [0.16418, 2.05467779545405e-05, 3.96735458844553e-06], [0.16911, 2.17689105846972e-05, 4.15891211018371e-06], [0.17418, 1.75060474644235e-05, 3.81742105607253e-06], [0.17941, 7.62743260618476e-06, 2.60291585852202e-06], [0.18479, 7.16346677708283e-06, 2.65042386732626e-06], [0.19033, 5.7271122540153e-06, 2.47107023775797e-06], [0.19604, 1.11545753699305e-05, 3.73940331684355e-06], [0.20192, 1.2624926449757e-05, 4.29206529082311e-06], [0.20798, 1.85283413602981e-05, 5.37581450083902e-06], [0.21422, 1.67341512846776e-05, 5.21476670952557e-06], [0.22065, 4.2125220650729e-06, 2.7123150347593e-06], [0.22727, 8.98729487654456e-06, 4.22232876413799e-06], [0.23408, 1.18595680693878e-05, 5.00817224922091e-06], [0.23877, 1.68956349292828e-05, 1.04944755595267e-05]], "data_range": [0.01218, 0.23877], "simulation_range": [0.01218, 0.23877]}], "layers": [], "domain_contrasts": [], "contrasts": [{"name": "D2O Down", "data": "D2O_dn", "background": "Background 1", "background_action": "add", "bulk_in": "Silicon", "bulk_out": "D2O", "scalefactor": "Scalefactor 1", "resolution": "Resolution 1", "resample": true, "model": ["DPPC absorption"]}, {"name": "D2O Up", "data": "D2O_up", "background": "Background 2", "background_action": "add", "bulk_in": "Silicon", "bulk_out": "D2O", "scalefactor": "Scalefactor 2", "resolution": "Resolution 1", "resample": true, "model": ["DPPC absorption"]}, {"name": "H2O Down", "data": "H2O_dn", "background": "Background 3", "background_action": "add", "bulk_in": "Silicon", "bulk_out": "H2O", "scalefactor": "Scalefactor 3", "resolution": "Resolution 1", "resample": true, "model": ["DPPC absorption"]}, {"name": "H2O Up", "data": "H2O_up", "background": "Background 4", "background_action": "add", "bulk_in": "Silicon", "bulk_out": "H2O", "scalefactor": "Scalefactor 4", "resolution": "Resolution 1", "resample": true, "model": ["DPPC absorption"]}]} diff --git a/examples/absorption/volume_thiol_bilayer.py b/examples/absorption/volume_thiol_bilayer.py new file mode 100644 index 0000000..f5ac1bb --- /dev/null +++ b/examples/absorption/volume_thiol_bilayer.py @@ -0,0 +1,138 @@ +def volume_thiol_bilayer(params, bulk_in, bulk_out, contrast): + """VolumeThiolBilayer RAT Custom Layer Model File. + + This file accepts 3 vectors containing the values for params, bulk in and bulk out. + The final parameter is an index of the contrast being calculated + + The function should output a matrix of layer values, in the form... + + Output = [thick 1, SLD 1, Rough 1, Percent Hydration 1, Hydrate how 1 + .... + thick n, SLD n, Rough n, Percent Hydration n, Hydration how n] + + The "hydrate how" parameter decides if the layer is hydrated with Bulk out or Bulk in phases. + Set to 1 for Bulk out, zero for Bulk in. + Alternatively, leave out hydration and just return... + + Output = [thick 1, SLD 1, Rough 1, + .... + thick n, SLD n, Rough n] + + The second output parameter should be the substrate roughness. + """ + subRough = params[0] + alloyThick = params[1] + alloySLDUp = params[2] + alloyISLDUp = params[3] + alloySLDDown = params[4] + alloyISLDDown = params[5] + alloyRough = params[6] + goldThick = params[7] + goldRough = params[8] + goldSLD = params[9] + goldISLD = params[10] + thiolAPM = params[11] + thiolHeadHydr = params[12] + thiolCoverage = params[13] + cwThick = params[14] + bilayerAPM = params[15] + bilHeadHydr = params[16] + bilayerRough = params[17] + bilayerCoverage = params[18] + + # Make the metal layers + gold = [goldThick, goldSLD, goldISLD, goldRough] + alloyUp = [alloyThick, alloySLDUp, alloyISLDUp, alloyRough] + alloyDown = [alloyThick, alloySLDDown, alloyISLDDown, alloyRough] + + # Neutron b's.. + # define all the neutron b's. + bc = 0.6646e-4 # Carbon + bo = 0.5843e-4 # Oxygen + bh = -0.3739e-4 # Hydrogen + bp = 0.513e-4 # Phosphorus + bn = 0.936e-4 # Nitrogen + + # Work out the total scattering length in each fragment + # Define scattering lengths + # Hydrogenated version + COO = (2 * bo) + (bc) + GLYC = (3 * bc) + (5 * bh) + CH3 = (1 * bc) + (3 * bh) + PO4 = (1 * bp) + (4 * bo) + CH2 = (1 * bc) + (2 * bh) + CH = (1 * bc) + (1 * bh) + CHOL = (5 * bc) + (12 * bh) + (1 * bn) + + # And also volumes + vCH3 = 52.7 # CH3 volume in the paper appears to be for 2 * CH3's + vCH2 = 28.1 + vCOO = 39.0 + vGLYC = 68.8 + vPO4 = 53.7 + vCHOL = 120.4 + vCHCH = 42.14 + + vHead = vCHOL + vPO4 + vGLYC + 2 * vCOO + vTail = (28 * vCH2) + (1 * vCHCH) + (2 * vCH3) # Tail volume + + # Calculate sum_b's for other fragments + sumbHead = CHOL + PO4 + GLYC + 2 * COO + sumbTail = (28 * CH2) + (2 * CH) + 2 * CH3 + + # Calculate SLDs and Thickness + sldHead = sumbHead / vHead + thickHead = vHead / thiolAPM + + sldTail = sumbTail / vTail + thickTail = vTail / thiolAPM + + # Correct head SLD based on hydration + thiolHeadHydr = thiolHeadHydr / 100 + sldHead = sldHead * (1 - thiolHeadHydr) + (thiolHeadHydr * bulk_out[contrast]) + + # Now correct both the SLDs for the coverage parameter + sldTail = (thiolCoverage * sldTail) + ((1 - thiolCoverage) * bulk_out[contrast]) + sldHead = (thiolCoverage * sldHead) + ((1 - thiolCoverage) * bulk_out[contrast]) + + SAMTAILS = [thickTail, sldTail, 0, goldRough] + SAMHEAD = [thickHead, sldHead, 0, goldRough] + + # Now do the same for the bilayer + vHead = vCHOL + vPO4 + vGLYC + 2 * vCOO + vTail = 28 * vCH2 # Tail volume + vMe = 2 * vCH3 + + sumbHead = CHOL + PO4 + GLYC + 2 * COO + sumbTail = 28 * CH2 + sumbMe = 2 * CH3 + + sldHead = sumbHead / vHead + thickHead = vHead / bilayerAPM + bilHeadHydr = bilHeadHydr / 100 + sldHead = sldHead * (1 - bilHeadHydr) + (bilHeadHydr * bulk_out[contrast]) + + sldTail = sumbTail / vTail + thickTail = vTail / bilayerAPM + + sldMe = sumbMe / vMe + thickMe = vMe / bilayerAPM + + sldTail = (bilayerCoverage * sldTail) + ((1 - bilayerCoverage) * bulk_out[contrast]) + sldHead = (bilayerCoverage * sldHead) + ((1 - bilayerCoverage) * bulk_out[contrast]) + sldMe = (bilayerCoverage * sldMe) + ((1 - bilayerCoverage) * bulk_out[contrast]) + + BILTAILS = [thickTail, sldTail, 0, bilayerRough] + BILHEAD = [thickHead, sldHead, 0, bilayerRough] + BILME = [thickMe, sldMe, 0, bilayerRough] + + BILAYER = [BILHEAD, BILTAILS, BILME, BILME, BILTAILS, BILHEAD] + + CW = [cwThick, bulk_out[contrast], 0, bilayerRough] + + if contrast == 1 or contrast == 3: + output = [alloyUp, gold, SAMTAILS, SAMHEAD, CW, *BILAYER] + else: + output = [alloyDown, gold, SAMTAILS, SAMHEAD, CW, *BILAYER] + + return output, subRough diff --git a/examples/domains_custom_XY/controls.json b/examples/domains_custom_XY/controls.json new file mode 100644 index 0000000..458cb1e --- /dev/null +++ b/examples/domains_custom_XY/controls.json @@ -0,0 +1 @@ +{"procedure":"calculate","parallel":"single","calcSldDuringFit":false,"resampleMinAngle":0.9,"resampleNPoints":50,"display":"iter"} \ No newline at end of file diff --git a/examples/domains_custom_XY/domains_XY_model.py b/examples/domains_custom_XY/domains_XY_model.py new file mode 100644 index 0000000..fd1823a --- /dev/null +++ b/examples/domains_custom_XY/domains_XY_model.py @@ -0,0 +1,70 @@ +import math + +import numpy as np + + +def domains_XY_model(params, bulk_in, bulk_out, contrast, domain): + # Split up the parameters for convenience + subRough = params[0] + oxideThick = params[1] + layerThick = params[2] + layerSLD = params[3] + layerRough = params[4] + domainSLD = params[5] + + # Make an array of z values for our model + z = np.arange(0, 141) + + # Make the volume fraction distribution for our Silicon substrate + [vfSilicon, siSurf] = makeLayer(z, -25, 50, 1, subRough, subRough) + + # ... and the Oxide ... + [vfOxide, oxSurface] = makeLayer(z, siSurf, oxideThick, 1, subRough, subRough) + + # ... and also our layer. + [vfLayer, laySurface] = makeLayer(z, oxSurface, layerThick, 1, subRough, layerRough) + + # Everything that is not already occupied will be filled will water + totalVF = vfSilicon + vfOxide + vfLayer + vfWater = 1 - totalVF + + # Now convert the Volume Fractions to SLDs + siSLD = vfSilicon * bulk_in + oxSLD = vfOxide * 3.41e-6 + + # Layer SLD depends on whether we are calculating the domain or not + if domain == 0: + laySLD = vfLayer * layerSLD + else: + laySLD = vfLayer * domainSLD + + # ... and finally the water SLD. + waterSLD = vfWater * bulk_out[contrast] + + # Make the total SLD by just adding them all up + totalSLD = siSLD + oxSLD + laySLD + waterSLD + + # The output is just a [n x 2] array of z against SLD + SLD = np.column_stack([z, totalSLD]) + + return SLD, subRough + + +def makeLayer(z, prevLaySurf, thickness, height, Sigma_L, Sigma_R): + """This produces a layer, with a defined thickness, height and roughness. + Each side of the layer has its own roughness value. + """ + # Find the edges + left = prevLaySurf + right = prevLaySurf + thickness + + # Make our heaviside + a = (z - left) / ((2**0.5) * Sigma_L) + b = (z - right) / ((2**0.5) * Sigma_R) + + erf_a = np.array([math.erf(value) for value in a]) + erf_b = np.array([math.erf(value) for value in b]) + + VF = np.array((height / 2) * (erf_a - erf_b)) + + return VF, right diff --git a/examples/domains_custom_XY/project.json b/examples/domains_custom_XY/project.json new file mode 100644 index 0000000..8a4d60c --- /dev/null +++ b/examples/domains_custom_XY/project.json @@ -0,0 +1 @@ +{"name": "", "calculation": "domains", "model": "custom xy", "geometry": "substrate/liquid", "absorption": false, "parameters": [{"name": "Substrate Roughness", "min": 1.0, "value": 3.0, "max": 5.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Oxide Thickness", "min": 10.0, "value": 20.0, "max": 50.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Layer Thickness", "min": 1.0, "value": 30.0, "max": 500.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Layer SLD", "min": -5e-07, "value": -5e-07, "max": 0.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Layer Roughness", "min": 2.0, "value": 5.0, "max": 7.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Domain SLD", "min": 1e-06, "value": 1e-06, "max": 5e-06, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "bulk_in": [{"name": "Silicon", "min": 0.0, "value": 2.073e-06, "max": 1.0, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "bulk_out": [{"name": "SLD D2O", "min": 6.2e-06, "value": 6.35e-06, "max": 6.35e-06, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "SLD SMW", "min": 2e-06, "value": 2.073e-06, "max": 2.1e-06, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "SLD H2O", "min": -6e-07, "value": -5.6e-07, "max": -5e-07, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "scalefactors": [{"name": "Scalefactor 1", "min": 0.8, "value": 1.0, "max": 1.1, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "domain_ratios": [{"name": "Domain Ratio 1", "min": 0.4, "value": 0.5, "max": 0.6, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "background_parameters": [{"name": "Background Param 1", "min": 1e-07, "value": 1e-06, "max": 1e-05, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "backgrounds": [{"name": "Background 1", "type": "constant", "value_1": "Background Param 1", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}], "resolution_parameters": [{"name": "Resolution Param 1", "min": 0.01, "value": 0.03, "max": 0.05, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "resolutions": [{"name": "Resolution 1", "type": "constant", "value_1": "Resolution Param 1", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}], "custom_files": [{"name": "Domain Layer", "filename": "domains_XY_model.py", "language": "python", "path": "./examples/domains_custom_XY/"}], "data": [{"name": "Simulation", "data": [], "data_range": [], "simulation_range": [0.005, 0.7]}], "layers": [], "domain_contrasts": [], "contrasts": [{"name": "D2O", "data": "Simulation", "background": "Background 1", "background_action": "add", "bulk_in": "Silicon", "bulk_out": "SLD D2O", "scalefactor": "Scalefactor 1", "resolution": "Resolution 1", "resample": false, "domain_ratio": "Domain Ratio 1", "model": ["Domain Layer"]}, {"name": "SMW", "data": "Simulation", "background": "Background 1", "background_action": "add", "bulk_in": "Silicon", "bulk_out": "SLD SMW", "scalefactor": "Scalefactor 1", "resolution": "Resolution 1", "resample": false, "domain_ratio": "Domain Ratio 1", "model": ["Domain Layer"]}, {"name": "H2O", "data": "Simulation", "background": "Background 1", "background_action": "add", "bulk_in": "Silicon", "bulk_out": "SLD H2O", "scalefactor": "Scalefactor 1", "resolution": "Resolution 1", "resample": false, "domain_ratio": "Domain Ratio 1", "model": ["Domain Layer"]}]} diff --git a/examples/domains_custom_layers/alloy_domains.py b/examples/domains_custom_layers/alloy_domains.py new file mode 100644 index 0000000..f7d9ed4 --- /dev/null +++ b/examples/domains_custom_layers/alloy_domains.py @@ -0,0 +1,26 @@ +def alloy_domains(params, bulkIn, bulkOut, contrast, domain): + """Simple custom model for testing incoherent summing. + Simple two layer of permalloy / gold, with up/down domains. + """ + # Split up the parameters + subRough = params[0] + alloyThick = params[1] + alloySLDup = params[2] + alloySLDdn = params[3] + alloyRough = params[4] + goldThick = params[5] + goldSLD = params[6] + goldRough = params[7] + + # Make the layers + alloyUp = [alloyThick, alloySLDup, alloyRough] + alloyDn = [alloyThick, alloySLDdn, alloyRough] + gold = [goldThick, goldSLD, goldRough] + + # Make the model depending on which domain we are looking at + if domain == 0: + output = [alloyUp, gold] + else: + output = [alloyDn, gold] + + return output, subRough diff --git a/examples/domains_custom_layers/controls.json b/examples/domains_custom_layers/controls.json new file mode 100644 index 0000000..458cb1e --- /dev/null +++ b/examples/domains_custom_layers/controls.json @@ -0,0 +1 @@ +{"procedure":"calculate","parallel":"single","calcSldDuringFit":false,"resampleMinAngle":0.9,"resampleNPoints":50,"display":"iter"} \ No newline at end of file diff --git a/examples/domains_custom_layers/project.json b/examples/domains_custom_layers/project.json new file mode 100644 index 0000000..46851ec --- /dev/null +++ b/examples/domains_custom_layers/project.json @@ -0,0 +1 @@ +{"name": "", "calculation": "domains", "model": "custom layers", "geometry": "substrate/liquid", "absorption": false, "parameters": [{"name": "Substrate Roughness", "min": 1.0, "value": 3.0, "max": 5.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Alloy Thickness", "min": 100.0, "value": 150.0, "max": 200.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Alloy SLD up", "min": 9e-06, "value": 1.1e-05, "max": 1.3e-05, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Alloy SLD down", "min": 5e-06, "value": 7e-06, "max": 1e-05, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Alloy Roughness", "min": 5.0, "value": 7.0, "max": 11.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Gold Thickness", "min": 100.0, "value": 150.0, "max": 200.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Gold SLD", "min": 4e-06, "value": 4.5e-06, "max": 5e-06, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "Gold Roughness", "min": 5.0, "value": 7.0, "max": 11.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "bulk_in": [{"name": "Silicon", "min": 0.0, "value": 2.073e-06, "max": 1.0, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "bulk_out": [{"name": "SLD D2O", "min": 6.2e-06, "value": 6.35e-06, "max": 6.35e-06, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "scalefactors": [{"name": "Scalefactor 1", "min": 0.02, "value": 0.23, "max": 0.25, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "domain_ratios": [{"name": "Domain Ratio 1", "min": 0.4, "value": 0.5, "max": 0.6, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "background_parameters": [{"name": "Background Param 1", "min": 1e-07, "value": 1e-06, "max": 1e-05, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "backgrounds": [{"name": "Background 1", "type": "constant", "value_1": "Background Param 1", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}], "resolution_parameters": [{"name": "Resolution Param 1", "min": 0.01, "value": 0.03, "max": 0.05, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "resolutions": [{"name": "Resolution 1", "type": "constant", "value_1": "Resolution Param 1", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}], "custom_files": [{"name": "Alloy domains", "filename": "alloy_domains.py", "language": "python", "path": "./examples/domains_custom_layers/"}], "data": [{"name": "Simulation", "data": [], "data_range": [], "simulation_range": [0.005, 0.7]}], "layers": [], "domain_contrasts": [], "contrasts": [{"name": "D2O Contrast", "data": "Simulation", "background": "Background 1", "background_action": "add", "bulk_in": "Silicon", "bulk_out": "SLD D2O", "scalefactor": "Scalefactor 1", "resolution": "Resolution 1", "resample": false, "domain_ratio": "Domain Ratio 1", "model": ["Alloy domains"]}]} diff --git a/examples/domains_standard_layers/controls.json b/examples/domains_standard_layers/controls.json new file mode 100644 index 0000000..458cb1e --- /dev/null +++ b/examples/domains_standard_layers/controls.json @@ -0,0 +1 @@ +{"procedure":"calculate","parallel":"single","calcSldDuringFit":false,"resampleMinAngle":0.9,"resampleNPoints":50,"display":"iter"} \ No newline at end of file diff --git a/examples/domains_standard_layers/project.json b/examples/domains_standard_layers/project.json new file mode 100644 index 0000000..75cd9cf --- /dev/null +++ b/examples/domains_standard_layers/project.json @@ -0,0 +1 @@ +{"name": "", "calculation": "domains", "model": "standard layers", "geometry": "air/substrate", "absorption": false, "parameters": [{"name": "Substrate Roughness", "min": 1.0, "value": 3.0, "max": 5.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "L1 Thickness", "min": 5.0, "value": 20.0, "max": 60.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "L1 SLD", "min": 3e-06, "value": 4.1e-06, "max": 5e-06, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "L1 Roughness", "min": 2.0, "value": 5.0, "max": 20.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "L1 Hydration", "min": 10.0, "value": 20.0, "max": 30.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "L2 Thickness", "min": 5.0, "value": 60.0, "max": 100.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "L2 SLD", "min": 2.1e-06, "value": 3e-06, "max": 5e-06, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "L2 Roughness", "min": 2.0, "value": 5.0, "max": 20.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "L2 Hydration", "min": 10.0, "value": 20.0, "max": 30.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "L3 Thickness", "min": 5.0, "value": 200.0, "max": 300.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "L3 SLD", "min": 3e-06, "value": 7e-06, "max": 8e-06, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "L3 Roughness", "min": 2.0, "value": 5.0, "max": 20.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}, {"name": "L3 Hydration", "min": 10.0, "value": 20.0, "max": 30.0, "fit": true, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "bulk_in": [{"name": "SLD Air", "min": 0.0, "value": 0.0, "max": 0.0, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "bulk_out": [{"name": "SLD D2O", "min": 6.2e-06, "value": 6.35e-06, "max": 6.35e-06, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "scalefactors": [{"name": "Scalefactor 1", "min": 0.02, "value": 0.23, "max": 0.25, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "domain_ratios": [{"name": "Domain Ratio 1", "min": 0.4, "value": 0.5, "max": 0.6, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "background_parameters": [{"name": "Background Param 1", "min": 1e-07, "value": 1e-06, "max": 1e-05, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "backgrounds": [{"name": "Background 1", "type": "constant", "value_1": "Background Param 1", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}], "resolution_parameters": [{"name": "Resolution Param 1", "min": 0.01, "value": 0.03, "max": 0.05, "fit": false, "prior_type": "uniform", "mu": 0.0, "sigma": Infinity}], "resolutions": [{"name": "Resolution 1", "type": "constant", "value_1": "Resolution Param 1", "value_2": "", "value_3": "", "value_4": "", "value_5": ""}], "custom_files": [], "data": [{"name": "Simulation", "data": [], "data_range": [], "simulation_range": [0.005, 0.7]}], "layers": [{"name": "Layer 1", "thickness": "L1 Thickness", "SLD": "L1 SLD", "roughness": "L1 Roughness", "hydration": "L1 Hydration", "hydrate_with": "bulk out"}, {"name": "Layer 2", "thickness": "L2 Thickness", "SLD": "L2 SLD", "roughness": "L2 Roughness", "hydration": "L2 Hydration", "hydrate_with": "bulk out"}, {"name": "Layer 3", "thickness": "L3 Thickness", "SLD": "L3 SLD", "roughness": "L3 Roughness", "hydration": "L3 Hydration", "hydrate_with": "bulk out"}], "domain_contrasts": [{"name": "Domain 1", "model": ["Layer 1"]}, {"name": "Domain 2", "model": ["Layer 2", "Layer 3"]}], "contrasts": [{"name": "Domain Test", "data": "Simulation", "background": "Background 1", "background_action": "add", "bulk_in": "SLD Air", "bulk_out": "SLD D2O", "scalefactor": "Scalefactor 1", "resolution": "Resolution 1", "resample": false, "domain_ratio": "Domain Ratio 1", "model": ["Domain 1", "Domain 2"]}]} \ No newline at end of file diff --git a/examples/make_examples.py b/examples/make_examples.py new file mode 100644 index 0000000..cb75905 --- /dev/null +++ b/examples/make_examples.py @@ -0,0 +1,20 @@ +from pathlib import Path + +import RATapi as RAT + +examples = [ + "DSPC_custom_XY", + "DSPC_custom_layers", + "DSPC_standard_layers", + "absorption", + "domains_custom_XY", + "domains_custom_layers", + "domains_standard_layers", +] + +for example in examples: + p, _ = getattr(RAT.examples, example)() + example_folder = Path(f"./{example}/") + example_folder.mkdir(parents=True, exist_ok=True) + Path(example_folder, "project.json").write_text(RAT.utils.convert.project_to_json(p)) + Path(example_folder, "controls.json").write_text("{}") diff --git a/examples/rascal1_example/Model_IIb.m b/examples/rascal1_example/Model_IIb.m new file mode 100644 index 0000000..1f90656 --- /dev/null +++ b/examples/rascal1_example/Model_IIb.m @@ -0,0 +1,130 @@ +function [output,sub_rough] = Model_IIb(params,bulk_in,bulk_out,contrast) +%MODEL_1 RASCAL Custom Layer Model File. +% +% +% This file accepts 3 vectors containing the values for +% Params, bulk in and bulk out +% The final parameter is an index of the contrast being calculated +% The m-file should output a matrix of layer values, in the form.. +% Output = [thick 1, SLD 1, Rough 1, Percent Hydration 1, Hydrate how 1 +% .... +% thick n, SLD n, Rough n, Percent Hydration n, Hydration how n] +% The "hydrate how" parameter decides if the layer is hydrated with +% Bulk out or Bulk in phases. Set to 1 for Bulk out, zero for Bulk in. +% Alternatively, leave out hydration and just return.. +% Output = [thick 1, SLD 1, Rough 1, +% .... +% thick n, SLD n, Rough n] }; +% The second output parameter should be the substrate roughness + + +Roughness = params(1); +APM = params(2); +thickHead = params(3); +theta = params(4); +% vTail = params(4); +% vHead = params(5); + +%Make a flag to say which deuteration this is calculating +%[subs head tail] +deut = [0 0 1; + 1 0 1; + 0 1 0; + 1 1 0; + 0 1 1; + 1 1 1; + 1 0 0]; + + +%Neutron b's.. +%define all the neutron b's. +bc = 0.6646e-4; %Carbon +bo = 0.5843e-4; %Oxygen +bh = -0.3739e-4; %Hydrogen +bp = 0.513e-4; %Phosphorus +bn = 0.936e-4; %Nitrogen +bd = 0.6671e-4; %Deuterium + +%Work out the total scattering length in each fragment.... +%Define scattering lengths.. +%Hydrogenated version.... +COO = (4*bo) + (2*bc); +GLYC = (3*bc) + (5*bh); +CH3 = (2*bc) + (6*bh); +PO4 = (1*bp) + (4*bo); +CH2 = (1*bc) + (2*bh); +CHOL = (5*bc) + (12*bh) + (1*bn); +H2O = (2*bh) + (1*bo); + +%..and deuterated... +dGLYC = (3*bc) + (5*bd); +dCH3 = (2*bc) + (6*bd); +dCH2 = (1*bc) + (2*bd); +dCHOL = (5*bc) + (12*bd) + (1*bn); +D2O = (2*bd) + (1*bo); + +%And also volumes.... +vCH3 = 52.7; +vCH2 = 28.1; +vCOO = 39.0; +vGLYC = 68.8; +vPO4 = 53.7; +vCHOL = 120.4; +vWAT = 30.4; + +vHead = vCHOL + vPO4 + vGLYC + 2*vCOO; +vTail = 2*(16*vCH2)+ 2*(vCH3); + +%Make the SLD's first... +thisMask = deut(contrast,:); + +switch thisMask(1) + case 0 + thisWater = (H2O * 0.9249) + (D2O * 0.0871); + case 1 + thisWater = D2O; +end + +%Calculate mole fraction of D2O from the bulk SLD.. +d2o_molfr = (1/D2O-H2O)*((bulk_out(contrast)/0.036182336306)-H2O); +thisWater = (d2o_molfr * D2O) + ((1-d2o_molfr)*H2O); + + +switch thisMask(2) + case 0 + thisHead = CHOL + PO4 + GLYC + COO; + case 1 + thisHead = dCHOL + PO4 + GLYC + COO; +end + +switch thisMask(3); + case 0 + thisTail = (32*CH2) + CH3; + case 1 + thisTail = (32*dCH2) + dCH3; +end + +noWat = ((thickHead*APM)-vHead)/vWAT; +thisHead = thisHead + noWat*thisWater; +vHead = vHead + noWat*vWAT; + + +sldHead = thisHead/vHead; +%thickHead = vHead/APM; + +sldTail = thisTail/vTail; +%thickTail = vTail/APM; + +thickTail = (1.5 + 16*1.265)*cosd(theta); + +output = [thickTail sldTail Roughness; + thickHead sldHead Roughness;]; + + +sub_rough = Roughness; + + + + + + diff --git a/examples/rascal1_example/Model_IIb.py b/examples/rascal1_example/Model_IIb.py new file mode 100644 index 0000000..ae36ba5 --- /dev/null +++ b/examples/rascal1_example/Model_IIb.py @@ -0,0 +1,84 @@ +from math import cos, radians + + +def Model_IIb(params, bulk_in, bulk_out, contrast): + # converted from matlab file Model_IIb.m + + Roughness, APM, thickHead, theta = params + + # Make a flag to say which deuteration this is calculating + # [subs head tail] + deut = [[0, 0, 1], [1, 0, 1], [0, 1, 0], [1, 1, 0], [0, 1, 1], [1, 1, 1], [1, 0, 0]] + + bc = 0.6646e-4 # Carbon + bo = 0.5843e-4 # Oxygen + bh = -0.3739e-4 # Hydrogen + bp = 0.513e-4 # Phosphorus + bn = 0.936e-4 # Nitrogen + bd = 0.6671e-4 # Deuterium + + # Work out the total scattering length in each fragment + # for hydrogenated: + COO = (4 * bo) + (2 * bc) + GLYC = (3 * bc) + (5 * bh) + CH3 = (2 * bc) + (6 * bh) + PO4 = (1 * bp) + (4 * bo) + CH2 = (1 * bc) + (2 * bh) + CHOL = (5 * bc) + (12 * bh) + (1 * bn) + H2O = (2 * bh) + (1 * bo) + + # for deuterated: + dCH3 = (2 * bc) + (6 * bd) + dCH2 = (1 * bc) + (2 * bd) + dCHOL = (5 * bc) + (12 * bd) + (1 * bn) + D2O = (2 * bd) + (1 * bo) + + # for volumes: + vCH3 = 52.7 + vCH2 = 28.1 + vCOO = 39.0 + vGLYC = 68.8 + vPO4 = 53.7 + vCHOL = 120.4 + vWAT = 30.4 + + vHead = vCHOL + vPO4 + vGLYC + 2 * vCOO + vTail = 2 * (16 * vCH2) + 2 * (vCH3) + + # make SLDs + thisMask = deut[contrast] + + if thisMask[0] == 0: + thisWater = (H2O * 0.9249) + (D2O * 0.0871) + else: + thisWater = D2O + + # Calculate mole fraction of D2O from the bulk SLD + d2o_molfr = (1 / D2O - H2O) * ((bulk_out[contrast] / 0.036182336306) - H2O) + thisWater = (d2o_molfr * D2O) + ((1 - d2o_molfr) * H2O) + + if thisMask[1] == 0: + thisHead = CHOL + PO4 + GLYC + COO + else: + thisHead = dCHOL + PO4 + GLYC + COO + + if thisMask[2] == 0: + thisTail = (32 * CH2) + CH3 + else: + thisTail = (32 * dCH2) + dCH3 + + noWat = ((thickHead * APM) - vHead) / vWAT + thisHead = thisHead + noWat * thisWater + vHead = vHead + noWat * vWAT + + sldHead = thisHead / vHead + + sldTail = thisTail / vTail + + thickTail = (1.5 + 16 * 1.265) * cos(radians(theta)) + + output = [[thickTail, sldTail, Roughness], [thickHead, sldHead, Roughness]] + + sub_rough = Roughness + + return output, sub_rough diff --git a/examples/rascal1_example/R1monolayerVolumeModel.mat b/examples/rascal1_example/R1monolayerVolumeModel.mat new file mode 100644 index 0000000..e660491 Binary files /dev/null and b/examples/rascal1_example/R1monolayerVolumeModel.mat differ diff --git a/pyproject.toml b/pyproject.toml index e6de6e9..66a72b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,6 +22,7 @@ version = {attr = "rascal2.RASCAL2_VERSION"} [tool.ruff] line-length = 120 +extend-exclude = ["examples/*"] [tool.ruff.lint] select = ["E", "F", "UP", "B", "SIM", "I", "N", "TD003", "A"] diff --git a/rascal2/ui/model.py b/rascal2/ui/model.py index 2b2108f..c8ed985 100644 --- a/rascal2/ui/model.py +++ b/rascal2/ui/model.py @@ -97,7 +97,7 @@ def load_project(self, load_path: str): """ controls_file = Path(load_path, "controls.json") try: - controls = RAT.Controls.model_validate_json(controls_file.read_text()) + controls = RAT.Controls.model_validate_json(controls_file.read_text().rstrip()) except ValueError as err: raise ValueError( "The controls.json file for this project is not valid.\n" @@ -106,7 +106,7 @@ def load_project(self, load_path: str): project_file = Path(load_path, "project.json") try: - project = RAT.utils.convert.project_from_json(project_file.read_text()) + project = RAT.utils.convert.project_from_json(project_file.read_text().rstrip()) except JSONDecodeError as err: raise ValueError("The project.json file for this project contains invalid JSON.") from err except (KeyError, ValueError) as err: