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

On this page

  • src/links/link-manager.jl
    • MEDYAN.num_link_types
    • MEDYAN.link_type_name
    • MEDYAN.link_typeid
    • MEDYAN.place2tag
    • MEDYAN.tag!
    • MEDYAN.has_tag
    • MEDYAN.tag2place
    • MEDYAN.get_position
    • MEDYAN.get_directions
    • MEDYAN.get_material_frame
    • 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.get_colvar_stats
    • MEDYAN.get_colvar_thresholds
    • 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.link_type_name

link_type_name(c::Context, link::Link)::Symbol
link_type_name(c::Context; type::Union{Symbol, Integer})::Symbol

Return the name of the link’s type, or the name associated with type

MEDYAN.link_typeid

link_typeid(c::Context, link::Link)::Int
link_typeid(c::Context; type::Union{Symbol, Integer})::Int

Return the typeid of the link’s type, or the typeid associated with type

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_material_frame

get_material_frame(c::Context, x::Union{Tag, Place})::RotMatrix3{Float64}

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

The first column is the first direction. The second column is the second direction. The third column is cross(dirs[1], dirs[2]) to complete the right handed frame.

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.get_colvar_stats

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

Return the tuple of ColVarStats for the link, one per collective variable defined on its link type.

The stats are collected by baoab! and describe the configuration the link had during that run. They are NaN-filled until a run has collected them, and are reset to NaN by minimize_energy!, which doesn’t sample colvars, and by update_link! when it is passed reset_colvar_stats=true.

A colvar is only sampled while all of the places it reads are attached, so a colvar with any null input place will be reset to NaN after a full run.

Safe to read from a link reaction rate callback on link.

Throw an error if link doesn’t exist.

MEDYAN.get_colvar_thresholds

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

Return the tuple of per-link colvar thresholds of the link, one SVector{D, Float32} per collective variable defined on its link type (D is the colvar’s dimension).

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 to 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 NamedTuple or nothing. 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.

  • colvar_thresholds=(): colvar thresholds to change.

    A Tuple of nothing, Real, or AbstractVector. If an element in the tuple is nothing, the corresponding colvar threshold isn’t changed. A Real is accepted for a 1-dimensional colvar; otherwise a length-D vector is required. For example, colvar_thresholds = (nothing, 2.7) to leave colvar 1’s threshold unchanged and set colvar 2’s threshold to 2.7. See get_colvar_thresholds.

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

    A Tuple of Union{Bool, Nothing}. If an element in the tuple is nothing, 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 NamedTuple or nothing. If an element in the tuple is nothing, the corresponding reaction enable flags aren’t changed. For example, reaction_enabled = (nothing, (;a=true, b=false)) to not change any reactions on place 1, enable reaction a on place 2, and disable reaction b 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 to 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 NamedTuple or nothing. 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.

  • colvar_thresholds=(): colvar thresholds to change.

    A Tuple of nothing, Real, or AbstractVector. If an element in the tuple is nothing, the corresponding colvar threshold isn’t changed. A Real is accepted for a 1-dimensional colvar; otherwise a length-D vector is required. For example, colvar_thresholds = (nothing, 2.7) to leave colvar 1’s threshold unchanged and set colvar 2’s threshold to 2.7. See get_colvar_thresholds.

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

    A Tuple of Union{Bool, Nothing}. If an element in the tuple is nothing, 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 NamedTuple or nothing. If an element in the tuple is nothing, the corresponding reaction enable flags aren’t changed. For example, reaction_enabled = (nothing, (;a=true, b=false)) to not change any reactions on place 1, enable reaction a on place 2, and disable reaction b 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.

  • reset_colvar_stats::Bool=false: reset the link’s ColVarStats to NaN, discarding the stats collected by the last baoab! run.

    By default the stats are kept. See get_colvar_stats.

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