Lipid bilayer model#160
Conversation
…aterials, still missing correct layer calculation
|
Some comments:
|
|
Hi @andyfaff , this is still the draft PR, I didn't finish implementing the initial class and need some more input from Max about the Math behind it. I thought having the PR already created allows the discussion to start before finalizing the coding. How we describe these systems should be discussed between you guys with soft-matter background. I don't see an issue having both a LipidLeaflet and a Bilayer class, if that is what the community wants to use. Insertion of guests would probably done by some optional parameter, we didn't get to that discussion as we wanted to start with the simplest case. |
…ickness and density, math needs checking
|
Thanks for the comments and starting on the implementation.
Steve and I have finally put together the following: This represents the call signature e.g. "symmetricBilayer((POPC, 0.8), (POPS,0.2))". Our suggestion is that:
In the fitting software, assembling the model becomes the quite simple, provided a "symmetricBilayerORSO" class exists with the functionality listed in the above attached file: def customLipidBilayerORSO(params, bulk_in, bulk_out, contrast): This function (RasCAL stye here) the returns the complete stack of regular layers plut bilayer layers based on the fitting parameters listed at the top. Steve has also include a potential example, like Artur's suggestion for defining a lipid, which is not in the SLDDB. This should also work, but I am concerned that the defining the syntax correctly without an orsopy "model builder" will become trickier for the average user. Please let us know what you think. Thanks, Max and Steve |
|
@maxskoda I could include an example for parsing the model class in a way as you describe, similar to what I'm doing in genx. That should generally be indpendent of the layer generation in |
…r__ with dataclass default
…e neutorn refnx model with blocks
…nted for hardcoded Lipids
|
This seems like effectively a plugin system/contract, where orsopy recognizes certain inputs for a substack as corresponding to materials which can be looked up from an sld table, and then the results fed into a custom class indicated by the "class" attribute. Is this contract documented? It seems like in the example given Just as a thought, this might be more flexible if everything were passed directly to the consumer class as-is, and the consumer is free to use orsopy to look up SLD for materials as it needs to (any consumer program already requires orsopy to be installed and imported at the time of use) |
|
@bmaranville It goes into this direction, but the idea was more based on the concept we have for the ORSO header in general. The Yes, this will require much more documentation to be added. Right now the PR is focused on the definition as well as implementation. That said, a program that wants to use
Have a look at examples/resolve_and_plot_model.py, showing how this can be done for refnx. Edit: |
…ude coverage parameter
|
Dear @aglavic , Many thanks for all the work implementing this. I've not had time to check all the code and behaviour (so I apologise if I didn't quite understand it correctly), but I noticed a slight nomenclature issue specific to the Bilayer class: Si | SiO2 | Bilayer(DMPC) | solvent represents: Si | SiO2 | inner head | inner tail | outer head | outer tail | solventAlso, do I understand correctly that in the consumer application, I can do something like: blocks = sample.resolve_to_blocks()
for block in blocks:
if isinstance(block, model_complex.Bilayer):
head_volume = block.outer.volume
tail_volume = block.inner.volume
apm = block.apmThis is great! I will try it at the next possible opportunity. Thanks again, |
|
Hi @maxskoda, Concerning the head / tail nomenclature I might have misunderstood how this is used. I throught it reffered to the material on the inner / outer part of the Bilayer, meaning heads and tails. From what you wrote, I guess you mixed up the order in the representation and it should be: Si | SiO2 | inner head | inner tail | outer tail | outer head | solventIs that correct? I would thus suggest to call it heads and tails analogous to the LipidLeaflet. Also, is inner/outer a good description? What defines the inner side? The model language can be used for both reflectivity directions, so inner/outer would change place if the model is inverted.
Exactly. Have a look at the |
…ine one hydration parameter per leaflet
|
I've now updated the definition to use |
…y symmetric bi-layer.

PR Scope
This PR deals with three additions to the model language definition and code:
ClassName{p1: <p1>, p2: <p2>}. This description is optional and useful for classes with a few non-default arguments.ClassName{name}is used in the stack parameter.The functionality is based on discussions with @maxskoda and @StephenCLHall and expanded using input from thie PR discussion.
Usage
Here an example of how the new functionality could be used to describe a sample with 3 bilayers:
minimal:
full:
This is an example of a solid-liquid experiment with three lipid bi-layers. In the simple example they are defined given the known DMPC lipid, The full description give explicit outer and intter materials (which could also be names to search in SLDdb). In the current implementation, the hydration referrs to the "default_solvent" but placing the item in a SubStack allows to overwrite that environment (here defined by "(...) in H2O").
It may be advantagous to add a heuristic for definition of default_solvent from the stacks first or last material, if it is a liquid. Not sure how to check for this at the moment.
The PR incldues two new examples for the full functionality (10+11) that include lipid leaflets and bilayers with various degrees of modification.
The model building blocks can be used by software to implement the model with known components. An example of that for refnx can be seen in
resolve_and_plot_model.pywhere the Leaflet and Bilayer objects are resolved to LipidLeaflet objects instead of slabs.Lipid resolution
Currently, the class will include a set of pre-defined Lipids. Later it is envisaged to add the ability of composite materials into the SLDdb to search for Lipids specifically.
https://github.com/refnx/refnx/blob/main/tools/app/lipid_properties.ipynb
https://github.com/reflectometry/molgroups/blob/main/molgroups/lipids.py
Guest insertion
This is another topic to address in the future. I'd leave it out of the PR, which is already pretty heavy, and address later once I could discuss it with you in more detail.