src/context.jl
MEDYAN.MembraneSpeciesParams
Membrane protein physical parameters.
diffusion_coeff::Float64: Membrane diffusion coefficients (nm^2/s).area::Float64: Protein area projected onto the surface (nm^2).kbend::Float64: Bending rigidity (pN nm).eqcurv::Float64: The protein’s own spontaneous mean curvature (/nm). Can be used in bending energy computations with curvatures.
MEDYAN.Context
agent_names::MEDYAN.AgentNamessys_def::MEDYAN.SysDefcompartments::Vector{MEDYAN.Compartment}grid::MEDYAN.CubicGridtime::Float64: time (s)stats::MEDYAN.PerformanceStatsβ::Float64: inverse kT (1/(nm*pN))base_diffusion_coeffs::Vector{Float64}: Diffusion coefficients indexed by diffusing species id (nm²/s)membrane_species_params::StaticArraysCore.SVector{NUM_MEMBRANEDIFFUSINGSPECIES, MEDYAN.MembraneSpeciesParams} where NUM_MEMBRANEDIFFUSINGSPECIES: Membrane species parameters indexed by membrane diffusing species id.min_chem_voxel_volume_ratio::Float64: Smallest volume a chem voxel can have before being deactivated as a ratio to a full chem voxel volume.chemistryengine::MEDYAN.RDMESampler: The reaction diffusion master equation sampler, contains the diffusing and regular fixed species statechem_voxel_volumes::Array{Float64, 3}: Volume of each chemical voxelchem_voxel_areas::Array{Float64, 4}: Areas of (-x, -y, -z) faces of each chemical voxelchem_cylinders::Vector{MEDYAN.ChemCylinders}: Data about filament cylinders, indexed by filament type idballs::StructArrays.StructVector{MEDYAN.Ball, @NamedTuple{position::Vector{StaticArraysCore.SVector{3, Float64}}, radius::Vector{Float32}, stiffness::Vector{Float32}, state::Vector{StaticArraysCore.SVector{3, Int64}}}, Int64}membranes::Vector: All membrane meshes.next_membid::Ref{MEDYAN.MembId}: Next memb idmembid2membidx::Dict{MEDYAN.MembId, UInt32}: map from memb id to index memb indexes can change whenever a memb is removed, but id’s are stablemembidx2membid::Vector{MEDYAN.MembId}: map from memb index to idlink_manager::MEDYAN.LinkManagerdecimated_2mon_site_managers::Vector{MEDYAN.AbstractDecimated2MonSiteManager}: Site managers, indexed by site idfilamentsites::Tuple{Vararg{Tuple{Vararg{MEDYAN.SiteData}}}}: The filament site definitions, indexed by filament type id, filament site id to get a SiteData with fields of id, site, fxsidfilamentendsites::Tuple{Vararg{Tuple{Vararg{MEDYAN.SiteData}}}}: The filamentend site definitions, indexed by filament type id, filamentend site id to get a SiteData with fields of id, site, fxsidmaxfilsite_plusrange::Vector{Int64}: The maximum plus range in monomers that any filament site or end site can see. Indexed by filament type idmaxfilsite_minusrange::Vector{Int64}: The maximum minus range in monomers that any filament site or end site can see. Indexed by filament type idmembranesites::Tuple{Vararg{MEDYAN.SiteData}}: Maps membrane site id to a SiteData with fields of id, site, fxsid.map_membranediffusingspeciesindex_membranesiteindices::Tuple{Vararg{Vector{Int64}}}: Maps membrane diffusing species index to a list of membrane sites using this species as reactant. This is initialized during context init and should not be changed.decimated_2mon_sites::Vector{MEDYAN.SiteData}: Site definitions, indexed by site id to get a SiteData with fields of id, site, fxsidpossiblecadherinsite_managers::Tuple{Vararg{MEDYAN.AbstractPossibleCadherinSiteManager}}: Site managers, indexed by site idcheck_sitecount_error::Bool: If true site counts are checked for errors on every chem update. This is extremely slow, but useful for testing chem update errors.compartmentreactioncallbacks::Anybulkreactioncallbacks::Anymemdiff_bulks_index::Int64: Mock bulk species index for membrane diffusion.viscosity::Float64: viscosity (pNs/nm² or MPas) water is about 1E-9g_tol::Float64: maximum force magnitude after minimization (pN)nforce_fractbit::Int64: number of fractional bits used to scale force values into Int64nenergy_fractbit::Int64: number of fractional bits used to scale energy values into Int64shake_before_minimization::Float64: Standard deviation of noise added to coordinates before starting minimization.iter_max_cg_minimization::Int64: Max number of steps in conjugate gradient minimization.maxstep::Float64: max step to take during line search (nm)check_neighborlist_error::Bool: If true neighborlists are checked for errors on every force calc. This is extremely slow, but useful for testing neighborlist errors.nthreads::Int64: Experimental Set to more than 1 to enable multi threading. This is currently may result in non bitwise reproducable simulations. Results should be statistcally identical, but this is currently not well tested.enable_collision::Ref{Bool}: Are collision forces calculatedcollision_skin::Float64: Extra collision neighbor list cutoff radius in nm. The neighbor lists are reset after something moves over this amountcollision_switchover_scale_unitless::Float32: Smoothing scale to avoid sharp forces when two cylinders are collinearfilamentmechparams::Vector{MEDYAN.FilamentMechParams}: The filament mechanical parameters, indexed by filament type idfunc_membranespeciespotentialenergy::Any: Membrane species potential energy function. See docs on default function for more info.external_energy_forces!::Any: External energy/force expressions. This should be a mutating function taking a(fc::MEDYAN.ForceContext, vectorized_x), which adds tofc.forces, fc.energies, and fc.energy. The energy and force must be consistent, and this is not checked. This can be used as ad-hoc solutions to experiment with uncommon forces, such as specifically designed attachments, etc. If this variable is used often, consider moving it into MEDYAN.chemboundary::MEDYAN.Boundary: chemical boundary, updates compartment volumes and diffusion rateschem_boundary_oversampling_factor::Int64: Oversampling factor for chem boundary TSDF computation. Default is 4.chem_boundary_tsdf_max_distance::Float64: Maximum distance for TSDF truncation (nm). Actual max is max(this, 2.5*grid_spacing). Default is 312.5 nm.chem_boundary_tsdf_cache::Union{Nothing, Array{Float64, 3}}: Cached truncated signed distance field for chem boundary.nothingmeans cache is invalid.mechboundary::MEDYAN.Boundary: mechanical boundarysharedtypedconfigs::MEDYAN.SharedTypedConfigs: Shared configurations stored in type parameters.validflags::MEDYAN.ValidFlags: Interval system consistency validation flags.profiler::ZoneProfilers.Profiler
MEDYAN.set_time!
MEDYAN.get_time
MEDYAN.set_enable_collision!
MEDYAN.set_chem_boundary!
Set chemical boundary Note, the chem boundary should be outside the mech boundary so that it is rare for filaments to go outside the chem boundary.
Make sure to call apply_chem_boundary! to update the chem voxels.
See also Boundary
MEDYAN.is_chem_boundary_tsdf_cache_valid
MEDYAN.get_chem_boundary_oversampling_factor
MEDYAN.get_chem_boundary_grid_spacing
MEDYAN.set_chem_boundary_oversampling_factor!
MEDYAN.get_chem_boundary_tsdf_max_distance
MEDYAN.set_chem_boundary_tsdf_max_distance!
MEDYAN.get_chem_boundary_tsdf_actual_max_distance
MEDYAN.get_chem_boundary_tsdf!
MEDYAN.is_inside_chem_boundary!
Conservatively check if a position is inside the chem boundary by at least min_distance nm.
Uses the cached TSDF to provide a conservative (never false-positive) estimate. Returns true only if we can guarantee the point is inside by at least min_distance. Returns false if the point might be outside or within min_distance of the boundary.
The algorithm uses the TSDF values at the 8 vertices of the containing voxel. For each vertex with TSDF value t_v (negative = inside), and distance r from the query point to that vertex, the boundary is between t_v + r and t_v - r away from the point.
If the point is outside the TSDF grid, returns false (conservative).
The TSDF grid spacing defaults to the chem voxel spacing / 4. The oversampling factor can be increased with set_chem_boundary_oversampling_factor!. The TSDF max distance can be increased with set_chem_boundary_tsdf_max_distance!. If min_distance > max_distance - sqrt(3)*grid_spacing an error is thrown.
MEDYAN.apply_chem_boundary!
Update chem voxel volumes and diffusion rates.
The chem boundary is the intersection of any boundary set by set_chem_boundary! and membranes with chem_boundary=true.
set_chem_boundary_oversampling_factor! can be used to increase the boundary sampling resolution at the expense of increased memory use.
Calling this will invalidate the chem cache.
MEDYAN.set_mechboundary!
See also Boundary
MEDYAN.chem_adddiffusingcount!
MEDYAN.add_diffusing_count!
MEDYAN.chem_addfixedcount!
MEDYAN.adddiffusingcount_rand!
MEDYAN.addmembranediffusingcount_rand!
MEDYAN.run_chemistry!
MEDYAN.defer_chem_caching!
This should only be used for advanced optimizations.
During chemistry, the context mutating functions will typically try to avoid invalidating various cached data needed to quickly sample sites.
However, if you want to mutate the context outside of chemistry, for example right before or after minimization, you may not want to pay the cost of revalidating all the caches because minimization will already invalidate the caches. Caching will be enabled again and caches will be made valid the next time chemistry is run. Caching can also be manually refreshed and reenabled with: refresh_chem_cache!