src/boundary.jl

MEDYAN.Boundary

Mechanical boundary

See also boundary_box

  • planes::Vector{StaticArraysCore.SVector{4, Float64}}: Planes that make up the mechanical boundary of the simulation.

    E = 1//2 * relu(pos ⋅ planes[bi][1:3] - planes[bi][4])^2

    For example, a mech bounding plane [1,0,0,3] would try and make x < 3 nm with a spring constant of 1 pN/nm.

    2.0*[1,0,0,3] would try and make x < 3 nm with a spring constant of 4 pN/nm.

  • capsules::Vector{StaticArraysCore.SVector{8, Float64}}: Capsules that make up the mechanical boundary of the simulation.

    capsules[bi][1:3] is the starting point of the spine line segment (nm). capsules[bi][4:6] is the axis of the spine line segment (nm). capsules[bi][7] is the radius (nm). capsules[bi][8] is the spring constant (pN/nm).

    if capsules[bi][4:6] is zero then the capsule is a sphere. Capsule boundaries can be combined with plane boundaries to create cylinder boundaries.

    E = 1//2*k*relu(d - r0)^2 where:

    • d is the distance of the point to the spine line segment described by capsules[bi][1:6].
    • r0 is capsules[bi][7]
    • k is capsules[bi][8]

MEDYAN.boundary_plane

boundary_plane(
;
    normal,
    point,
    stiffness
) -> MEDYAN.Boundary

Return a plane boundary.

normal(unit vector): Vector pointing normal to the plane. This points outside of the boundary.

point(nm): Point on the plane.

stiffness(pN/nm): How strong the boundary is.

MEDYAN.boundary_box

boundary_box(
    grid::MEDYAN.CubicGrid;
    offset,
    stiffness
) -> MEDYAN.Boundary

Return a box boundary at the edge of a grid.

offset(nm): How far the bounding planes should be moved in from the edge of the grid. Positive is inside the grid, negative is outside the grid.

stiffness(pN/nm): How strong the boundary is.

MEDYAN.boundary_capsule

boundary_capsule(
;
    center,
    axis,
    radius,
    stiffness
) -> MEDYAN.Boundary

Return a capsule boundary.

center(nm): The center of the capsule.

axis(nm): The direction and length of the capsule spine. The spine line segment goes from center - axis/2 to center + axis/2 If zero the capsule is a sphere.

radius(nm): Radius of capsule, the full length of the capsule is norm(axis) + 2radius.

stiffness(pN/nm): How strong the boundary is.

MEDYAN.boundary_cylinder

boundary_cylinder(
;
    center,
    axis,
    radius,
    stiffness
) -> MEDYAN.Boundary

Return a cylinder boundary.

center(nm): The center of the cylinder.

axis(nm): The direction and length of the cylinder. The spine line segment goes from center - axis/2 to center + axis/2 the full length of the cylinder is norm(axis).

radius(nm): Radius of cylinder.

stiffness(pN/nm): How strong the boundary is.