Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_installer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
conda init powershell
conda activate rascal2
conda install -c nsis nsis=3.* accesscontrol
pip install matlabengine==9.14.*
python -m pip install --no-build-isolation 'D:\hostedtoolcache\windows\MATLAB\extern\engines\python'
python packaging/build_exe.py
if ($env:GITHUB_REF_NAME -eq "main") {
makensis /DNIGHTLY packaging/windows/build_installer.nsi
Expand Down
2 changes: 1 addition & 1 deletion examples/DSPC_custom_XY/controls.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"procedure":"calculate","parallel":"single","resampleMinAngle":0.9,"resampleNPoints":50,"display":"iter"}
{"procedure":"calculate","parallel":"single","numSimulationPoints":500,"resampleMinAngle":0.9,"resampleNPoints":50,"display":"iter"}
38 changes: 21 additions & 17 deletions examples/DSPC_custom_XY/custom_XY_DSPC.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import math
"""A custom XY model for a supported DSPC bilayer."""

from math import sqrt

import numpy as np
from scipy.special import erf


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."""
"""Calculate the continuous SLD of a supported DSPC bilayer using volume restricted distribution functions."""
# Note - The first contrast number is 1 (not 0) so be careful if you use
# this variable for array indexing.

# Split up the parameters
subRough = params[0]
oxideThick = params[1]
Expand Down Expand Up @@ -49,10 +55,10 @@ def custom_XY_DSPC(params, bulk_in, bulk_out, contrast):
z = np.arange(0, 141)

# Make our Silicon substrate
vfSilicon, siSurf = layer(z, -25, 50, 1, subRough, subRough)
vfSilicon, siSurf = make_layer(z, -25, 50, 1, subRough, subRough)

# Add the Oxide
vfOxide, oxSurface = layer(z, siSurf, oxideThick, 1, subRough, subRough)
vfOxide, oxSurface = make_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
Expand All @@ -63,15 +69,15 @@ def custom_XY_DSPC(params, bulk_in, bulk_out, contrast):
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)
vfHeadL, headLSurface = make_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)
vfTails, tailsSurf = make_layer(z, headLSurface, tailsThick, 1, bilayerRough, bilayerRough)

# Finally the upper head ...
vfHeadR, headSurface = layer(z, tailsSurf, headThick, 1, bilayerRough, bilayerRough)
vfHeadR, headSurface = make_layer(z, tailsSurf, headThick, 1, bilayerRough, bilayerRough)

# Making the model
# We've created the volume fraction profiles corresponding to each of the groups.
Expand Down Expand Up @@ -106,32 +112,30 @@ def custom_XY_DSPC(params, bulk_in, bulk_out, contrast):
sldHeadL = vfHeadL * sld_Value_Head
sldHeadR = vfHeadR * sld_Value_Head
sldTails = vfTails * sld_Value_Tails
sldWat = vfWat * bulk_out[contrast]
sldWat = vfWat * bulk_out[contrast - 1]

# 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)]
SLD = np.column_stack((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.
def make_layer(z, prevLaySurf, thickness, height, Sigma_L, Sigma_R):
"""Produce 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])
erf_left = erf((z - left) / (sqrt(2) * Sigma_L))
erf_right = erf((z - right) / (sqrt(2) * Sigma_R))

VF = np.array((height / 2) * (erf_a - erf_b))
VF = np.array((0.5 * height) * (erf_left - erf_right))

return VF, right
2 changes: 1 addition & 1 deletion examples/DSPC_custom_XY/project.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/DSPC_custom_layers/controls.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"procedure":"calculate","parallel":"single","resampleMinAngle":0.9,"resampleNPoints":50,"display":"iter"}
{"procedure":"calculate","parallel":"single","numSimulationPoints":500,"resampleMinAngle":0.9,"resampleNPoints":50,"display":"iter"}
14 changes: 9 additions & 5 deletions examples/DSPC_custom_layers/custom_bilayer_DSPC.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
"""A custom layer model for a DSPC supported bilayer."""

import numpy as np


def custom_bilayer_DSPC(params, bulk_in, bulk_out, contrast):
"""CUSTOMBILAYER RAT Custom Layer Model File.
"""Calculate layer parameters for a DSPC supported bilayer.

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.
Expand All @@ -23,6 +25,8 @@ def custom_bilayer_DSPC(params, bulk_in, bulk_out, contrast):

The second output parameter should be the substrate roughness.
"""
# Note - The first contrast number is 1 (not 0) so be careful if you use
# this variable for array indexing.
sub_rough = params[0]
oxide_thick = params[1]
oxide_hydration = params[2]
Expand Down Expand Up @@ -70,13 +74,13 @@ def custom_bilayer_DSPC(params, bulk_in, bulk_out, contrast):
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)
oxSLD = (oxide_hydration * bulk_out[contrast - 1]) + ((1 - oxide_hydration) * oxide_SLD)
headSLD = (headHydration * bulk_out[contrast - 1]) + ((1 - headHydration) * SLDhead)
tailSLD = (bilayerHydration * bulk_out[contrast - 1]) + ((1 - bilayerHydration) * SLDtail)

# Make the layers
oxide = [oxide_thick, oxSLD, sub_rough]
water = [waterThick, bulk_out[contrast], bilayerRough]
water = [waterThick, bulk_out[contrast - 1], bilayerRough]
head = [headThick, headSLD, bilayerRough]
tail = [tailThick, tailSLD, bilayerRough]

Expand Down
2 changes: 1 addition & 1 deletion examples/DSPC_custom_layers/project.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/DSPC_standard_layers/controls.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"procedure":"calculate","parallel":"single","resampleMinAngle":0.9,"resampleNPoints":50,"display":"iter"}
{"procedure":"calculate","parallel":"single","numSimulationPoints":500,"resampleMinAngle":0.9,"resampleNPoints":50,"display":"iter"}
Loading
Loading