This repository contains a liquid-liquid phase separation simulation for analyzing how different interaction matrices effect the number of phases that can be produced.
This code is based on the paper Evolved interactions stabilize many coexisting phases in multicomponent liquids and uses a similar technique for determining the number of phases that a given interaction matrix can produce.
Here I use a the same simulation algorithm used in the above paper to simulate each starting condition to a final, stable state, using a matrix
Basically:
- Run the simulation on a bunch of random starting conditions to get a bunch of samples of final states.
- Perform a higherarchical clustering of the final states to compute the number of phases present for the given interaction matrix.
- Use the phase counts to characterize the probability distribution of the number of phases produced for the given interaction matrix.
The "starting conditions" of the simulation is a set of
The simulation takes an initial start state and simulates the dynamics of the change in the different components over time until a stable state is reached. Then the final concentrations of each phase are recorded. The simulation is progressed iteratively using the equation
to update the different component volumes over time until they converge to a steady state.
If you want details about the derivation, then definately go read the paper, they explain it much better than I could.
The library can be used in scripts but it is intended to be used in the following way on the REPL:
julia> using LlpsSim, Statistics
[ Info: Precompiling LlpsSim [0bc873b6-c522-4845-a95e-a4d541d9658e]
julia> χ = generate_random_interaction_matrix(5, 2.0, 2.0)
5×5 Matrix{Float64}:
0.0 2.71539 -0.204025 -1.462 6.73549
2.71539 0.0 3.09666 1.34214 6.63846
-0.204025 3.09666 0.0 0.104928 0.748687
-1.462 1.34214 0.104928 0.0 1.60546
6.73549 6.63846 0.748687 1.60546 0.0
julia> samples = sample_phase_counts(χ, 64)
64-element Vector{Int64}:
2
3
⋮
2
2
julia> mean(samples)
2.09375
Moving forward, I plan on using directed evolution to determine if it is theroretically possible for cells to evolve specific types of dynamics with respect to phase separation.
The code here is based off of this (https://github.com/zwicker-group/paper-multicomponent-evolution) github repository which is associated with this (Evolved interactions stabilize many coexisting phases in multicomponent liquids) paper.