Structure analysis

Molecular surfaces

These types and functions are internal to the molecular-surface pipeline. They are not exported, but remain documented and callable via the qualified name (e.g. BiochemicalAlgorithms.make_watertight).

Reduced-surface graph records

BiochemicalAlgorithms.RSEdgeType
RSEdge{T}

Reduced-surface edge connecting two RS vertices (on two distinct atoms). The torus geometry describes the path swept by the probe center while rolling over the two atoms between the two adjacent faces.

source
BiochemicalAlgorithms.RSFaceType
RSFace{T}

Reduced-surface face: a triangle of three vertices (on three distinct atoms) plus the probe sphere center and outward normal.

source

Solvent-accessible-surface graph records

BiochemicalAlgorithms.SASEdgeType
SASEdge{T}

An arc on the SAS — the path traced by the probe center while rolling between two adjacent contact triples. Indexed by the parent RSEdge.

source
BiochemicalAlgorithms.SASFaceType
SASFace{T}

A connected component of the SAS lying on a single inflated atom. The sphere sphere is the atom sphere expanded by the probe radius; edges are the SAS edges that bound this region. orientation records whether each edge is traversed in its native direction (true) or reversed (false) when walking the boundary in face-normal order.

source

Solvent-excluded-surface graph records

BiochemicalAlgorithms.SESVertexType
SESVertex{T}

A vertex on the solvent-excluded surface — the point at which the rolling probe makes contact with an atom. Each SESVertex records the contact location, the atom it sits on, and (for traceability) the parent RS face or edge that produced it.

Fields

  • point::Vector3{T} — the contact point in 3D
  • atom::Int — 1-based atom index (in the source ReducedSurface.atoms)
  • rs_face::Int — source RS face index (0 if not face-derived)
  • rs_edge::Int — source RS edge index (0 if not edge-derived)
source
BiochemicalAlgorithms.SESEdgeType
SESEdge{T}

An edge on the SES, either convex (an arc on an atom — the boundary between a contact face and a toric face), concave (an arc on the probe sphere — the boundary between a spheric face and a toric face), or singular (a self-intersection where 4+ atoms touch the probe).

Fields

  • type::SESEdgeType.T
  • v1::Int, v2::IntSESVertex indices
  • circle::Circle3{T} — carrier arc
  • f1::Int, f2::Int — adjacent SES face indices (0 if missing)
source
BiochemicalAlgorithms.SESFaceType
SESFace{T}

A face on the SES. Three sub-types are represented:

  • SESFaceType.Contact — patch on an atom's surface visible to the probe (one per RSVertex). sphere holds the atom sphere.
  • SESFaceType.Toric — toroidal saddle swept by the probe between two atoms (one per RSEdge). sphere holds the torus's enclosing sphere (center + major radius).
  • SESFaceType.Spheric — inverted-probe patch when the probe sits on three atoms (one per RSFace). sphere holds the probe sphere.
  • SESFaceType.ToricSingular — toric face whose probe touches a fourth atom; treated as a degenerate case (recorded but not split).

Fields

  • type::SESFaceType.T
  • sphere::Sphere{T} — the surface the face lies on
  • rs_index::Int — index of the source RS element (face / edge / vertex)
  • vertices::Vector{Int} — SES vertex indices on this face's boundary
  • edges::Vector{Int} — SES edge indices bounding this face
source

Mesh repair helpers

BiochemicalAlgorithms.weld_close_verticesFunction
weld_close_vertices(m::GeometryBasics.Mesh; tol = 1e-3)

Post-pass that merges vertex pairs whose Euclidean distance is below tol (default 0.001 Å). Triangles whose 3 vertices collapse to fewer than 3 distinct points after welding are dropped (degenerate slivers — zero area). Returns a fresh GeometryBasics.Mesh with welded vertex pool.

source
BiochemicalAlgorithms.extract_manifoldFunction
extract_manifold(m::GeometryBasics.Mesh)

Post-pass that returns a maximal 2-manifold sub-mesh of m. For each non-manifold edge (3+ incident triangles), keeps a pair with consistent traversal (one direction a→b, other b→a) chosen by largest dot product of triangle normals (= smoothest dihedral). Drops the rest. Useful for simulation: the triangulator's advancing-front occasionally over-fills edges with sliver triangles, and simulation codes assume 2-manifold input.

Returns a fresh mesh with the kept triangle subset and unchanged vertices/normals.

source
BiochemicalAlgorithms.fill_holesFunction
fill_holes(m::GeometryBasics.Mesh; max_hole_size = 100)

Fill every boundary loop (closed cycle of count-1 edges) in m with a triangle fan from a newly inserted centroid vertex. Returns a fresh mesh where every edge is shared by ≥2 triangles (watertight on a 2-manifold input).

The triangle orientation of each fan is aligned with the local outward normal estimated from the loop's existing boundary triangles. max_hole_size caps the number of edges in any loop processed (very large loops are usually a sign of corrupt input topology).

Use after extract_manifold for simulation-quality watertight output. For boundary element / FEM codes that require closed manifolds, this is the final mesh post-pass.

source
BiochemicalAlgorithms.make_watertightFunction
make_watertight(m::GeometryBasics.Mesh; tol = 1e-3, max_hole_size = 100)

Convenience pipeline for simulation-quality watertight meshes:

  1. weld_close_vertices to merge coincident duplicates.
  2. extract_manifold to eliminate non-manifold edges.
  3. fill_holes to close all remaining boundary loops.

Returns a closed 2-manifold mesh suitable for boundary element / finite element / volumetric simulation codes that assume watertight input.

source

SES cleanup sub-steps

BiochemicalAlgorithms.split_spheric_faces!Function
split_spheric_faces!(ses) -> Int

Walk each spheric face's edge list; if the boundary decomposes into more than one closed loop, split the face into separate spheric faces (one per loop). Returns the number of new faces created. Idempotent.

source
BiochemicalAlgorithms.resolve_probe_intersections!Function
resolve_probe_intersections!(ses) -> Int

For every pair of adjacent RS faces (sharing an RS edge) whose probe spheres overlap, materialise the two intersection-circle endpoints as additional SES vertices and register them on both spheric faces' vertex lists. Returns the number of intersecting probe pairs handled.

This is the basic ("first-category") singularity cleanup. It does not subdivide the spheric or toric faces — call split_spheric_faces! afterwards if the resulting boundary may decompose into multiple loops.

source