MEDYAN.jl
  • Home
  • Tutorials
  • How-To
  • Explanations
  • Reference
  • Versions
    • dev
    • stable

On this page

  • src/links/link-manager.jl
    • MEDYAN.num_link_types
    • MEDYAN.place2tag
    • MEDYAN.tag!
    • MEDYAN.has_tag
    • MEDYAN.tag2place
    • MEDYAN.get_position
    • MEDYAN.get_directions
    • MEDYAN.get_chem_state
    • MEDYAN.tag_exists
    • MEDYAN.get_all_tags
    • MEDYAN.link2tags
    • MEDYAN.get_state
    • MEDYAN.get_bond_states
    • MEDYAN.get_bond_enabled
    • MEDYAN.get_reaction_enabled
    • MEDYAN.is_minimized
    • MEDYAN.link_exists
    • MEDYAN.place2links
    • MEDYAN.tag2links
    • MEDYAN.make_link!
    • MEDYAN.remove_link!
    • MEDYAN.update_link!
    • MEDYAN.get_all_links
  • Edit this page
  • Report an issue

src/links/link-manager.jl

MEDYAN.num_link_types

num_link_types(c::Context)::Int

Return the number of link types.

MEDYAN.place2tag

place2tag(c::Context, p::Place)::Tag

Return the tag of the place. Throw an error if !has_tag(p).

MEDYAN.tag!

tag!(c::Context, p::Place)::Tag

Return the tag of the place. Throw an error if !place_exists(p). Create a new tag if !has_tag(p).

MEDYAN.has_tag

has_tag(c::Context, p::Place)::Bool

Return true iff p has a tag. Otherwise return false. If !place_exists(c, p) return false.

MEDYAN.tag2place

tag2place(c::Context, t::Tag)::Place

Return the place of the tag. Throw an error if !tag_exists(t).

MEDYAN.get_position

get_position(c::Context, x::Union{Tag, Place})::SVector{3, Float64}

Return the position of x. Throw an error if x doesn’t exist.

MEDYAN.get_directions

get_directions(c::Context, x::Union{Tag, Place})::SVector{N, SVector{3, Float64}}

Return the directions of x. N is from num_directions. Throw an error if x doesn’t exist.

MEDYAN.get_chem_state

get_chem_state(c::Context, x::Union{Tag, Place})

Return the chemical state of x. Each type of place has a different type of chemical state. If the chemical state of a place changes, any attached links will have their reaction rates recalculated. Throw an error if x doesn’t exist.

MEDYAN.tag_exists

tag_exists(c::Context, t::Tag)::Bool

Return true iff tag t exists in context c. Otherwise return false.

MEDYAN.get_all_tags

get_all_tags(c::Context, p::Place) -> Tag{typeof(p)} iterator

Return an iterator of existing tags for the type of p.

MEDYAN.link2tags

link2tags(c::Context, link::Link, [d::LinkData]) -> Tag tuple

Return a tuple of tags of places that link is attached to. If one of the places of link is not attached that tag will be null. Throw an error if link doesn’t exist.

MEDYAN.get_state

get_state(c::Context, link::Link, [d::LinkData])

Return the state of the link. Throw an error if link doesn’t exist.

MEDYAN.get_bond_states

get_bond_states(c::Context, link::Link, [d::LinkData])

Return the bond_states of the link. Throw an error if link doesn’t exist.

MEDYAN.get_bond_enabled

get_bond_enabled(c::Context, link::Link, [d::LinkData])

Return the bond_enabled flags of the link. Throw an error if link doesn’t exist.

MEDYAN.get_reaction_enabled

get_reaction_enabled(c::Context, link::Link, [d::LinkData])

Return the reaction_enabled flags of the link. Throw an error if link doesn’t exist.

MEDYAN.is_minimized

is_minimized(c::Context, link::Link, [d::LinkData])::Bool

Return the is_minimized flag of the link. Throw an error if link doesn’t exist.

