CodeEntropy.levels.nodes.covariance module¶
Frame-level covariance (second-moment) construction.
This module computes per-frame second-moment matrices for force and torque vectors at each hierarchy level (united_atom, residue, polymer). Results are incrementally averaged across molecules within a group for the current frame.
Responsibilities: - Build bead-level force/torque vectors using ForceTorqueCalculator. - Construct per-frame force/torque second moments (outer products). - Optionally construct combined force-torque block matrices. - Average per-frame matrices across molecules in the same group.
Not responsible for: - Defining groups/levels/beads mapping (provided via shared context). - Axis construction policy (delegated to axes_manager). - Accumulating across frames (handled by the higher-level reducer).
- class CodeEntropy.levels.nodes.covariance.FrameCovarianceNode[source]¶
Bases:
objectBuild per-frame covariance-like (second-moment) matrices for each group.
This node computes per-frame second-moment matrices (outer products) for force and torque generalized vectors at hierarchy levels:
united_atom
residue
polymer
Within a single frame, outputs are incrementally averaged across molecules that belong to the same group. Frame-to-frame accumulation is handled elsewhere (by a higher-level reducer).
- run(ctx: dict[str, Any]) dict[str, Any][source]¶
Compute and store per-frame force/torque (and optional FT) matrices.
- Parameters:
ctx – Frame context dict expected to include: - “shared”: dict containing reduced_universe, groups, levels, beads, args - shared[“axes_manager”] (created in static stage)
- Returns:
The frame covariance payload also stored at ctx[“frame_covariance”].
- Raises:
KeyError – If ctx is missing required fields.