CodeEntropy.levels.neighbors module

Frame-local neighbour observables for orientational entropy.

The frame execution layer calls Neighbors once per selected trajectory frame. Each call returns mergeable neighbour-count totals for every molecule group. Static symmetry and linearity metadata is computed separately because it does not vary by frame.

class CodeEntropy.levels.neighbors.Neighbors(search: Search | None = None)[source]

Bases: object

Compute neighbour-count and orientational metadata observables.

get_frame_neighbor_counts(*, universe: Any, levels: list[list[str]], groups: dict[int, list[int]], frame_source: Any, frame_index: int, search_type: str) dict[int, tuple[int, int]][source]

Return neighbour-count totals for one selected frame.

The returned (total, sample_count) pairs are intentionally additive. Parent-side reducers combine them across frames and divide at finalisation.

get_symmetry(*, universe: Any, groups: dict[int, list[int]]) tuple[dict[int, int], dict[int, bool]][source]

Return symmetry numbers and linearity flags for each molecule group.