MEDYAN.link_exists

link_exists(c::Context, link::Link)::Bool

Return true iff link exists in context c. Otherwise return false.

MEDYAN.place2links

place2links(c::Context, p::Place) -> Link iterator

Return an iterator of Links attached to p. If !place_exists(c, p) return an empty iterator.

MEDYAN.tag2links

tag2links(c::Context, t::Tag) -> Link iterator

Return an iterator of Links attached to t. If !tag_exists(c, t) return an empty iterator.

MEDYAN.make_link!

make_link!(c::Context; kwargs...)::Link

Return the new link.

The type keyword argument is required.

The other keyword arguments can be used to change the link from default.

Keyword Arguments

  • type::Union{Symbol,Integer}: the link type id or symbol.

  • places=(): places or tags to attach to the link.

    Set an element to nothing not change the attached place. Set an element to a null place or tag to detach that place.

  • state=(;): state properties to change.

    A NamedTuple of changes. For example, state = (;k1 = 3.6, k7 = 2.0,) to change state.k1 to 3.6 and state.k7 to 2.0.

  • bond_states=(): bond state properties to change.

    A Tuple of changes. If an element in the tuple is nothing, the corresponding bond state isn’t changed. For example, bond_states = (nothing, (;L0 = 3.6,)) to change bond_states[2].L0 to 3.6.

  • bond_enabled=(): bond enable flags to change.

    A Tuple of Union{Bool, Nothing}. If an element in the tuple isnothing, the corresponding bond enable flag isn't changed. For example,bond_enabled = (nothing, true, false)` to not change bond 1, enable bond 2, and disable bond 3.

  • reaction_enabled=(): reaction enable flags to change.

    A Tuple of Tuple of Union{Bool, Nothing}. If an element in the tuple isnothing, the corresponding reaction enable flag or flags aren't changed. For example,reaction_enabled = (nothing, (true, nothing, false))` to not change any reactions on place 1, enable reaction 1 on place 2, and disable reaction 3 on place 2.

  • is_minimized::Bool=false: is the link marked as minimized.

    By default links are marked as minimized at the end of mechanics when updated.

MEDYAN.remove_link!

remove_link!(c::Context, link::Link)::Nothing

Remove the link.

MEDYAN.update_link!

update_link!(c::Context, link::Link; kwargs...)::Nothing

Update the link.

Keyword Arguments

  • places=(): places or tags to attach to the link.

    Set an element to nothing not change the attached place. Set an element to a null place or tag to detach that place.

  • state=(;): state properties to change.

    A NamedTuple of changes. For example, state = (;k1 = 3.6, k7 = 2.0,) to change state.k1 to 3.6 and state.k7 to 2.0.

  • bond_states=(): bond state properties to change.

    A Tuple of changes. If an element in the tuple is nothing, the corresponding bond state isn’t changed. For example, bond_states = (nothing, (;L0 = 3.6,)) to change bond_states[2].L0 to 3.6.

  • bond_enabled=(): bond enable flags to change.

    A Tuple of Union{Bool, Nothing}. If an element in the tuple isnothing, the corresponding bond enable flag isn't changed. For example,bond_enabled = (nothing, true, false)` to not change bond 1, enable bond 2, and disable bond 3.

  • reaction_enabled=(): reaction enable flags to change.

    A Tuple of Tuple of Union{Bool, Nothing}. If an element in the tuple isnothing, the corresponding reaction enable flag or flags aren't changed. For example,reaction_enabled = (nothing, (true, nothing, false))` to not change any reactions on place 1, enable reaction 1 on place 2, and disable reaction 3 on place 2.

  • is_minimized::Bool=false: is the link marked as minimized.

    By default links are marked as minimized at the end of mechanics when updated.

MEDYAN.get_all_links

get_all_links(c::Context; type::Union{Symbol,Integer}) -> Link iterator

Return an iterator of all Links of type type.

  • Edit this page
  • Report an issue