CodeEntropy.levels.dihedrals module

Dihedral state assignment for conformational entropy.

This module converts selected-frame dihedral angle time series into discrete conformational state labels. The resulting state labels are used downstream to compute configurational entropy.

Frame-index contract:
  • FrameSelection.analysis_indices are used for MDAnalysis trajectory access in the active analysis universe.

  • Dihedral(...).run(start, stop, step) uses frame bounds in the active analysis-universe index space.

  • dihedral_results.results.angles is always indexed locally from zero. Never use an absolute/source frame index directly into that result array.

class CodeEntropy.levels.dihedrals.ConformationStateBuilder(universe_operations: Any)[source]

Bases: object

Build conformational state labels from selected-frame dihedral angles.

build_conformational_states(data_container: Any, levels: dict[Any, list[str]], groups: dict[int, list[Any]], bin_width: float, frame_selection: FrameSelection, progress: _RichProgressSink | None = None) tuple[dict[tuple[int, int], list[str]], list[list[str]], dict[tuple[int, int], int], list[int]][source]

Build conformational state labels from selected trajectory frames.

Parameters:
  • data_container – MDAnalysis Universe or compatible container used to extract fragments and compute dihedral time series.

  • levels – Mapping of molecule id to enabled level names.

  • groups – Mapping of group id to molecule ids.

  • bin_width – Histogram bin width in degrees used when identifying peak dihedral populations.

  • frame_selection – FrameSelection controlling which frames are analysed. During the current migration stage, analysis_indices are local indices into the physically frame-sliced analysis universe.

  • progress – Optional progress sink.

Returns:

Tuple (states_ua, states_res, flexible_ua, flexible_res).