src/links/balls.jl

MEDYAN.make_ball!

make_ball!(c::Context; position, radius, stiffness=1.0f0, state=SA[0,0,0], is_minimized=false) -> Tag{BallIdx}

Create a new ball in c and return a tag for it.

Keyword Arguments

  • position::SVector{3, Float64}: 3D position of the ball center (nm)
  • radius::Float32: Radius of the ball (nm)
  • stiffness::Float32=1.0: Mechanical stiffness coefficient (pN/nm)
  • state::SVector{3, Int64}=SA[0,0,0]: Three-component state vector for chemical reactions
  • is_minimized::Bool=false: Whether the ball is marked as minimized. By default balls are not minimized when created. Set to true to create a ball that is already marked as minimized.

See also: remove_ball!, update_ball!, get_position, is_minimized

MEDYAN.remove_ball!

remove_ball!(c::Context, ball::Union{BallIdx, Tag{BallIdx}})

Remove a ball from the simulation and unlink all connected links.

See also: make_ball!, update_ball!, get_position, is_minimized

MEDYAN.update_ball!

update_ball!(c::Context, ball::Union{BallIdx, Tag{BallIdx}}; kwargs...)

Update properties of an existing ball. Unspecified properties remain unchanged.

Keyword Arguments

  • position::Union{Nothing, SVector{3, Float64}}=nothing: New position (nm)
  • radius::Union{Nothing, Float32}=nothing: New radius (nm)
  • stiffness::Union{Nothing, Float32}=nothing: New stiffness (pN/nm)
  • state::Union{Nothing, SVector{3, Int64}}=nothing: New state vector
  • is_minimized::Union{Nothing, Bool}=nothing: Whether the ball is marked as minimized. Defaults to false when position or radius is changed, otherwise unchanged. Set explicitly to override the default behavior.

See also: make_ball!, remove_ball!, get_position, is_minimized

MEDYAN.is_minimized

is_minimized(c::Context, ball::Union{BallIdx, Tag{BallIdx}})::Bool

Return true if the ball has been minimized (i.e. its position has been updated by minimize_energy! since it was last created or modified).

Balls are marked as not minimized when created with make_ball! or when their position or radius is changed via update_ball!. All balls are marked as minimized at the end of minimize_energy!.

See also: make_ball!, update_ball!, minimize_energy!

MEDYAN.set_ball_cell_list_grid_spacing!

set_ball_cell_list_grid_spacing!(c::Context, spacing::Real)::Nothing

Set the grid spacing (nm) for the ball cell list. Changing the spacing will invalidate the ball cell list cache.